regress: update C programs to use new API
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
|
||||
int got_sigill = 0;
|
||||
|
||||
void _interrupt(uch handle, uint32_t intno, void *user_data) {
|
||||
void _interrupt(struct uc_struct *uc, uint32_t intno, void *user_data) {
|
||||
if (intno == 6) {
|
||||
uc_emu_stop (handle);
|
||||
uc_emu_stop(uc);
|
||||
got_sigill = 1;
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,9 @@ void _interrupt(uch handle, uint32_t intno, void *user_data) {
|
||||
int main() {
|
||||
int size;
|
||||
uint8_t *buf;
|
||||
uch uh;
|
||||
uch uh_trap;
|
||||
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uh);
|
||||
struct uc_struct *uc;
|
||||
uc_hook_h uh_trap;
|
||||
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc);
|
||||
if (err) {
|
||||
fprintf (stderr, "Cannot initialize unicorn\n");
|
||||
return 1;
|
||||
@@ -32,13 +32,13 @@ int main() {
|
||||
return 1;
|
||||
}
|
||||
memset (buf, 0, size);
|
||||
if (!uc_mem_map (uh, UC_BUG_WRITE_ADDR, size)) {
|
||||
uc_mem_write (uh, UC_BUG_WRITE_ADDR,
|
||||
if (!uc_mem_map(uc, UC_BUG_WRITE_ADDR, size)) {
|
||||
uc_mem_write(uc, UC_BUG_WRITE_ADDR,
|
||||
(const uint8_t*)"\xff\xff\xff\xff\xff\xff\xff\xff", 8);
|
||||
}
|
||||
uc_hook_add (uh, &uh_trap, UC_HOOK_INTR, _interrupt, NULL);
|
||||
uc_emu_start (uh, UC_BUG_WRITE_ADDR, UC_BUG_WRITE_ADDR+8, 0, 1);
|
||||
uc_close (&uh);
|
||||
uc_hook_add(uc, &uh_trap, UC_HOOK_INTR, _interrupt, NULL);
|
||||
uc_emu_start(uc, UC_BUG_WRITE_ADDR, UC_BUG_WRITE_ADDR+8, 0, 1);
|
||||
uc_close(uc);
|
||||
printf ("Correct: %s\n", got_sigill? "YES": "NO");
|
||||
return got_sigill? 0: 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user