logoalt Hacker News

80386 Memory Pipeline

47 pointsby wicketlast Tuesday at 4:00 PM10 commentsview on HN

Comments

rep_lodsbtoday at 6:26 PM

Again a very interesting look at how this chip works internally!

I've decoded the entry point PLA of the 80286 (not the actual microcode though). It also has separate entries for real and protected mode, but only for segment loads from a general purpose register, HLT, and for those opcodes that aren't allowed in real mode like ARPL.

Loading a segment register from memory on the 286 uses the same microcode in both modes, as does everything else that would certainly have to act differently, like jump/call far. That was a bit surprising, since it would have to decide at run time which mode it's in. Is this the same on the 386?

Tested on my 286 machine what happens when opcodes are decoded while in real mode but executed after PE is set: Segment load from memory works (using protected mode semantics), whereas the load from register only changes the visible selector and nothing else. The base in the descriptor cache keeps whatever was set there before -- I assume on the 386, SBRM would update the base the same way it does in real mode in that situation, because it's also used for V86 mode there. Illegal-in-real-mode instructions trap, but do so correctly using the protected mode IDT.

Also seems like executing three pre-decoded instructions without a jump after setting PE causes a triple fault for some reason.

mrlonglongtoday at 4:20 PM

Voodoo mode is the ultimate test. Imagine having access to 4GB of memory from real mode.

show 2 replies
andyjohnson0today at 3:58 PM

Interesting article. I learned some things.

How hard would it be for Mr Github to add rss/atom feeds, I wonder?

blueybingotoday at 5:04 PM

wasn't this basically the consensus among numerical analysts like 20 years ago? i remeber reading similar arguments in goldberg's paper and various game dev forums circa 2005, so genuinely curious what keeps making this idea feel "new" to each generation of programmers who rediscovers it

show 1 reply