Skip to content

Instant double fault on syscall instruction - need help #1380

Discussion options

You must be logged in to vote

So I was missing 2 things:

  • Set a privilege stack table entry
  • Enable sycalls by setting bit 0 to 1 in IA32_EFER:
let mut ia32_efer = Msr::new(0xC0000080);
let mut value = ia32_efer.read();
value |= 0b1;
ia32_efer.write(value);

And syscall works now. No need to have kernel in higher half addresses.

This is how I realized that the invalid opcode was caused by not setting the efer thing: https://shell-storm.org/x86doc/SYSCALL.html

Replies: 2 comments 16 replies

Comment options

You must be logged in to vote
16 replies
@ChocolateLoverRaj
Comment options

@tsatke
Comment options

@ChocolateLoverRaj
Comment options

@tsatke
Comment options

@ChocolateLoverRaj
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ChocolateLoverRaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants