Skip to content
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

[kernel] Ensure all words aligned on word boundaries #1947

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Aug 1, 2024

Pursuant to the discussion with @Mellvik in calculating 8088 instruction execution speed and on devising a precision timer in Mellvik/TLVC#71.

The biggest find here is that the kernel interrupt stack (which is used whenever a hardware interrupt takes place) was sometimes (only when CONFIG_TRACE set) allocated at an odd address - which on an 8086 CPU increases stack read/write (e.g. PUSH/POP) by 4 cycles each instruction!! Not a super big deal since production versions have CONFIG_TRACE off, but still quite a potential slowdown on real hardware during development.

Data produced by the C compiler is automatically aligned, but all ASM data should use .p2align 1 for word variables at the start of the .data or .bss section. .comm variables have alignment specified in their directive separately.

@ghaerr ghaerr merged commit afe0b92 into master Aug 1, 2024
2 checks passed
@ghaerr ghaerr deleted the align branch August 2, 2024 04:28
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.

1 participant