fn emit_state_load_u8(&mut self, reg: X86Register, field: Offset<u8>) {
        // We need to use `MOV r8, r/m8` for moving a byte from memory to a register, so the opcode
        // is `0x8A`. Since it uses an `r/m` operand, the next byte is a ModR/M byte, which is
        // explained at http://www.c-jump.com/CIS77/CPU/x86/X77_0060_mod_reg_r_m_byte.htm.
        //
        // For the `MOD` bits, we use `0b10`, which means that a 4-byte signed displacement follows
        // the addressing mode bytes. That byte will be set to whatever the offset into the
        // `ChipState` is. FIXME: If the offset is smaller than 128 Bytes we can just use the 1-byte
        // displacement, specified with `0b01`.
        //
        // The `REG` field contains the target register, so it depends on the passed `X86Register`.
        //
        // The `R/M` field specifies the 32-bit register containing the base address to load from,
        // so we need to set it to `esi` (`0b110`), since we store the address of the `ChipState` in
        // there.

        let offset = field.bytes;
        assert!(offset < i32::MAX as usize);

        self.emit_raw(&[0x8A, (0b10 << 6) | (reg.as_reg_field_value() << 3) | 0b110]);
        self.code_buffer.write_i32::<LittleEndian>(offset as i32).unwrap();
    }
/// Emits code to load a `u8` from the given `ChipState` field into a register.
///
/// The generated code is safe if the address can be read safely during the time the code is
/// executed. This is the case for anything stored in the `ChipState` and static variables.
Emits code to load a `u8` from the given `ChipState` field into a register.
The generated code is safe if the address can be read safely during the time the code is
executed. This is the case for anything stored in the `ChipState` and static variables.
Emits code to load a ` u8 ` from the given ` ChipState ` field into a register . The generated code is safe if the address can be read safely during the time the code is executed . This is the case for anything stored in the ` ChipState ` and static variables .
fn emit_state_load_u8(&mut self, reg: X86Register, field: Offset<u8>) {
        // We need to use `MOV r8, r/m8` for moving a byte from memory to a register, so the opcode
        // is `0x8A`. Since it uses an `r/m` operand, the next byte is a ModR/M byte, which is
        // explained at http://www.c-jump.com/CIS77/CPU/x86/X77_0060_mod_reg_r_m_byte.htm.
        //
        // For the `MOD` bits, we use `0b10`, which means that a 4-byte signed displacement follows
        // the addressing mode bytes. That byte will be set to whatever the offset into the
        // `ChipState` is. FIXME: If the offset is smaller than 128 Bytes we can just use the 1-byte
        // displacement, specified with `0b01`.
        //
        // The `REG` field contains the target register, so it depends on the passed `X86Register`.
        //
        // The `R/M` field specifies the 32-bit register containing the base address to load from,
        // so we need to set it to `esi` (`0b110`), since we store the address of the `ChipState` in
        // there.
        let offset = field.bytes;
        assert!(offset < i32::MAX as usize);
        self.emit_raw(&[0x8A, (0b10 << 6) | (reg.as_reg_field_value() << 3) | 0b110]);
        self.code_buffer.write_i32::<LittleEndian>(offset as i32).unwrap();
    }
fn emit_state_load_u8 ( & mut self , reg : X86Register , field : Offset < u8 > ) { // We need to use `MOV r8, r/m8` for moving a byte from memory to a register, so the opcode // is `0x8A`. Since it uses an `r/m` operand, the next byte is a ModR/M byte, which is // explained at http://www.c-jump.com/CIS77/CPU/x86/X77_0060_mod_reg_r_m_byte.htm. // // For the `MOD` bits, we use `0b10`, which means that a 4-byte signed displacement follows // the addressing mode bytes. That byte will be set to whatever the offset into the // `ChipState` is. FIXME: If the offset is smaller than 128 Bytes we can just use the 1-byte // displacement, specified with `0b01`. // // The `REG` field contains the target register, so it depends on the passed `X86Register`. // // The `R/M` field specifies the 32-bit register containing the base address to load from, // so we need to set it to `esi` (`0b110`), since we store the address of the `ChipState` in // there. let offset = field . bytes ; assert ! ( offset i32 MAX as usize ) ; self . emit_raw ( & [ 0x8A , ( 0b10 << 6 ) | ( reg . as_reg_field_value ( ) << 3 ) | 0b110 ] ) ; self . code_buffer . write_i32 :: < LittleEndian > ( offset as i32 ) . unwrap ( ) ; }
Emits code to load a `u8` from the given `ChipState` field into a register.
Emits code to load a ` u8 ` from the given ` ChipState ` field into a register .
&mut self
reg
X86Register
field
Offset<u8>
&mut self
reg
X86Register
field
Offset<u8>