Re: Paging problems
Posted: Sat Jun 17, 2017 2:38 am
As to your first point, I'll do an "info reg" at _start to try to work out what's happening. On the point that you mentioned in your edit, I can't believe that I didn't notice that.
Code: Select all
GDT64: ; Global Descriptor Table (64-bit).
.Null: equ $ - GDT64 ; The null descriptor.
dw 0 ; Limit (low).
dw 0 ; Base (low).
db 0 ; Base (middle)
db 0 ; Access.
db 0 ; Granularity.
db 0 ; Base (high).
.Code: equ $ - GDT64 ; The code descriptor.
dw 0 ; Limit (low).
dw 0 ; Base (low).
db 0 ; Base (middle)
db 10011010b ; Access (exec/read).
db 00100000b ; Granularity.
db 0 ; Base (high).
.Data: equ $ - GDT64 ; The data descriptor.
dw 0 ; Limit (low).
dw 0 ; Base (low).
db 0 ; Base (middle)
db 10010010b ; Access (read/write).
db 00000000b ; Granularity.
db 0 ; Base (high).
.Pointer: ; The GDT-pointer.
dw $ - GDT64 - 1 ; Limit.
dq GDT64 ; Base.
Code: Select all
GDT64:
.Null = . - GDT64
.short 0
.short 0
.byte 0
.byte 0
.byte 0
.byte 0
.Code = . - GDT64
.short 0
.short 0
.byte 0
.byte 0x9A
.byte 0x20
.byte 0
.Data = . - GDT64
.short 0
.short 0
.byte 0
.byte 0x92
.byte 0
.byte 0
.Pointer:
.short = . - GDT64 - 1
.quad GDT64