void segv_handler(int sig, struct uml_pt_regs *regs) { struct faultinfo * fi = UPT_FAULTINFO(regs); if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) { bad_segv(*fi, UPT_IP(regs)); return; } segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); }
static void handle_segv(int pid) { struct ptrace_faultinfo fault; int err; err = ptrace(PTRACE_FAULTINFO, pid, 0, &fault); if(err) panic("handle_segv - PTRACE_FAULTINFO failed, errno = %d\n", errno); segv(fault.addr, 0, FAULT_WRITE(fault.is_write), 1, NULL); }
void segv_handler(int sig, union uml_pt_regs *regs) { int index, max; struct faultinfo * fi = UPT_FAULTINFO(regs); if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ bad_segv(*fi, UPT_IP(regs)); return; } max = sizeof(segfault_record)/sizeof(segfault_record[0]); index = next_trap_index(max); nsegfaults++; segfault_record[index].address = FAULT_ADDRESS(*fi); segfault_record[index].pid = os_getpid(); segfault_record[index].is_write = FAULT_WRITE(*fi); segfault_record[index].sp = UPT_SP(regs); segfault_record[index].is_user = UPT_IS_USER(regs); segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); }
static void handle_segv(int pid, union uml_pt_regs * regs) { get_skas_faultinfo(pid, ®s->skas.faultinfo); segv(regs->skas.faultinfo, 0, 1, NULL); }
int main() { static int alph[256], w[MAXCOLS+1]; int i, j, c; for (i = 0; i < 256; i++) alph[i] = ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z')); for (;;) { memset(map, 0, sizeof(map)); for (height = width = 0, i = 0; (c = getchar()) != EOF;) { if (alph[c] != 0) { map[height][i++] = c; if (i >= MAXCOLS) segv(); } else if (c == '\n') { if (i == 0) continue; if (width == 0) width = i; height++; i = 0; if (height >= MAXROWS) outl(); } else if (c == '%') { break; } } if (i != 0) { if (width == 0) width = i; height++; } if (width == 0 || height == 0) break; memset(assign, 0, sizeof(assign)); for (i = 0, c = 0; i < height; i++) for (j = 0; j < width; j++) if (assign[i][j] == 0) fill(j, i, ++c); for (i = 0; i < width; i++) { for (c = assign[0][i], j = 1; j < height; j++) if (assign[j][i] > c) c = assign[j][i]; for (j = 0; c > 0; j++, c /= 10); w[i] = j; } for (i = 0; i < height; i++) { for (j = 0; j < width; j++) printf((j + 1) >= width ? "%*d\n" : "%*d ", w[j], assign[i][j]); } printf("%%\n"); } return 0; }
int segv(int n) { return n * segv(n-1); }