-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[interrupt-handlers] adds exception handling to the hyperlight guest #250
[interrupt-handlers] adds exception handling to the hyperlight guest #250
Conversation
f441a46
to
918bc74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
bf3ceb8
to
1070168
Compare
a8b548a
to
6240501
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to be in pretty good shape overall. A general comment: for structure, bitfield, etc. layouts, please cite the Intel or AMD manuals (either is fine, but we should pick one and stick with it, unless the explanation in the other is far better), instead of the osdev wiki. The manuals, unlike the wiki, are authoritative and unlikely to change :)
On a procedural note: can we squash the "fixes" commits into the original commits (or at least turn them into fixup!s immediately after the original commit, that we have checked will squash nicely without conflicts, and then run rebase --autosquash before merging?)
28cbf38
to
4a9b587
Compare
6755f02
to
4b88c02
Compare
…n handler - interrupt handler entry stubs = -- added macros to save/restore register context -- added defintions for different exceptions (_do_excp0-20+30), which save context, set params per SysV ABI, call handler, restore context, then iretq via macros. - added an exception handler that are used by the _do_excp* fxns. Note: this code is specific for x86_64 Signed-off-by: danbugs <danilochiarlone@gmail.com>
- added IdtEntry structure, - created IDT static mut array, and - made fxns to init_idt and set_idt_entry. Signed-off-by: danbugs <danilochiarlone@gmail.com>
- made Idtr structure (+ its static mut global var) to house the IDT, and - made load_idt fxn that uses global_asm's lidt to load the IDT. Signed-off-by: danbugs <danilochiarlone@gmail.com>
- added GdtEntry struct for GDT static mut global var, - added null, kernel code, and kernel data segments to GDT, - added code to load the GDT, and - added calls to init_idt, load_idt, and load_gdt to entrypoint. Signed-off-by: danbugs <danilochiarlone@gmail.com>
- added new guest fxn to simpleguest that triggers an invalid opcode exception - added test in guest_dispatch that calls the new guest fxn to test exception handling Signed-off-by: danbugs <danilochiarlone@gmail.com>
4b88c02
to
8eafa0d
Compare
This PR introduces exception handling to the Hyperlight guest by setting up and loading a Global Descriptor Table (GDT) and an Interrupt Descriptor Table (IDT) onto the CPU.
GDT Setup & Loading
lgdt
.IDT Setup & Exception Handlers
iretq
.context_save
andcontext_restore
to properly preserve CPU state.lidt
.This PR closes #228.