More Of The Linux Kernel's x86 Assembly Code Gets Rewritten In C

Written by Michael Larabel in Linux Kernel on 18 June 2015 at 03:49 PM EDT. 43 Comments
More of the Linux kernel's complicated and poorly maintained x86 Assembly code continues to be rewritten in modern and clean C.

With Linux 4.1 comes many x86 ASM code changes, "over 100 separate cleanups, restructuring changes, speedups and fixes in the x86 system call, irq, trap and other entry code, part of a heroic effort to deobfuscate a decade old spaghetti asm code and its C code dependencies."

For merging into Linux 4.2 and later will be more x86 Assembly code clean-ups. Andy Lutomirski has been working on some big x86-ASM-to-C conversion patches and today published his second version of his rewrite of exit-to-userpsace code. Andy explained the work, "The exit-to-usermode code is copied in several places and is written in a nasty combination of asm and C. It's not at all clear what it's supposed to do, and the way it's structured makes it very hard to work with. For example, it's not even clear why syscall exit hooks are called only once per syscall right now. The existing code also makes context tracking overly complicated and hard to understand. Finally, it's nearly impossible for anyone to change what happens on exit to usermode, since the existing code is so fragile."

Alex confessed, "I tried to clean it up incrementally, but I decided it was too hard. Instead, this series just replaces the code. It seems to work."

It's great to see the Linux kernel code continue to be cleaned up and modernized. Hopefully several more big batches of x86 ASM code clean-ups will be forthcoming.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week