c/s b3b7cfb7ac "build: move bootloader data out of measured block" moved the
lz_header variable, but didn't adjust the hard-coded
LZ_FIRST_STAGESTACK{START,SIZE} constants.
with the stack now starting in the middle of L4 pagetable relocation.
This functioned at the time as the stack isn't used until entering C, but c/s
b19561a81 "head: Clobber the IDT limit" introduced two push $0's at the
start.
Therefore, what the processor actually executes is:
with the pushes having clobbered bytes 0x1f8 thru 0x200. This destroys the
relocation of the 64bit JMP and L4 pagetable (in the 64bit setup case) or the
LGDT and segment setup itself (in the 32bit setup case).
To fix things, let the linker evaluate where the stack starts. It turns out
that everything in config.h is unused or stale now, so delete it completely.
Expand the stack slightly so it stays on the 0x200 boundary.
P.S. This didn't show up in my testing, because I had an extra debug print
which pushed the push $0's late enough to not clobber yet-to-be-executed
code, and therefore wasn't actually testing the final article.
c/s b3b7cfb7ac "build: move bootloader data out of measured block" moved the lz_header variable, but didn't adjust the hard-coded LZ_FIRST_STAGESTACK{START,SIZE} constants.
Therefore, the entrypoint looked like this:
with the stack now starting in the middle of L4 pagetable relocation.
This functioned at the time as the stack isn't used until entering C, but c/s b19561a81 "head: Clobber the IDT limit" introduced two
push $0
's at the start.Therefore, what the processor actually executes is:
with the pushes having clobbered bytes 0x1f8 thru 0x200. This destroys the relocation of the 64bit JMP and L4 pagetable (in the 64bit setup case) or the LGDT and segment setup itself (in the 32bit setup case).
To fix things, let the linker evaluate where the stack starts. It turns out that everything in config.h is unused or stale now, so delete it completely.
Expand the stack slightly so it stays on the 0x200 boundary.
Signed-off-by: Andrew Cooper andrew.cooper3@citrix.com
P.S. This didn't show up in my testing, because I had an extra debug print which pushed the
push $0
's late enough to not clobber yet-to-be-executed code, and therefore wasn't actually testing the final article.