TSS exception immediately after switching to usermode
Posted: Wed Jan 19, 2011 8:32 am
Guys, i get this tss exception when i switch to user mode, even though i've not loaded a tss yet, below is my usermode switch code, and when iret is executed is starts executing from address _1:, so any function below _1: in my asm file, is executed this something i should worry about?, or is there a fix
_to_usermode:
cli
mov ax, 0x23
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov eax, esp
push 0x23
push eax
pushf
push 0x1B
push _1
iret
_ 1:
_pgbit: > This function is executed, when iret in the function above is executed
mov eax,cr0
Something just flashed in my head just now; would moving the _to_usermode function to the end of my asm file where there is no function or instruction afterward solve the problem?
_to_usermode:
cli
mov ax, 0x23
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov eax, esp
push 0x23
push eax
pushf
push 0x1B
push _1
iret
_ 1:
_pgbit: > This function is executed, when iret in the function above is executed
mov eax,cr0
Something just flashed in my head just now; would moving the _to_usermode function to the end of my asm file where there is no function or instruction afterward solve the problem?