flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Tyler 09 Jan 2010, 05:29
I've read http://www.osdever.net/bkerndev/Docs/gdt.htm and all that OSDev.org has to offer on GDTs, and I still have no idea what I'm doing. Can someone give me an example of what "GDTR" would be in
Code: CLI LGDT [GDTR] MOV EAX, CR0 OR AL, 1 MOV CR0, EAX , an example I found at http://wiki.osdev.org/Protected_mode? I'm not necessarily even asking for an example with actual values(would be easier to understand though) just something with a description of what needs to go where. |
|||
![]() |
|
DOS386 09 Jan 2010, 06:36
Tyler wrote: I've read http://www.osdever.net/bkerndev/Docs/gdt.htm and all that OSDev.org has to offer on GDTs, and I still have no idea what I'm doing. ![]() Code: CLI LGDT [GDTR] ; 6 Byte's MOV EAX, CR0 OR AL, 1 ; INC EAX Quote: Can someone give me an example of what "GDTR" would be in * 2 Byte's limit (at least 24) * 4 Byte's base linear address (=physical if paging is off) where the GDT sits |
|||
![]() |
|
DOS386 09 Jan 2010, 08:42
Tyler wrote: Sorry, I meant the GDT itself. 0. Invalid selector (8 ZERO's) 1. Code selector (base=0 limit=4GiB Ring=0 type=code 32bit=YES DOWN=NO ...) 2. Data selector (base=0 limit=4GiB Ring=0 type=data 32bit=YES DOWN=NO ...) |
|||
![]() |
|
egos 09 Jan 2010, 09:55
Quote: * 2 Byte's limit (at least 24) ![]() Quote: 1. Code selector (base=0 limit=4GiB Ring=0 type=code 32bit=YES DOWN=NO ...) ![]() |
|||
![]() |
|
edfed 09 Jan 2010, 13:51
Code: align 4 align 2 ; for GDTR alignment gdtr df @f-gdt-1:gdt ; GDTR in memory gdt: ; GDT entry dq 0 ; (0) NULL selector linear_sel_1: ; (8h) linear Data segment, read/write, expand down dw 0FFFFh,0 db 0,10010010b,11001111b,0 sys_code_1: ; (10h) Code segment, read/execute, nonconforming dw 0FFFFh,0 db 0,10011010b,11001111b,0 sys_data_1: ; (18h) Data segment, read/write, expand down dw 0FFFFh,0 db 0,10010010b,11001111b,0 Real_code_1: ; (20h) Real mode code segment dw 0FFFFh,0 db 0,10011010b,0,0 Real_data_1: ; (28h) Real mode data segment dw 0FFFFh,0 db 0,10010010b,0,0 sys_vesa_1: ; (30h) vesa segment, read/write, expand down dw 0FFFFh,0 db 0,10010010b,11001111b,0 @@: ; Used to calculate the size of the GDT sys_vbuff_1: ; (30h) vesa segment, read/write, expand down dw 0FFFFh,0 db 0,10010010b,11001111b,0 @@: ; Used to calculate the size of the GDT |
|||
![]() |
|
egos 09 Jan 2010, 15:55
Code: align 4align 2 Code: align 4rb 2 Code: rb 3 - ($+1) mod 4 Code: gdtr df @f-gdt-1:gdt Last edited by egos on 09 Jan 2010, 16:13; edited 2 times in total |
|||
![]() |
|
dosin 09 Jan 2010, 15:55
This is a post for someone new to pm - it has a sample in it and
link to websites... also he had some questions answered that may help.. The example is min to get into pm.. http://dex.7.forumer.com/viewtopic.php?t=533 |
|||
![]() |
|
edfed 09 Jan 2010, 16:03
sorry, align 4 is enough.
i wrote this last year. itr is an error. i made this because iwas thinking that df is like dw segment, dd offset. in fact, align 4 is enough because offset is aligned on dword boundary. df = dd offset dw segment new Code: align 4 gdtr df @f-gdt-1:gdt |
|||
![]() |
|
egos 09 Jan 2010, 16:38
Code: rb 3 - ($+1) mod 4gdtr:dw @f-gdt-1dd gdt |
|||
![]() |
|
Tyler 09 Jan 2010, 19:20
Code: gdt: dq 0 ; Null ; (Access) (Limit 16-19) ; (Limit 0-15) (Base 0-23 ) ( Byte ) ( & Flags )(Base 24-31) db 0xFF, 0xFF, 0x00, 0x00, 0x00, 1001010b, 01001111b, 0x00 ;Code db 0xFF, 0xFF, 0x00, 0x00, 0x00, 1000010b, 01001111b, 0x00 ;Data Is it in the right order or do I need to change something? And gdtr would be Code:
db 23
dw gdt
right? Last edited by Tyler on 09 Jan 2010, 21:02; edited 1 time in total |
|||
![]() |
|
egos 09 Jan 2010, 20:18
No! Open your eyes and try again
![]() |
|||
![]() |
|
egos 09 Jan 2010, 21:55
No again
![]() Tyler wrote: Is it in the right order or do I need to change something? Code: gdt: ... dw 0FFFFh ; Limit 15-0 dw 0 ; Base 15-0 db 0 ; Base 23-16 db 10011010b ; P=1, DPL=00b, 11b - code seg, C=0, R=1, A=0 db 11001111b ; 1 - paged gran, 1 - 32-bit code, 00b - rsv and avl, 1111b - limit 19-16 db 0 ; Base 31-24 dw 0FFFFh ; Limit 15-0 dw 0 ; Base 15-0 db 0 ; Base 23-16 db 10010010b ; P=1, DPL=00b, 10b - data seg, E=0, W=1, A=0 db 11001111b ; 1 - paged gran, 1 - 32-bit data, 00b - rsv and avl, 1111b - limit 19-16 db 0 ; Base 31-24 ... gdt_size=$-gdt Tyler wrote: And gdtr would be Code: gdtr: dw gdt_size-1 dd gdt |
|||
![]() |
|
Tyler 09 Jan 2010, 23:11
Quote:
Your last post, thanks. |
|||
![]() |
|
Tyler 10 Jan 2010, 01:54
With limit = 0xffffff do programs that use segmentation(".com"s) still work? For example, with limit = ffffff how would I load a .com at (any segment):0100h
|
|||
![]() |
|
edfed 10 Jan 2010, 02:09
set base to anywhere you want.
set granularity to 4kB set limit to 1MB. and then, .com will be located at 100h in the segment, but will access all the 1mega memory. IVT will not exist, because it is .com for Pmode. all memory between 0and 100h inside the code segment can be used a a system code that will handle the program. you will need 3 segments for graphics, 0a000h, 0B800h, and vesalinear, returned by vesainfo ( int 10 ax=4f00h). |
|||
![]() |
|
egos 10 Jan 2010, 07:36
Quote:
![]() |
|||
![]() |
|
egos 10 Jan 2010, 09:02
Tyler wrote: With limit = 0xffffff do programs that use segmentation(".com"s) still work? |
|||
![]() |
|
DOS386 12 Jan 2010, 08:55
Tyler wrote: With limit = 0xffffff do programs that use segmentation(".com"s) still work? NO. High limit is irrelevant. DOS COM's won't work because: 1. Protected mode (writing values into seg registers in the "real mode style" will securely GPF ![]() 2. DOS services (INT $21) and other real mode INT's not available (you "could" fix this problem) |
|||
![]() |
|
egos 12 Jan 2010, 11:18
Who did say about DOS?
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.