Setting stack before jumping to kernel code makes it randomly crash (e.g. invalid opcode)

See here

if I uncomment the commented lines in that asm statement, the kernel behaves weirdly
e.g. throws invalid opcode errors or page faults.
The kernel allocates 4KiB of memory for the stack; see here:

Turns out, the issue was the stack being too small. I guess 4KiB is not enough for rust, set it to 2MiB and now everything works properly.
This thread shall be closed

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.