From 693927a4e265fed001402604fd457141e179646b Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sat, 14 Dec 2019 02:49:04 +0000 Subject: [PATCH] agssim: move signal handling codeblock and related macros further up they're needed there shortly --- agssim.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/agssim.c b/agssim.c index b7454f9..4e3b50d 100644 --- a/agssim.c +++ b/agssim.c @@ -37,6 +37,29 @@ static struct mem { size_t lheap; } mem; +#define EIP registers[AR_NULL].i + +#define VM_SIGILL 1 +#define VM_SIGSEGV 2 +#define VM_SIGABRT 3 +static int vm_return; +static void vm_signal(int sig, int param) { + switch(sig) { + case VM_SIGILL: + dprintf(2, "illegal instruction at IP %u\n", EIP); + break; + case VM_SIGSEGV: + dprintf(2, "segmentation fault: invalid access at %u\n", EIP); + break; + case VM_SIGABRT: + dprintf(2, "aborted (assertlte check failed at IP %u)\n", EIP); + break; + default: + dprintf(2, "unknown signal\n"); + } + vm_return = 1; +} + #define memory (mem.mem) #define text memory #define text_end ALIGN(mem.ltext, 4096) @@ -335,29 +358,6 @@ static int label_check() { return 1; } -#define EIP registers[AR_NULL].i - -#define VM_SIGILL 1 -#define VM_SIGSEGV 2 -#define VM_SIGABRT 3 -static int vm_return; -static void vm_signal(int sig, int param) { - switch(sig) { - case VM_SIGILL: - dprintf(2, "illegal instruction at IP %u\n", EIP); - break; - case VM_SIGSEGV: - dprintf(2, "segmentation fault: invalid access at %u\n", EIP); - break; - case VM_SIGABRT: - dprintf(2, "aborted (assertlte check failed at IP %u)\n", EIP); - break; - default: - dprintf(2, "unknown signal\n"); - } - vm_return = 1; -} - #define CODE_INT(X) eip[X] #define CODE_FLOAT(X) ((float*)eip)[X] #define REGI(X) registers[CODE_INT(X)&0xff].i -- 2.11.4.GIT