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?
TSS exception immediately after switching to usermode
TSS exception immediately after switching to usermode
And there shall be nothing impossible to those who believe
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: TSS exception immediately after switching to usermode
Of course the processor has to execute something, and it does whatever it finds at _1 because you told it to - that means that whatever code you want to run in userland should go there.
As for the TSS exception, there are a bunch of reasons why you'd get that. A list of potential causes is listed in the processor manuals (you need 3A, find the exception reference), although the most likely cause is that one hasn't been set up - you need a TSS before going to userland or you won't be coming back.
As for the TSS exception, there are a bunch of reasons why you'd get that. A list of potential causes is listed in the processor manuals (you need 3A, find the exception reference), although the most likely cause is that one hasn't been set up - you need a TSS before going to userland or you won't be coming back.