Hacker News new | ask | show | jobs
by anfilt 2369 days ago
It's more than just execution speed. It could something as simple making a function using assembly that swaps the virtual memory page table on a processor. That's not something you gonna find in a high level language.
1 comments

Yup. The example I implemented in college is stack pointer manipulation to implement multithreading (think pthread).

Some things can only be done in assembly.

Yea done that myself, save all the register states, save the stack pointer, and then set a new stack pointer and load all that tasks register states.

Although doing the same on windows is kinda annoying. Also the amount callee saved registers is kinda like what the heck. Here is some code I wrote doing that for window's ABI. https://pastebin.com/jnxeMRcV