This commit is contained in:
Kartik Agaram 2020-10-01 21:28:23 -07:00
parent d75b712974
commit 8e607b128c
3 changed files with 13 additions and 14 deletions

View File

@ -241,7 +241,6 @@ inline string mem_addr_string(uint32_t addr, uint32_t size) {
return out.str();
}
inline void write_mem_u8(uint32_t addr, uint8_t val) {
uint8_t* handle = mem_addr_u8(addr);
if (handle != NULL) *handle = val;

View File

@ -84,7 +84,7 @@ void test_add_mem_at_r32_to_r32_signed_overflow() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 03 18 \n" // add *EAX to EBX
// ModR/M in binary: 11 (direct mode) 011 (src EBX) 000 (dest EAX)
// ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
"== data 0x2000\n"
"01 00 00 00\n" // 1
);
@ -104,7 +104,7 @@ void test_add_mem_at_r32_to_r32_unsigned_overflow() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 03 18 \n" // add *EAX to EBX
// ModR/M in binary: 11 (direct mode) 011 (src EBX) 000 (dest EAX)
// ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
"== data 0x2000\n"
"01 00 00 00\n"
);
@ -124,7 +124,7 @@ void test_add_mem_at_r32_to_r32_unsigned_and_signed_overflow() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 03 18 \n" // add *EAX to EBX
// ModR/M in binary: 11 (direct mode) 011 (src EBX) 000 (dest EAX)
// ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
"== data 0x2000\n"
"00 00 00 80\n" // smallest negative signed integer
);
@ -212,7 +212,7 @@ void test_subtract_mem_at_r32_from_r32_signed_overflow() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 2b 18 \n" // subtract *EAX from EBX
// ModR/M in binary: 11 (direct mode) 011 (src EBX) 000 (dest EAX)
// ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
"== data 0x2000\n"
"ff ff ff 7f\n" // largest positive signed integer
);
@ -232,7 +232,7 @@ void test_subtract_mem_at_r32_from_r32_unsigned_overflow() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 2b 18 \n" // subtract *EAX from EBX
// ModR/M in binary: 11 (direct mode) 011 (src EBX) 000 (dest EAX)
// ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
"== data 0x2000\n"
"01 00 00 00\n" // 1
);
@ -252,7 +252,7 @@ void test_subtract_mem_at_r32_from_r32_signed_and_unsigned_overflow() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 2b 18 \n" // subtract *EAX from EBX
// ModR/M in binary: 11 (direct mode) 011 (src EBX) 000 (dest EAX)
// ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
"== data 0x2000\n"
"00 00 00 80\n" // smallest negative signed integer
);
@ -583,7 +583,7 @@ void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 3b 18 \n" // compare EBX with *EAX
// ModR/M in binary: 11 (direct mode) 011 (lhs EBX) 000 (rhs EAX)
// ModR/M in binary: 00 (indirect mode) 011 (lhs EBX) 000 (rhs EAX)
"== data 0x2000\n"
"0d 0c 0b 0a\n" // 0x0a0b0c0d
);
@ -602,7 +602,7 @@ void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed_due_to_overflo
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 3b 18 \n" // compare EBX with *EAX
// ModR/M in binary: 11 (direct mode) 011 (lhs EBX) 000 (rhs EAX)
// ModR/M in binary: 00 (indirect mode) 011 (lhs EBX) 000 (rhs EAX)
"== data 0x2000\n"
"00 00 00 80\n" // smallest negative signed integer
);
@ -621,7 +621,7 @@ void test_compare_r32_with_mem_at_rm32_lesser_signed() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 3b 18 \n" // compare EBX with *EAX
// ModR/M in binary: 11 (direct mode) 011 (lhs EBX) 000 (rhs EAX)
// ModR/M in binary: 00 (indirect mode) 011 (lhs EBX) 000 (rhs EAX)
"== data 0x2000\n"
"01 00 00 00\n" // 1
);
@ -640,7 +640,7 @@ void test_compare_r32_with_mem_at_rm32_lesser_unsigned() {
"== code 0x1\n"
// op ModR/M SIB displacement immediate
" 3b 18 \n" // compare EBX with *EAX
// ModR/M in binary: 11 (direct mode) 011 (lhs EBX) 000 (rhs EAX)
// ModR/M in binary: 00 (indirect mode) 011 (lhs EBX) 000 (rhs EAX)
"== data 0x2000\n"
"ff ff ff ff\n" // -1
);

View File

@ -84,7 +84,7 @@ if empty($TMUX) || (system("tmux display-message -p '#{client_control_mode}'") =
" can't put final cursor movement out of function because that disables the wait for <CR> prompt; function must be final operation of map
" can't avoid the function because that disables the wait for <CR> prompt
noremap <Leader>t {:keeppatterns /^[^ #]<CR>:call RunTestMoveCursor("<C-r><C-w>")<CR>
function RunTestMoveCursor(arg)
function! RunTestMoveCursor(arg)
exec "!./run_one_test ".expand("%")." '".a:arg."'"
exec "normal \<C-o>"
endfunction
@ -92,10 +92,10 @@ else
" we have tmux and are not in control mode; we don't need to show any output in the Vim pane so life is simpler
" assume the left-most window is for the shell
noremap <Leader>t {:keeppatterns /^[^ #]<CR>:silent! call RunTestInFirstPane("<C-r><C-w>")<CR><C-o>
function RunTestInFirstPane(arg)
function! RunTestInFirstPane(arg)
call RunInFirstPane("./run_one_test ".expand("%")." ".a:arg)
endfunction
function RunInFirstPane(arg)
function! RunInFirstPane(arg)
exec "!tmux select-pane -t :0.0"
exec "!tmux send-keys '".a:arg."' C-m"
exec "!tmux last-pane"