VOGONS


First post, by superfury

User metadata
Rank l33t
Rank
l33t

What is the resulting value of the register when using e.g. EAX with SMSW, SLDT and STR on a 80386/80486?

It seems "SMSW EAX" is used with some MS-DOS extenders, but that might not be working on a 80386?

What about STR and SLDT?

https://github.com/corkami/docs/blob/master/x86/x86.md
http://board.flatassembler.net/topic.php?t=6917

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

Reply 2 of 5, by superfury

User metadata
Rank l33t
Rank
l33t

Hmmmm.... Bochs seems to agree on SMSW. But it does support 32-bit registers on STR and SLDT?

if (i->modC0()) {
303 if (i->os32L()) {
304 BX_WRITE_32BIT_REGZ(i->dst(), val16);
305 }
306 else {
307 BX_WRITE_16BIT_REG(i->dst(), val16);
308 }
309 }
310 else {
311 bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
312 /* pointer, segment address pair */
313 write_virtual_word(i->seg(), eaddr, val16);
314 }

Is that invalid on a 80[3/4]86?

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

Reply 3 of 5, by superfury

User metadata
Rank l33t
Rank
l33t

IBMulator seems to verify said behaviour of SMSW, STR and SLDT as well?

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

Reply 4 of 5, by crazyc

User metadata
Rank Member
Rank
Member

It's cpu dependent. From the IA32 manual "Outside IA-32e mode, when the destination operand is a 32-bit register, the 16-bit segment selector is copied into the low-order 16 bits of the register. The high-order 16 bits of the register are cleared for the Pentium 4, Intel Xeon, and P6 family processors. They are undefined for Pentium, Intel486, and Intel386 processors. When the destination operand is a memory location, the segment selector is written to memory as a 16-bit quantity, regardless of the operand size." What "undefined" means you'd have to test on a real machine.