User Mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

User Mode

Post by Jeko »

How can I switch to the ring 3 from ring 0?
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: User Mode

Post by Hery »

You must jump to code segment with privellege level 3. You can do it when you set up TSS. How to set up TSS you can find in Intel Manuals
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: User Mode

Post by earlz »

doing iret is also a good method
darktemplar
Posts: 17
Joined: Mon Jan 16, 2006 12:00 am
Location: Poland
Contact:

Re: User Mode

Post by darktemplar »

But you first have to have a TSS, before you do any IRET
<a href="http://miaexokernel.sourceforge.net">Mia Exokernel</a>
If you want to map 16 EB using 4kb pages in IA-64, these structures will require 33619968 GB 131328 MB.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: User Mode

Post by earlz »

i dont have a tss and my iret method works
its called software task switching
User avatar
gaf
Member
Member
Posts: 349
Joined: Thu Oct 21, 2004 11:00 pm
Location: Munich, Germany

Re: User Mode

Post by gaf »

Even with software task-swicthing you need at least one TSS per CPU on the IA32 architecture. While you can switch to user-mode without having a TSS, the first call of an interrupt will cause a triple-fualt as the kernel stack pointer can't be determined (Intel reference manual, volume 3: chapter 5.12 - Exception and Interrupt handling).

regrads,
gaf
darktemplar
Posts: 17
Joined: Mon Jan 16, 2006 12:00 am
Location: Poland
Contact:

Re: User Mode

Post by darktemplar »

hckr83, I have software task switching in my kernel too, and it requires a TSS =)
<a href="http://miaexokernel.sourceforge.net">Mia Exokernel</a>
If you want to map 16 EB using 4kb pages in IA-64, these structures will require 33619968 GB 131328 MB.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: User Mode

Post by earlz »

hmmm maybe thats why im getting invalid opcode error
after i think about it it seems right that it wouldnt know the kernel stack
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: User Mode

Post by JAAman »

yes -- though it shouldn't cause an invalid opcode error -- infact you could never recieve any error at all -- it would just tripple-fault

you can switch into a ring3 task, but not out of it without the information located in the TSS, so if any exception hard-int, or soft-int occures, whos handler is not in ring3, you will triple-fault
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: User Mode

Post by earlz »

i thought it would gpf

but how can i still display the exception message if i can't go back to ring0
darktemplar
Posts: 17
Joined: Mon Jan 16, 2006 12:00 am
Location: Poland
Contact:

Re: User Mode

Post by darktemplar »

Conclusion - get this TSS
Last edited by darktemplar on Sun Mar 19, 2006 12:00 am, edited 1 time in total.
<a href="http://miaexokernel.sourceforge.net">Mia Exokernel</a>
If you want to map 16 EB using 4kb pages in IA-64, these structures will require 33619968 GB 131328 MB.
Post Reply