-
Notifications
You must be signed in to change notification settings - Fork 20
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
Exception table support #212
Conversation
include/extables.h
Outdated
uint64_t fault_addr; | ||
|
||
uint64_t fixup; |
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.
maybe void *
would be a better type?
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.
Actually x86_reg_t
would be a better one
include/lib.h
Outdated
volatile bool _read = false; | ||
uint32_t low, high; | ||
|
||
asm volatile("1: rdmsr; movq $1, %[read];" |
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 code could be made simpler with asm goto
directive, the supplied in label can point to the error condition.
Please also fix in the
|
nit: please also add empty |
Add support for exception tables. It is possible to register an address that triggers an exception to call an handler, jump to a fixup address or both. Signed-off-by: Daniele Ahmed <[email protected]>
Add new rdmsr_safe and wrmsr_safe. These two functions use exception tables to try performing their operations and returning safely if the operation could not be performed. Signed-off-by: Daniele Ahmed <[email protected]>
In AcpiOsReadable and AcpiOsWriteable the checks for mapped pages and their permissions for reading and writing respectively are performed with exception tables Signed-off-by: Daniele Ahmed <[email protected]>
Issue #, if available: #6
Description of changes:
This PR adds support for exception tables and uses them to implement rdmsr_safe and wrmsr_safe, that will fail by reporting the error in a boolean variable if the operation on an msr can't be completed due to an exception.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.