|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1994 The University of Utah and ! 3: * the Center for Software Science (CSS). All rights reserved. ! 4: * ! 5: * Permission to use, copy, modify and distribute this software and its ! 6: * documentation is hereby granted, provided that both the copyright ! 7: * notice and this permission notice appear in all copies of the ! 8: * software, derivative works or modified versions, and any portions ! 9: * thereof, and that both notices appear in supporting documentation. ! 10: * ! 11: * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS ! 12: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF ! 13: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 14: * ! 15: * CSS requests users of this software to return to [email protected] any ! 16: * improvements that they make and grant CSS redistribution rights. ! 17: * ! 18: * Author: Bryan Ford, University of Utah CSS ! 19: */ ! 20: ! 21: #include <mach/machine/eflags.h> ! 22: #include <mach/machine/proc_reg.h> ! 23: ! 24: #include "vm_param.h" ! 25: #include "trap.h" ! 26: ! 27: void trap_dump(struct trap_state *st) ! 28: { ! 29: short flags; ! 30: int from_user = (st->cs & 3) || (st->eflags & EFL_VM); ! 31: unsigned *dump_sp = 0; ! 32: int i; ! 33: ! 34: printf("Dump of trap_state at %08x:\n", st); ! 35: printf("EAX %08x EBX %08x ECX %08x EDX %08x\n", ! 36: st->eax, st->ebx, st->ecx, st->edx); ! 37: printf("ESI %08x EDI %08x EBP %08x ESP %08x\n", ! 38: st->esi, st->edi, st->ebp, ! 39: from_user ? st->esp : (unsigned)&st->esp); ! 40: printf("EIP %08x EFLAGS %08x\n", st->eip, st->eflags); ! 41: printf("CS %04x SS %04x DS %04x ES %04x FS %04x GS %04x\n", ! 42: st->cs & 0xffff, from_user ? st->ss & 0xffff : get_ss(), ! 43: st->ds & 0xffff, st->es & 0xffff, ! 44: st->fs & 0xffff, st->gs & 0xffff); ! 45: printf("v86: DS %04x ES %04x FS %04x GS %04x\n", ! 46: st->v86_ds & 0xffff, st->v86_es & 0xffff, ! 47: st->v86_gs & 0xffff, st->v86_gs & 0xffff); ! 48: printf("trapno %d, error %08x, from %s mode\n", ! 49: st->trapno, st->err, from_user ? "user" : "kernel"); ! 50: if (st->trapno == T_PAGE_FAULT) ! 51: printf("page fault linear address %08x\n", st->cr2); ! 52: ! 53: /* Dump the top of the stack too. */ ! 54: if (!from_user) ! 55: { ! 56: for (i = 0; i < 32; i++) ! 57: { ! 58: printf("%08x%c", (&st->esp)[i], ! 59: ((i & 7) == 7) ? '\n' : ' '); ! 60: } ! 61: } ! 62: } ! 63:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.