Date: Thu, 27 Apr 1995 09:47:00 +0500 From: ld AT netrix DOT com To: s709 AT icslab DOT agh DOT edu DOT pl Subject: Re: more on extended memory Cc: djgpp AT sun DOT soe DOT clarkson DOT edu > From djgpp-bounces AT sun DOT soe DOT clarkson DOT edu Thu Apr 27 09:29 EDT 1995 > Address: Mickiewicza 30, 30-059 Krakow, POLAND > Date: Thu, 27 Apr 95 13:05:44 +0200 > From: s709 AT icslab DOT agh DOT edu DOT pl (chojnacki) > To: djgpp AT sun DOT soe DOT clarkson DOT edu > Subject: more on extended memory > [snip] > and I got: i = 0x38 > > I think this is an index in the descriptor table which includes ^^^^^ Yes, it's an index, but later, you use it as a pointer... > among other things base addresses of the segments and their length. > > Next I wanted to view contents of item in the descriptor table and ran this: > > #include > #include > main() > { > u_short i = _go32_conventional_mem_selector(); > printf("value = %x\n", *((int *)(int)i )); ^^^^^ ^^^^ This makes a pointer to 0x38 This is the 0x38th index into a table (which is NOT at 0x00000000) > } > > and I got: > Segmentation violation in pointer 0x00000038 at d8:11ca ... This is an invalid address (0x38) > I think this area of memory is protected but is there any > way to access the descriptor table to see what is real segment's > base address and its length ? Look at the module perform.c in Ladybug. It has code to decipher an interrupt entry. The code to lookup a segment will be pretty much the same, with some minor changes to the structure. (Intel manual is recommended.) > I understand that to access first 16M memory in DPMI mode (and also > in non-DPMI) I can use _go32_conventional_mem_selector() > which gives me a selector which is used as pointer to an item ^^^^^^^^^^^^^^^ It's used as an index to a table. The base address of this table can be found by the instruction: SGDT (If your program is using the global descriptor table, like under VCPI) SLDT (If your program is using a local descriptor table, like under DPMI) To see if your program is using GDT or LDT, check the CR0 register. > in the desriptor table from which I get base address of my segment. > But for example if I have 32M memory - can't I access second half of 16M > in DPMI without hand coding (only 16M of memory gets mapped to > _go32_conventional_mem_selector() ?). Hope that helps, Long.