32-bit Mode/Reg/RM byte displacement question
Posted: Wed Oct 19, 2011 10:55 pm
i'm in the middle of adding 386 and protected mode support to my PC emulator, and i had a question about the mode/reg/rm byte in 32-bit mode...
when operating in 16-bit mode, if the mode field = 1 then there is an 8-bit displacement byte following the mode/reg/rm byte that gets sign-extended to 16-bits.
what i need to know is when operating in 32-bit mode, is the displacement data after the mode/reg/rm byte a 16-bit word that gets sign-extended to 32-bits? or, is it actually a 32-bit dword that is directly read and used without sign-extending?
my best guess is that it's 16-bits sign-extended to 32-bits if the mode is 1, and it's an actual full dword if mode is 2 but i want to be sure about this. some of you guys really know your stuff, so this is the best place i can think to ask.
thanks! i'm hoping to get my emu booting a linux kernel in the near future.
running DOS can only be so exciting...
when operating in 16-bit mode, if the mode field = 1 then there is an 8-bit displacement byte following the mode/reg/rm byte that gets sign-extended to 16-bits.
what i need to know is when operating in 32-bit mode, is the displacement data after the mode/reg/rm byte a 16-bit word that gets sign-extended to 32-bits? or, is it actually a 32-bit dword that is directly read and used without sign-extending?
my best guess is that it's 16-bits sign-extended to 32-bits if the mode is 1, and it's an actual full dword if mode is 2 but i want to be sure about this. some of you guys really know your stuff, so this is the best place i can think to ask.
thanks! i'm hoping to get my emu booting a linux kernel in the near future.
running DOS can only be so exciting...