Move remaining assembly code to C by dgruss · Pull Request #322 · isec-tugraz/sweb · GitHub
Skip to content

Move remaining assembly code to C - #322

Open
dgruss wants to merge 3 commits into
mainfrom
c-interrupt-entry
Open

dgruss wants to merge 3 commits into
mainfrom
c-interrupt-entry

Conversation

@dgruss

@dgruss dgruss commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

This finishes a cleanup I started in late 2014, when I moved most of the low-level assembly code to C/C++. The saved-register structs use the same stack and register layout trick the x86 code has used since then. I also had a prototype using pseudo-naked functions for the remaining entry code several years ago, but this is much nicer now that GCC supports naked functions.

Move the remaining boot and interrupt entry code from .S files to C/C++. This lets the entry paths call C/C++ directly and makes the stack layouts visible as C structs. Where GCC ignores naked, use a computed pseudo-naked entry point.

Also add synthetic stack frames on x86 so kernel backtraces continue at the instruction which was interrupted.

This removes the last .S files from the tree.

The page-fault diagnostics and interrupt backtrace frames included here are split out from Florian Kargl's #287.

@dgruss

dgruss commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

@dgruss dgruss linked an issue Oct 12, 2026 that may be closed by this pull request
@dgruss
dgruss force-pushed the c-interrupt-entry branch 2 times, most recently from 47d46b8 to 67005ff Compare October 13, 2026 05:59
@dgruss
dgruss force-pushed the c-interrupt-entry branch from 67005ff to 00ca4a2 Compare October 14, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

attribute((interrupts)) or attribute((naked))

1 participant