When I'm trying to write a byte to 0x101A4E in 32bit protected mode (paging disabled) QEMU prints out an emulation failure and my kernel starts to behave strangely.
QEMU emulation failure:
My memory map (retrieved from GRUB):rax 0000000000104020 rbx 000000000010cca8 rcx 0000000000101b46 rdx 0000000064001025
rsi 000000000002be9b rdi 000000000002be9c rsp 000000000010cbdc rbp 000000000010cc08
r8 0000000000000000 r9 000000000000ffff r10 0000000000000000 r11 000000000000ffff
r12 0000000060000010 r13 0000000000000000 r14 00007ff6d2267e98 r15 00007ff6d28aa970
rip 0000000064001025 rflags 00010016
cs 0008 (00000000/ffffffff p 1 dpl 0 db 1 s 1 type b l 0 g 1 avl 0)
ds 0010 (00000000/ffffffff p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
es 0010 (00000000/ffffffff p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
ss 0010 (00000000/ffffffff p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
fs 0010 (00000000/ffffffff p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
gs 0010 (00000000/ffffffff p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
tr 0000 (00000000/0000ffff p 1 dpl 0 db 0 s 0 type b l 0 g 0 avl 0)
ldt 0000 (00000000/0000ffff p 1 dpl 0 db 0 s 0 type 2 l 0 g 0 avl 0)
gdt 104c64/27
idt 104044/5ff
cr0 11 cr2 0 cr3 0 cr4 0 cr8 0 efer 0
emulation failure, check dmesg for details
From this map 0x101A4E should be accessible or is there an "untracked" memory hole at this position for some reason? If yes, how could I detect this?Start Length End
0x00000000 0x0009F400 0x0009F400 Available
0x0009F400 0x00000C00 0x000A0000 Unavailable
0x000F0000 0x00010000 0x00100000 Unavailable
0x00100000 0x01EFD000 0x01FFD000 Available
0x01FFD000 0x00003000 0x02000000 Unavailable
0xFFFBC000 0x00044000 0x00000000 Unavailable
Edit: For some reason, the error does not occur if i access this byte directly, but only when I'm looping from the position of a pointer to this location this way:
Code: Select all
((char *) kernelDirectory)[i] = 0;
Edit 3: And for some reason this error only occurs when I'm printing out the individual writes. When I don't, the os just freezes without any error message from qemu...
Rgds, Farok