Page 1 of 1

Syscalls in user mode

Posted: Thu Aug 06, 2009 8:07 pm
by alethiophile
I am following JamesM's tutorial, now working on user mode and syscalls. I wrote out the code and tested it, as such:

Code: Select all

  init_syscalls();

  goto_user_mode();

  syscall_mputs("Hello, world!");
This does nothing. I have verified that control reaches the syscall_mputs, but it does not print anything, and diagnostic print statements in the ISR and syscall handlers do not get printed. When the goto_user_mode() is commented out, on the other hand, it executes the syscall correctly. I would put more code here, but I'm not really sure what bit of the code is relevant, or why this would happen--what does user mode have to do with executing an interrupt? Does anyone have any thoughts?

Re: Syscalls in user mode

Posted: Thu Aug 06, 2009 8:58 pm
by alethiophile
OK, reading the Intel manuals, I set the privilege level on the IDT entry to 3, and it works fine now. Never mind. #-o

Re: Syscalls in user mode

Posted: Sat Aug 08, 2009 11:10 pm
by earlz
alethiophile wrote:OK, reading the Intel manuals, I set the privilege level on the IDT entry to 3, and it works fine now. Never mind. #-o
Yes, I believe thats a bug in his tutorial(I think I've messaged him about it too)