Are expand-down segments without valid offsets used?

Emulation of old PCs, PC hardware, or PC peripherals.

Are expand-down segments without valid offsets used?

Postby superfury » 2019-4-12 @ 08:28

I know that a maximum-size(FFFFh to FFFFFh in the limit fields) for a expand-down segment has no valid offsets, but can still be loaded into a segment selector if present.

Is that behaviour used with any operating systems or extenders to trap accesses to certain segment data selectors(but allowing loads into segment registers)?
superfury
l33t
 
Posts: 3228
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Are expand-down segments without valid offsets used?

Postby retardware » 2019-4-12 @ 11:23

What do you consider as "valid offsets"?
The normal behavior up to PC/AT is to wrap around. i.e. FFFF:0010 actually accesses 0:0.
On PC/AT and above you have the A20 gate to determine whether FFFF:0010 refers to either 0:0 or 10000:0.

I think 386 DOS extenders throw a fault in case of accessing bad pages, but I doubt that they do this for HMA accesses, as that one is usually governed by DOS.
retardware
Oldbie
 
Posts: 642
Joined: 2019-1-30 @ 02:00

Re: Are expand-down segments without valid offsets used?

Postby crazyc » 2019-4-12 @ 14:06

I've only seen expand down segments used by os/2 1.x. It's possible that the max limit might be used to lazily allocate the stack but I'm not sure if anything does.
crazyc
Member
 
Posts: 143
Joined: 2013-2-02 @ 16:17

Re: Are expand-down segments without valid offsets used?

Postby superfury » 2019-4-12 @ 15:11

@retardware: I mean a 16-bit segment top-down segment descriptor loaded with a limit of FFFF to FFFFFh. That descriptor will load into the descriptor cache without any problem(e.g. MOV DS,AX), but when software tries to access ANY address(doesn't matter which one), it results in a #GP(0) fault because only accesses larger than FFFFh(or larger when set between 10000 and FFFFF) are valid and offsets larger than FFFFh are invalid due to it being a 16-bit segment descriptor(B-bit is cleared).

It might theoretically be used for stuff like trapping ANY access to any software kind of memory allocation, with the software in the kernel handling the real access of said segment(think in terms of, say, emulated video card memory?) for protected-mode software using a specific segment selector and descriptor instead of through Paging(a segmentation-based method of doing that, instead of Paging-based method).

Edit: @crazyc Thinking about it, doesn't windows use it to implement lazy stack allocation and remapping(or maybe one older version of Windows)? I remember having read that somewhere.
superfury
l33t
 
Posts: 3228
Joined: 2014-3-08 @ 11:25
Location: Netherlands


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 1 guest