Topic created on: March 16, 2007 02:05 CDT by
apridgen 
.
Is there a quick mental trick or an easy way to convert segmented addressing into virtual addressing quickly?
DS = 0023
For Example: DS:[0116005C] => ?
I read the Intel manuals and it kinda just goes over my head, and I figured there was some neat and clean way to do this my head quickly since it's all binary anyway.
Thanks in advance for any help.
there are no more _segments_ in win32, I mean _true_ ones. you have to deal with _selectors_ (they are not the same!), you can't assign selector in user mode. cs:, ds: and ds: selectors are mapped onto the same memory region, so, cs:[xxx] _always_ equal_ ds:[xxx] or ss:[xxx]. the only exception is the fs:, it also mapped onto 4 Gb address space, but it's base address and limit are quite different, however, you may get access to fs:[foo] via ds:[bar], to determine base address on fs you must read GDT table.
"linear = segment<<4 + offset" doesn't work in 32-protect mode.
selectors are not segments, they are like handlers.
0023:[0116005C] is 0023:[0116005C], try to use 0027:[0116001C] and see what happens :)
(23+4):[ 0116005C - 4*0x10]. however, in kernel mode you can create new selector with the same base address and limit as 23, but having #69 number, after that, 0023:[0116005C] and 0069: [0116005C] will point to the same address.
so, to know virtual address, you have to read GDT, take base address of selector and add the offset value. for example, selector #23 have zero base address, so virtual address simple equal offset value (0116005C in your case).
|