1 /* See COPYRIGHT for copyright information. */
4 #include <inc/memlayout.h>
9 ###################################################################
10 # exceptions/interrupts
11 ###################################################################
13 /* The TRAPHANDLER macro defines a globally-visible function for handling
14 * a trap. It pushes a trap number onto the stack, then jumps to _alltraps.
15 * Use TRAPHANDLER for traps where the CPU automatically pushes an error code.
17 #define TRAPHANDLER(name, num) \
18 .globl name; /* define global symbol for 'name' */ \
19 .type name, @function; /* symbol type is function */ \
20 .align 2; /* align function definition */ \
21 name: /* function starts here */ \
25 /* Use TRAPHANDLER_NOEC for traps where the CPU doesn't push an error code.
26 * It pushes a 0 in place of the error code, so the trap frame has the same
27 * format in either case.
29 #define TRAPHANDLER_NOEC(name, num) \
31 .type name, @function; \
41 * Lab 3: Your code here for generating entry points for the different traps.
43 TRAPHANDLER_NOEC(divzero_entry, T_DIVIDE);
44 TRAPHANDLER_NOEC(debug_entry, T_DEBUG);
45 TRAPHANDLER_NOEC(nmi_entry, T_NMI);
46 TRAPHANDLER_NOEC(brkpt_entry, T_BRKPT);
47 TRAPHANDLER_NOEC(oflow_entry, T_OFLOW);
48 TRAPHANDLER_NOEC(bound_entry, T_BOUND);
49 TRAPHANDLER_NOEC(illop_entry, T_ILLOP);
50 TRAPHANDLER_NOEC(device_entry, T_DEVICE);
51 TRAPHANDLER(dblflt_entry, T_DBLFLT);
52 TRAPHANDLER(tss_entry, T_TSS);
53 TRAPHANDLER(segnp_entry, T_SEGNP);
54 TRAPHANDLER(stack_entry, T_STACK);
55 TRAPHANDLER(gpflt_entry, T_GPFLT);
56 TRAPHANDLER(pgflt_entry, T_PGFLT);
57 TRAPHANDLER_NOEC(fperr_entry, T_FPERR);
58 TRAPHANDLER(align_entry, T_ALIGN);
59 TRAPHANDLER_NOEC(mchk_entry, T_MCHK);
60 TRAPHANDLER_NOEC(simderr_entry, T_SIMDERR);
64 * Lab 3: Your code here for _alltraps