fix: thread switch gets back into the isr routine but iret does not return to the correct frame
This commit is contained in:
@ -4,11 +4,9 @@
|
||||
.global switch_thread
|
||||
|
||||
switch_thread:
|
||||
push ebx
|
||||
push ebp
|
||||
push edi
|
||||
push esi
|
||||
|
||||
mov edx, DWORD PTR [esp]
|
||||
cmp DWORD PTR [current_tcb], 0
|
||||
je .LABEL1
|
||||
mov eax, [current_tcb]
|
||||
|
||||
// save the current stack pointer to the old stack
|
||||
@ -16,6 +14,7 @@ switch_thread:
|
||||
|
||||
// stack pointer + the 4 regs pushed
|
||||
// and + 1 to get the argument (next thread)
|
||||
.LABEL1:
|
||||
mov esi, [esp+(4+1)*4]
|
||||
mov [current_tcb], esi
|
||||
|
||||
@ -23,9 +22,6 @@ switch_thread:
|
||||
|
||||
mov esp, [eax+0] // get esp
|
||||
|
||||
pop esi
|
||||
pop edi
|
||||
pop ebp
|
||||
pop ebx
|
||||
|
||||
iret
|
||||
push edx
|
||||
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user