GDT Type
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
GDT Type
Can you tell me what GDT type should I use? I only want to have 1 segment to access the whole memory.
Data:
------
* Read-Only
* Read-Only, accessed
* Read/Write
* Read/Write, accessed
* Read-Only, expand-down
* Read-Only, expand-down, accessed
* Read/Write, expand-down
* Read/Write, expand-down, accessed
Code:
-------
* Execute-Only
* Execute-Only, accessed
* Execute/Read
* Execute/Read, accessed
* Execute-Only, conforming
* Execute-Only, conforming, accessed
* Execute/Read-Only, conforming
* Execute/Read-Only, conforming, accessed
Thanks
Data:
------
* Read-Only
* Read-Only, accessed
* Read/Write
* Read/Write, accessed
* Read-Only, expand-down
* Read-Only, expand-down, accessed
* Read/Write, expand-down
* Read/Write, expand-down, accessed
Code:
-------
* Execute-Only
* Execute-Only, accessed
* Execute/Read
* Execute/Read, accessed
* Execute-Only, conforming
* Execute-Only, conforming, accessed
* Execute/Read-Only, conforming
* Execute/Read-Only, conforming, accessed
Thanks
MatÃas Beretta
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Do you want to be able to write to memory?
Do you want to have the segment go from 0 to 4G or from 4G to 0
Do you want to have the segment tagged as used or unused
Do you want to read from CS-relative addresses
Are you aware of the difference between conforming and non-conforming segments?
Did you know that all the information you need to answer these questions for yourself is in the intel manuals?
Do you want to have the segment go from 0 to 4G or from 4G to 0
Do you want to have the segment tagged as used or unused
Do you want to read from CS-relative addresses
Are you aware of the difference between conforming and non-conforming segments?
Did you know that all the information you need to answer these questions for yourself is in the intel manuals?
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
Reply
Do you want to be able to write to memory?
Yes
Do you want to have the segment go from 0 to 4G or from 4G to 0
What's the difference?
Do you want to have the segment tagged as used or unused
What is used or unused?
Do you want to read from CS-relative addresses
Yes
Are you aware of the difference between conforming and non-conforming segments?
As far as i know and understand, comforming is when you jump to another segment with another protection level and you still use the protection of the other segment.
Did you know that all the information you need to answer these questions for yourself is in the intel manuals?
Yes, I have those manuals. Things related to GDT (page 73...)
Sorry if you cant understand my definition of comforming and non-comforming, i am from argentina and i'm still studing english.
Yes
Do you want to have the segment go from 0 to 4G or from 4G to 0
What's the difference?
Do you want to have the segment tagged as used or unused
What is used or unused?
Do you want to read from CS-relative addresses
Yes
Are you aware of the difference between conforming and non-conforming segments?
As far as i know and understand, comforming is when you jump to another segment with another protection level and you still use the protection of the other segment.
Did you know that all the information you need to answer these questions for yourself is in the intel manuals?
Yes, I have those manuals. Things related to GDT (page 73...)
Sorry if you cant understand my definition of comforming and non-comforming, i am from argentina and i'm still studing english.
MatÃas Beretta
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Reply
It seems to me that you know everything needed to make an educated choice about what GDT type you want to use.matias_beretta wrote:Do you want to be able to write to memory?
Yes
Do you want to have the segment go from 0 to 4G or from 4G to 0
What's the difference?
Do you want to have the segment tagged as used or unused
What is used or unused?
Do you want to read from CS-relative addresses
Yes
Are you aware of the difference between conforming and non-conforming segments?
As far as i know and understand, comforming is when you jump to another segment with another protection level and you still use the protection of the other segment.
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Here's my GDT ("tutorial standard"):
Code: Select all
align 8
; null descriptor
gdt: dw 0
dw 0
db 0
db 0
db 0
db 0
; kernel code
KERNEL_CODE_SEL = $-gdt ; Segment selector
gdt2: dw 0xFFFF ; limit 0xFFFFF
dw 0 ;
db 0 ;
db 0x9A ; present, ring 0, code, readable
db 0xCF ; page-granular, 32-bit
db 0 ;
; kernel data
KERNEL_DATA_SEL = $-gdt ; Segment selector
gdt3: dw 0xFFFF ; limit 0xFFFFF
dw 0 ; base 0
db 0
db 0x92 ; present, ring 0, data, writable
db 0xCF ; page-granular, 32-bit
db 0
; user code
USER_CODE_SEL = $-gdt+3 ; Segment selector
gdt4: dw 0xFFFF
dw 0
db 0
db 0xFA ; present, ring 3, code, readable
db 0xCF
db 0
; user data
USER_DATA_SEL = $-gdt+3
gdt5: dw 0xFFFF
dw 0
db 0
db 0xF2 ; present, ring 3, data, writable
db 0xCF
db 0
gdt_end:
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
Reply
Thanks Craze Frog, but i shouldn't the user code and data segments go into the LDT?
MatÃas Beretta
- Dandee Yuyo
- Member
- Posts: 47
- Joined: Fri Nov 09, 2007 6:46 pm
- Location: Argentina
Eh Matias! Saludos desde Argentina!
You don't need an LDT, even with multiple TSSs. I do task-switching via TSSs and a task gate, and I only use the GDT. Moreover I wouldn't recommend to "abuse" of segmentation since it is not supported in 64-bit long mode (in case you want to make your OS 64 bits in the future).
You don't need an LDT, even with multiple TSSs. I do task-switching via TSSs and a task gate, and I only use the GDT. Moreover I wouldn't recommend to "abuse" of segmentation since it is not supported in 64-bit long mode (in case you want to make your OS 64 bits in the future).
NaN - Not a Nerd
Working on: Physical Memory Management with a 5-lod mipmap XD
Working on: Physical Memory Management with a 5-lod mipmap XD