You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fff81: ba fe 00 mov $0xfe,%dx
fff84: 88 d4 mov %dl,%ah
fff86: 88 d0 mov %dl,%al
fff88: e6 c2 out %al,$0xc2
fff8a: fe c0 inc %al
fff8c: e6 c3 out %al,$0xc3
fff8e: ba 00 08 mov $0x800,%dx
fff91: 31 db xor %bx,%bx
fff93: b9 00 20 mov $0x2000,%cx
fff96: 89 de mov %bx,%si
fff98: d1 e6 shl %si
fff9a: 8e d9 mov %cx,%ds
fff9c: 8a 07 mov (%bx),%al
fff9e: 30 e4 xor %ah,%ah
fffa0: 00 c4 add %al,%ah
fffa2: 36 89 84 00 20 mov %ax,%ss:0x2000(%si)
fffa7: 43 inc %bx
fffa8: 4a dec %dx
fffa9: 75 eb jne fff96 <main+0x16>
The "quirk" is somewhere in the fff81-fff8c area - the usage of %dx. It makes sense, given that I'm using a linker-side pointer to pass a constant, that it uses a word; however, I don't see why it's not loading straight into %ax, and I especially don't see why it's also loading %ah, which is never used. This is consistent across -O2, -O3, and -Os.
EDIT: In an even more bizarre twist, if I add a while (1) {} loop to the end of that code, the generation changes as follows:
fff81: ba fe 00 mov $0xfe,%dx
fff84: 88 d4 mov %dl,%ah
fff86: 88 d0 mov %dl,%al
fff88: e6 c2 out %al,$0xc2
fff8a: fe c0 inc %al
fff8c: e6 c3 out %al,$0xc3
fff8e: b9 00 08 mov $0x800,%cx
fff91: 31 db xor %bx,%bx
fff93: ba 00 20 mov $0x2000,%dx
fff96: 89 de mov %bx,%si
fff98: d1 e6 shl %si
fff9a: 8e da mov %dx,%ds
fff9c: 8a 07 mov (%bx),%al
fff9e: b4 00 mov $0x0,%ah
fffa0: 89 84 00 20 mov %ax,0x2000(%si)
fffa4: 43 inc %bx
fffa5: 49 dec %cx
fffa6: 75 ee jne fff96 <main+0x16>
fffa8: eb fe jmp fffa8 <main+0x28>
See anything different? The ss: modifier is now gone, causing broken code.
Thank you!
The text was updated successfully, but these errors were encountered:
I haven't yet wrapped this into a form reproducible with vanilla gcc-ia16, but here's some notes:
This is translated into:
The "quirk" is somewhere in the
fff81
-fff8c
area - the usage of%dx
. It makes sense, given that I'm using a linker-side pointer to pass a constant, that it uses a word; however, I don't see why it's not loading straight into%ax
, and I especially don't see why it's also loading%ah
, which is never used. This is consistent across-O2
,-O3
, and-Os
.EDIT: In an even more bizarre twist, if I add a
while (1) {}
loop to the end of that code, the generation changes as follows:See anything different? The
ss:
modifier is now gone, causing broken code.Thank you!
The text was updated successfully, but these errors were encountered: