I wanted to do some tests and I did this code:
Added new entery to GDT like:
Code: Select all
segment_over_1mb: ; selector 0x48
dw 0xffff
dw 0x0
db 0x0
db 10010010b
db 11001111b
db 0x0
And i have tested such code (in protected mode activated if matters):
Code: Select all
mov ax, 0x48
mov es, ax
mov word [es:0], 0x66 ; accessing 0x0 address
mov bx, word [es:0] ; will set BX= 0x66
mov word [es:0x1400000], 0xDAF ; accessing 20mb
mov bx, word [es:0x1400000] ; will set BX= 0xDAF
mov word [es:0xC2100000], 0x78ad ; accessing above 3GB
mov bx, word [es:0xC2100000] ; will set BX= 0xFFFF
mov word [es:0xffc00000], 0x1b6 ; accessing above 3GB
mov bx, word [es:0xffc00000] ; will set BX= 0xFFFF
Tested with Bochs and VirtualBox and no exception was thrown while accessing this memory.
Dunno what to think about this. First of all I though it makes memory rolling over and over 1 MB of memory, but it doesn't seem so. When I want to see memory map for 0xC2100000 in Bochs it returns message "address range was not legal memory". For 0x1400000 it's fine. Huh ? Why ?
After that I have enabled Line A20 as here http://wiki.osdev.org/A20_Line using code for keyboard controller and results were the same!
Why was it accessible without enabling line a20, at least why was 0x1400000 accessible properly ?