generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 20
Extables #220
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
Merged
Merged
Extables #220
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cdeb653
regions.h: make __{start,end}_* markers more easily usable
minipli-oss 501ccf6
extables: fix extables handling to handle exceptions for real
minipli-oss 189b3b8
extables: introduce symbol to mark the end of defined entries
minipli-oss db056b2
include/*: add needed dependent header includes
minipli-oss bb72da4
extables: verify entry validity during boot
minipli-oss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,7 @@ SECTIONS | |
| { | ||
| __start_extables = .; | ||
| *(.extables) | ||
| __stop_extables = .; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very nice catch. Thanks! |
||
| . = ALIGN(4K); | ||
| __end_extables = .; | ||
| } :kernel | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -289,29 +289,27 @@ void print_callstack(const void *sp, const void *ip) { | |
| printk("\n"); | ||
| } | ||
|
|
||
| static inline void use_extables(struct cpu_regs *regs) { | ||
| for (extable_entry_t *cur = __start_extables; cur < __end_extables; ++cur) { | ||
| if (regs->_ASM_IP == cur->fault_addr) { | ||
| if (cur->fixup) { | ||
| regs->_ASM_IP = cur->fixup; | ||
| } | ||
| if (cur->cb) { | ||
| cur->cb(regs); | ||
| } | ||
| if (cur->fixup || cur->cb) { | ||
| return; | ||
| } | ||
| else { | ||
| panic("fixup or cb must be set in the extable_entry\n"); | ||
| } | ||
| } | ||
| static bool extables_fixup(struct cpu_regs *regs) { | ||
| for (extable_entry_t *cur = __start_extables; cur < __stop_extables; ++cur) { | ||
| if (regs->_ASM_IP != cur->fault_addr) | ||
| continue; | ||
|
|
||
| if (cur->fixup) | ||
| regs->_ASM_IP = cur->fixup; | ||
| else if (cur->cb) | ||
| cur->cb(regs); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| void do_exception(struct cpu_regs *regs) { | ||
| static char ec_str[32], panic_str[128]; | ||
|
|
||
| use_extables(regs); | ||
| if (extables_fixup(regs)) | ||
| return; | ||
|
Comment on lines
-314
to
+312
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ugh... Thanks! |
||
|
|
||
| dump_regs(regs); | ||
| print_callstack(_ptr(regs->_ASM_SP), _ptr(regs->_ASM_IP)); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Good idea to have them sanity checked. Thanks!
Next step could be to sort them and use bsearch to speed up lookup.
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.
Right now we've only like 8 entries, so a linear search should still be fast enough. ;) But yeah, when we get more users and especially ones in hot code, speeding up the search might make sense.