Hello.
Repository:
https://github.com/toku-sa-n/ramen/tree/boot_with_uefiMy OS boots with UEFI. It runs under 64-bit mode. After exiting UEFI boot services, it changes paging settings and CR3 value. On my laptop, assigning a value to a valid virtual memory address succeeds. However, this action fails on my desktop PC.
Code:
MOV RAX, 0xFFFFFFFF80200000
MOV QWORD[VRAM_PTR], RAX ; <--- crash on only my desktop PC.
MOV from memory to a register causes no problems on both my laptop and desktop PC.
Code:
MOV RAX, QWORD[VRAM_PTR] ; <--- not crash.
Also, I found that changing the CR3 value wasn't the cause of the crash. Inserting JMP $ immediately after MOV CR3, RAX told me that.
Code:
MOV RAX, PML4
MOV CR3, RAX ; <--- not crash.
These codes are written in asm/paging_64.asm. (
https://github.com/toku-sa-n/ramen/blob/boot_with_uefi/asm/paging_64.asm#L108)
Why does my OS crash on desktop PC?
Just in case: desktop PC
Code:
%uname -a
Linux gentoo_desktop 5.5.11-gentoo #1 SMP Tue Mar 24 23:45:50 JST 2020 x86_64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz GenuineIntel GNU/Linux
laptop
Code:
%uname -a
Linux laptop 5.4.12-gentoo #1 SMP Tue Jan 21 14:56:38 JST 2020 x86_64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz GenuineIntel GNU/Linux