VOGONS


First post, by superfury

User metadata
Rank l33t
Rank
l33t

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)?

UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io
Older UniPCemu PC/Android/PSP releases

Reply 1 of 3, by retardware

User metadata
Rank Oldbie
Rank
Oldbie

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.

Reply 3 of 3, by superfury

User metadata
Rank l33t
Rank
l33t

@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.

UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io
Older UniPCemu PC/Android/PSP releases