-
Notifications
You must be signed in to change notification settings - Fork 102
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
Avoid duplicating assembly for different boards #456
Comments
This would be a good improvement! It could bite us if we change one file but forget to change the other. Just to cover the bases, are there any solutions besides the C preprocessor? |
I considered something with string replace, along the lines of sample.asm
extras.inc
main.rs
In theory this should work but:
|
Oh also this is a decent option so we have something in rust rather than calling the C preprocessor as a subprocess: https://docs.rs/gpp/0.6.0/gpp/ |
I wrote a minimal preprocessor from scratch here: #458 It's all rust and can easily be called from build scripts without any external dependencies. |
We should make an effort to deduplicate assembly code that is needed for different use cases but is largely the same. One such example is code in
src/arch/x86/x86_64/src/bootblock.S
andsrc/arch/x86/x86_64/src/bootblock_nomem.S
. They contain identical code for entering long mode, ISA constants, and some other things. Maintaining assembly is a pain, it's best to reduce the burden as much as possible.My recommendation would be to just run assembly files through the C preprocessor to enable the use of
#include
and#define
. I'm happy to work on this, just want to post it here to make sure folks agree with the approach.The text was updated successfully, but these errors were encountered: