Well,... I was wondering if it's possible for an application to have no pages to the kernel, but still be able to make a syscall.
For example the application calls :
int $0x80
This calls linux-compatible interruption.
Now I don't want to page the interruption handler to the application. It seems that cr0 and cr3 aren't altered when int is called, so I was wondering if it's possible for the system to jump to a non-mapped area upon receiving an interrupt. Obviously no, but still... I wonder if it's really impossible.
Any clue about that is welcome
Memory paging and interruptions
- 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:
Provided you have a valid ESP0/SS0, it can be done:
- application calls INT xxx
- processor loads ESP and SS from the TSS, CS and EIP from the IDT and jumps to that location.
- Processor generates a pagefault as the code does not exists
- Pagefault handler pages in the interrupt handler
- Pagefault handler resumes execution
- The interrupt is restarted and the syscall is executed
Alternatively, you can force a GPF on the INT call, check which int is called and act accordingly.
In either case, read the manuals for more info.
- application calls INT xxx
- processor loads ESP and SS from the TSS, CS and EIP from the IDT and jumps to that location.
- Processor generates a pagefault as the code does not exists
- Pagefault handler pages in the interrupt handler
- Pagefault handler resumes execution
- The interrupt is restarted and the syscall is executed
Alternatively, you can force a GPF on the INT call, check which int is called and act accordingly.
In either case, read the manuals for more info.
You should do that. Your application does not need write access to this page, but what's the problem if it sees this handler in memory ? If you want to change from user to kernel mode you can use Task Gates, but it's slow and needs a lot of extra work.Now I don't want to page the interruption handler to the application
-
- Posts: 22
- Joined: Mon Dec 04, 2006 5:34 pm