Hacker News new | past | comments | ask | show | jobs | submit login

I would put my bet on LDTR and TR. They are read and written with different instructions but they are 16 bit and closely related to segment registers (they index into the GDT).



That seems the most likely to me as well, since they also have a 16 bit selector field that has to be stored.

The 286 already had 8 "segment registers" internally: ES, CS, SS, DS, GDT, LDT, IDT & TSS. Only the first four are directly accessible by the program, but to the microcode they should all be more or less identical.

Besides the layout of the saved CPU state in memory, another clue to this is that for exceptions involving both "normal" and "system" segment registers, an error code gets stored in one of the internal registers, indicating which segment caused it. The only way to read it out in software is by executing the undocumented STOREALL instruction (F1 0F 04) immediately after the reset from a triple-fault shutdown.

The codes that appear in this register are:

     6CFFh GDT
     6DFFh LDT
     6EFFh IDT
     6FFFh TSS
     70FFh ES
     73FFh DS
CS and SS should be 71h / 72h, however exceptions involving these segments seem to take a different microcode path that overwrites that register with the access rights for CS.

I have written about this here: https://rep-lodsb.mataroa.blog/blog/the-286s-internal-regist...

And this article shows the bus cycles done by LOADALL on the 386, note that it also loads 10 internal registers:

http://www.rcollins.org/articles/loadall/tspec_a3_doc.html


Right, the 386 has 10 internal segment descriptor caches but only 8 segment selector registers. The 286 had 8 and 6 respectively.

But wait, HIMEM.SYS used LOADALL to avoid going into protected mode and back?!? When you thought you knew everything (which I absolutely don't, but I knew it used big real mode on the 386 and I totally didn't expect LOADALL).

> More useful is the ability to load any arbitrary base address for the segment registers without entering protected mode. Some versions of Microsoft's HIMEM.SYS did this to copy data between real and extended memory.

It is also explained at https://www.os2museum.com/wp/himem-sys-unreal-mode-and-loada...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: