@GD 2W10
Oh, crazy. I only want to help.
Just now I look, if the CR0.PG/PE bits are blocked in my Bios from the Gigabyte B860 DS3H board or if I can change them.
With Hexeditor the change can be forced always.
This seems to me the main problem.
What can I say: Science LIVES from listing to each other
Dietmar
PS: How you run the test:
Compile the UEFI app as an .efi file.
Copy it to a FAT32 USB stick.
Boot your motherboard into the UEFI Shell (most Gigabyte boards support this).
Run your app from the shell: it prints CR0 values before and after toggling.
If you get errors, faults, or CR0 stays unchanged → bits are blocked.
Such a routine is needed
; CR0 Bits (nur relevante)
; Bit 0 PE Protected Mode Enable
; Bit 31 PG Paging
; Bit 16 WP Write Protect
; Beispiel: Real Mode -> PE=0, PG=0
; Beispiel: Protected Mode ohne Paging -> PE=1, PG=0
; --- Real Mode (BIOS Modus) ---
clear_cr0_real_mode:
mov eax, cr0 ; CR0 auslesen
and eax, 0x7FFFFFFE ; Bit 0 (PE) und Bit 31 (PG) auf 0 setzen
; WP (Bit16) bleibt 0
mov cr0, eax ; CR0 zurückschreiben
ret
; --- Protected Mode ohne Paging ---
set_cr0_protected_mode_no_paging:
mov eax, cr0
or eax, 1 ; PE = 1 (Protected Mode aktiv)
and eax, 0xBFFFFFFF ; PG = 0 (Paging aus)
mov cr0, eax
ret