I have a problem with manual context switching. I am implementing kernel with multi-threading in C with assembly code by manually saving stack segment and stack pointer and restoring them. Simple tasks work but trying to execute a function that is placed deeper in the code does not behave good. What happens is that the cursor in cmd.exe
where the program is being ran starts jumping from upper left to bottom left corner and the code writes itself over.
Can you suggest anything that could do something like that? What makes cursor go all the way up?