flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > GDT question |
Author |
|
egos 25 Jun 2011, 09:45
Be careful. In fasm the equ directive generates symbolic constants! You can use = or label instead of it. For example, look at my code:
Code: macro set name,value { label name at value } ... GDT: dq 0 ... set KCODE,$-GDT desc 0,0FFFFFh,DF_CODE32 ... set GDT_SIZE,$-GDT What is the reason to have "real code" and "real data"? In modern systems (on monolithic kernels) higher half kernel with FLAT memory model and page level protection is used. So only virtual (linear) addresses are used that coincide with offsets in all code/data segments. Additionally kernel could be protected by limitation of user code/data segment size. For example, look at my code: Code: set KSTART_TINDEX,512 ; 768 set KSTART_PINDEX,KSTART_TINDEX shl 10 ... set ACODE,$-GDT+SF_ARPL desc 0,KSTART_PINDEX-1,DF_CODE32+DF_APL If you place 16-bit (RM) initialization code within first 64 kb of memory space you can use only linear addresses. |
|||
25 Jun 2011, 09:45 |
|
christiandy 25 Jun 2011, 12:01
i think real code an real data is use when i need to use BIOS interrupt. Anw it's okay to set user and system descriptor in the same base address?
|
|||
25 Jun 2011, 12:01 |
|
egos 25 Jun 2011, 13:55
Yes.
|
|||
25 Jun 2011, 13:55 |
|
christiandy 25 Jun 2011, 17:33
will the user and system descriptor will overlaping memory each other?
|
|||
25 Jun 2011, 17:33 |
|
egos 25 Jun 2011, 18:33
Usually yes but not necessarily. Look at my code attentively. Kernel descriptor (assigned with KCODE selector) describes both user space and kernel space. But user descriptor (assigned with ACODE selector) describes only user space.
|
|||
25 Jun 2011, 18:33 |
|
christiandy 25 Jun 2011, 18:51
what if, my system data's base address is 50H. if i access sys data:9ffb0H which is if I calculate that it refer to A0000H (CMIIW). does it will access a video memory which is locate on A0000H? If that so is it better for me to set a base address on memory > 1MB? sorry I slow in learning
|
|||
25 Jun 2011, 18:51 |
|
egos 26 Jun 2011, 09:41
Yes but it's old stuff. As I said above modern practice is to use FLAT segments and paging. For example, I have videobuffer physically located at 0xA0000 somewhere within kernel space started at 0x80000000 (0xC0000000). Base address of all code/data segments should be 0.
|
|||
26 Jun 2011, 09:41 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.