1 /* $Id: head.h,v 1.27 1996/04/25 06:13:06 davem Exp $ */ 2 #ifndef__SPARC_HEAD_H 3 #define__SPARC_HEAD_H 4
5 #defineKERNBASE 0xf0000000 /* First address the kernel will eventually be */ 6 #define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */ 7 #define SUN4C_SEGSZ (1 << 18)
8 #define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2) /* Used in boot remapping. */ 9 #define INTS_ENAB 0x01 /* entry.S uses this. */ 10
11 #defineNCPUS 4 /* Architectural limit of sun4m. */ 12
13 #define SUN4_PROM_VECTOR 0xFFE81000 /* To safely die on a SUN4 */ 14 #define SUN4_PRINTF 0x84 /* Offset into SUN4_PROM_VECTOR */ 15
16 #define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */ 17 #define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */ 18
19 /* Here are some trap goodies */ 20
21 /* Generic trap entry. */ 22 #define TRAP_ENTRY(type, label) \
23 rd %psr, %l0; blabel; rd %wim, %l3; nop;
24
25 /* Data/text faults. Defaults to sun4c version at boot time. */ 26 #define SPARC_TFAULT rd %psr, %l0; rd %wim, %l3; bsun4c_fault; mov 1, %l7;
27 #define SPARC_DFAULT rd %psr, %l0; rd %wim, %l3; bsun4c_fault; mov 0, %l7;
28 #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; bC_LABEL(srmmu_fault); mov 1, %l7;
29 #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; bC_LABEL(srmmu_fault); mov 0, %l7;
30
31 /* This is for traps we should NEVER get. */ 32 #define BAD_TRAP(num) \
33 rd %psr, %l0; movnum, %l7; b bad_trap_handler; rd %wim, %l3;
34
35 /* Notice that for the system calls we pull a trick. We load up a 36 * different pointer to the system call vector table in %l7, but call 37 * the same generic system call low-level entry point. The trap table 38 * entry sequences are also HyperSparc pipeline friendly ;-) 39 */ 40
41 /* Software trap for Linux system calls. */ 42 #define LINUX_SYSCALL_TRAP \
43 sethi %hi(C_LABEL(sys_call_table)), %l7; \
44 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
45 blinux_sparc_syscall; \
46 rd %psr, %l0;
47
48 /* Software trap for SunOS4.1.x system calls. */ 49 #define SUNOS_SYSCALL_TRAP \
50 rd %psr, %l0; \
51 sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
52 blinux_sparc_syscall; \
53 or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
54
55 /* Software trap for Slowaris system calls. */ 56 #define SOLARIS_SYSCALL_TRAP \
57 sethi %hi(C_LABEL(sys_call_table)), %l7; \
58 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
59 b solaris_syscall; \
60 rd %psr, %l0;
61
62 /* Software trap for Sparc-netbsd system calls. */ 63 #define NETBSD_SYSCALL_TRAP \
64 sethi %hi(C_LABEL(sys_call_table)), %l7; \
65 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
66 b bsd_syscall; \
67 rd %psr, %l0;
68
69 /* The Get Condition Codes software trap for userland. */ 70 #define GETCC_TRAP \
71 b getcc_trap_handler; mov %psr, %l0; nop; nop;
72
73 /* The Set Condition Codes software trap for userland. */ 74 #define SETCC_TRAP \
75 b setcc_trap_handler; mov %psr, %l0; nop; nop;
76
77 /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and 78 * gets handled with another macro. 79 */ 80 #define TRAP_ENTRY_INTERRUPT(int_level) \
81 movint_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
82
83 /* NMI's (Non Maskable Interrupts) are special, you can't keep them 84 * from coming in, and basically if you get one, the shows over. ;( 85 * On the sun4c they are usually asynchronous memory errors, on the 86 * the sun4m they could be either due to mem errors or a software 87 * initiated interrupt from the prom/kern on an SMP box saying "I 88 * command you to do CPU tricks, read your mailbox for more info." 89 */ 90 #define NMI_TRAP \
91 rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
92
93 /* Window overflows/underflows are special and we need to try and be as 94 * efficient as possible here.... 95 */ 96 #define WINDOW_SPILL \
97 rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
98
99 #define WINDOW_FILL \
100 rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
101
102 #endif__SPARC_HEAD_H