bootloader icon indicating copy to clipboard operation
bootloader copied to clipboard

Update stage_3.s

Open prinzdezibel opened this issue 3 years ago • 2 comments

  • Data descriptor is not needed in long mode
  • 41th bit of code descriptor is unused in long mode

prinzdezibel avatar Apr 06 '22 19:04 prinzdezibel

Thanks for the PR!

  • Data descriptor is not needed in long mode

You're right that it is not needed in this case, but you still need them for system calls. I'm fine with removing it here.

  • 41th bit of code descriptor is unused in long mode

The AMD manual states that this bit is ignored, but I can't find anything like this in the Intel manual. There are some slight differences between the two sometimes, so I think it's better to keep the readable bit if there is any doubt.

phil-opp avatar Apr 10 '22 11:04 phil-opp

@phil-opp , regarding the WRITABLE descriptor flag (41th bit) I am refering to

https://github.com/rust-osdev/x86_64/blob/8922d8d0b8532324237c2384bdddc91c335bc54f/src/structures/gdt.rs#L208

which states it's not needed in long mode.. Also I've read it in your blog_os tutorial, IIRC.

https://os.phil-opp.com/entering-longmode/#loading-the-gdt

   dq (1<<43) | (1<<44) | (1<<47) | (1<<53) ; code segment

Thank you for your great OS development & Rust tutorial. This is an invaluable source of extremly useful information.

prinzdezibel avatar Apr 10 '22 14:04 prinzdezibel

Looks like this PR fell off my raday, sorry! With https://github.com/rust-osdev/bootloader/pull/232 merged, the stage_3.s assembly file no longer exists, so i think we can close this PR.

phil-opp avatar Jan 02 '23 11:01 phil-opp