| 216 | char data[sizeof(sigjmp_buf)]; |
| 217 | }; |
| 218 | void HandleError(int signum, struct sigcontext ctx) |
| 219 | { |
| 220 | bool externalCode = ctx.eip < binCodeStart || ctx.eip > binCodeEnd; |
| 221 | if(signum == SIGFPE) |
| 222 | { |
| 223 | expCodePublic = EXCEPTION_INT_DIVIDE_BY_ZERO; |
| 224 | siglongjmp(errorHandler, expCodePublic); |
| 225 | } |
| 226 | if(signum == SIGTRAP) |
| 227 | { |
| 228 | expCodePublic = EXCEPTION_ARRAY_OUT_OF_BOUNDS; |
| 229 | siglongjmp(errorHandler, expCodePublic); |
| 230 | } |
| 231 | if(signum == SIGSEGV) |
| 232 | { |
| 233 | if((void*)ctx.cr2 >= NULLC::stackBaseAddress && (void*)ctx.cr2 <= NULLC::stackEndAddress) |
| 234 | { |
| 235 | expCodePublic = stackManaged ? EXCEPTION_FAILED_TO_RESERVE : EXCEPTION_ALLOCATED_STACK_OVERFLOW; |
| 236 | |
| 237 | siglongjmp(errorHandler, expCodePublic); |
| 238 | } |
| 239 | if(!externalCode && ctx.cr2 < 0x00010000) |
| 240 | { |
| 241 | expCodePublic = EXCEPTION_INVALID_POINTER; |
| 242 | siglongjmp(errorHandler, expCodePublic); |
| 243 | } |
| 244 | } |
| 245 | signal(signum, SIG_DFL); |
| 246 | raise(signum); |
| 247 | } |
| 248 | #endif |
| 249 | |
| 250 | typedef void (*codegenCallback)(VMCmd); |
nothing calls this directly
no outgoing calls
no test coverage detected