Code: Select all
[BITS 32]
SECTION .text
KERNEL_DATA_SEL equ 0x10
GLOBAL _curr_task
GLOBAL _task_timer
EXTERN _task_timer_c
EXTERN _running_stack
EXTERN _TSS
_task_timer:
pushad
push ds
push es
push fs
push gs
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, _running_stack
mov dword [eax], esp
push eax
call _task_timer_c
pop ebx
test ebx, eax
je noswitch
mov _running_stack, ebx <------------- HERE'S THE ERROR!
cmp dword[ebx], 0x03
jne notss
mov ecx, [_TSS]
mov word [ecx+8], KERNEL_DATA_SEL
mov edx, [ebx+8]
add edx, 4096
mov dword[ecx+4], edx
notss:
mov esp, [ebx]
noswitch:
pop gs
pop fs
pop es
pop ds
popad
iretd