Page 1 of 1

Userland

Posted: Thu Oct 25, 2007 12:16 am
by gmoney
Does anyone know any good tut out there for switching to user land and back to kernel land?

Posted: Thu Oct 25, 2007 2:20 am
by JamesM
It's not difficult to switch from user land to kernel land. The difficulty comes the other way round.

switching from user land to kernel land

Code: Select all

int $0x80
syscalls are typically implemented using an interrupt service routine hook - set up eax,ebx,ecx etc to pass paramters then interrupt. The kernel handles the interrupt as a 'syscall'.

The other way is more difficult and involves an IRET to change the CPL. (current privilege level)

Posted: Thu Oct 25, 2007 6:15 pm
by JackScott
The following from osdever.net might be useful:
http://www.osdever.net/tutorials/soft_ts.php