0

I know two ways to redirect the execution flow, from user-space to kernel in x86_64:

1. SYSCALL Service

2. Software interrupts

Is there any other way to go into kernel from user-space?

Any help would be appreciated.

Puffy
  • 401
  • 6
  • 13
  • 1
    By kernel do you mean Ring 0? Off the top of my head: `call` (but not `jmp`), `sysenter` and exceptions (e.g. page faults, debug exceptions and similar). – Margaret Bloom Feb 27 '18 at 21:01
  • @MargaretBloom: yeah, AFAIK that's all. I made a list of user->kernel methods that can be used as a system-call ABI on [this question](https://stackoverflow.com/questions/46022184/osdev-syscall-sysret-and-sysenter-sysexit-instructions-enabling). Apparently an invalid-instruction trap was the fastest way on 80386, and actually used for system calls by Windows/386. Can you use `iret` from user-space for this? I know you can use `iret` as an alternative to `far jmp`. – Peter Cordes Feb 27 '18 at 21:36
  • @PeterCordes Nice answer there. `iret` can only transfer control to less or equal privileged code. – Margaret Bloom Feb 27 '18 at 21:56
  • @MargaretBloom Yes I mean Ring 0. How can I got to Ring 0 from Ring 3 with a call? Interesting, thanks for your comment. – Puffy Feb 27 '18 at 22:42
  • @PeterCordes very interesting link, nice apport, thanks. – Puffy Feb 27 '18 at 22:45
  • Do you know how exceptions are handled? Is there a way to register a handler or how does it work? – Puffy Feb 27 '18 at 22:48
  • @MargaretBloom if you refered to `call gates` when said `call` I found it in the Peter's link. https://wiki.osdev.org/System_Calls#Call_Gates_.28Intel.29 – Puffy Feb 27 '18 at 23:03
  • I guess we can include Exceptions in the group of system interrupts that pertain to IDT way: https://wiki.osdev.org/Exceptions – Puffy Feb 27 '18 at 23:07

0 Answers0