Hacker News new | ask | show | jobs
by dahfizz 2369 days ago
Yup. The example I implemented in college is stack pointer manipulation to implement multithreading (think pthread).

Some things can only be done in assembly.

1 comments

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