Octocontrabass wrote:
What will happen when other_function() returns? What will it return to? Will it be able to restore the callee-saved registers properly?
I was thinking, instead of calling a function, if I can discard the stack of the function causing the exception, access the parent's stack frame, and use the return address saved on to the stack when the erroneous function is called, and return to that as if the function returned by itself? As my entire kernel runs in flat segment, it hould work as a normal function return..
I think something like:
Code:
mov esp, ebp ;clearing the current stack frame(assuming interrupt doesn't automatically set new frame)
mov ebp, [ebp] ;getting the bottom of parent stack frame
pop ebx ;this should be the return address stored when the erroneous function is called
pushf
push cs ;OR mov ax, cs, push eax
push ebx
iretd
Does this work with necessary corrections? Or is there something I am missing? It shouldn't have that return problem, and should work once I get the stack right..