Skip to content

Commit

Permalink
Properly mask values given to safe_read_write
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Jul 11, 2022
1 parent ca9aa5e commit 961a9f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rust/cpu/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,7 @@ pub unsafe fn instr_F6_1_mem(addr: i32, imm: i32) {
pub unsafe fn instr_F6_1_reg(r1: i32, imm: i32) { test8(read_reg8(r1), imm); }

#[no_mangle]
pub unsafe fn instr_F6_2_mem(addr: i32) { safe_read_write8(addr, &|x| !x) }
pub unsafe fn instr_F6_2_mem(addr: i32) { safe_read_write8(addr, &|x| !x & 0xFF) }
#[no_mangle]
pub unsafe fn instr_F6_2_reg(r1: i32) { write_reg8(r1, !read_reg8(r1)); }
#[no_mangle]
Expand Down Expand Up @@ -2296,7 +2296,7 @@ pub unsafe fn instr16_F7_1_mem(addr: i32, imm: i32) {
test16(return_on_pagefault!(safe_read16(addr)), imm);
}
pub unsafe fn instr16_F7_1_reg(r1: i32, imm: i32) { test16(read_reg16(r1), imm); }
pub unsafe fn instr16_F7_2_mem(addr: i32) { safe_read_write16(addr, &|x| !x) }
pub unsafe fn instr16_F7_2_mem(addr: i32) { safe_read_write16(addr, &|x| !x & 0xFFFF) }
pub unsafe fn instr16_F7_2_reg(r1: i32) { write_reg16(r1, !read_reg16(r1)); }
pub unsafe fn instr16_F7_3_mem(addr: i32) { safe_read_write16(addr, &|x| neg16(x)) }
pub unsafe fn instr16_F7_3_reg(r1: i32) { write_reg16(r1, neg16(read_reg16(r1))); }
Expand Down

0 comments on commit 961a9f4

Please sign in to comment.