1 /* $Id: head.h,v 1.23 1996/02/15 09:12:55 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 /* Architectual 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
29 /* This is for traps we should NEVER get. */ 30 #define BAD_TRAP(num) \
31 rd %psr, %l0; movnum, %l7; b bad_trap_handler; rd %wim, %l3;
32
33 /* Notice that for the system calls we pull a trick. We load up a 34 * different pointer to the system call vector table in %l7, but call 35 * the same generic system call low-level entry point. The trap table 36 * entry sequences are also HyperSparc pipeline friendly ;-) 37 */ 38
39 /* Software trap for Linux system calls. */ 40 #define LINUX_SYSCALL_TRAP \
41 sethi %hi(C_LABEL(sys_call_table)), %l7; \
42 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
43 blinux_sparc_syscall; \
44 rd %psr, %l0;
45
46 /* Software trap for SunOS4.1.x system calls. */ 47 #define SUNOS_SYSCALL_TRAP \
48 rd %psr, %l0; \
49 sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
50 blinux_sparc_syscall; \
51 or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
52
53 /* Software trap for Slowaris system calls. */ 54 #define SOLARIS_SYSCALL_TRAP \
55 sethi %hi(C_LABEL(sys_call_table)), %l7; \
56 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
57 blinux_sparc_syscall; \
58 rd %psr, %l0;
59
60 /* Software trap for Sparc-netbsd system calls. */ 61 #define NETBSD_SYSCALL_TRAP \
62 sethi %hi(C_LABEL(sys_call_table)), %l7; \
63 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
64 blinux_sparc_syscall; \
65 rd %psr, %l0;
66
67 /* The Get Condition Codes software trap for userland. */ 68 #define GETCC_TRAP \
69 b getcc_trap_handler; mov %psr, %l0; nop; nop 70
71 /* The Set Condition Codes software trap for userland. */ 72 #define SETCC_TRAP \
73 b setcc_trap_handler; mov %psr, %l0; nop; nop 74
75 /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and 76 * gets handled with another macro. 77 */ 78 #define TRAP_ENTRY_INTERRUPT(int_level) \
79 movint_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
80
81 /* NMI's (Non Maskable Interrupts) are special, you can't keep them 82 * from coming in, and basically if you get one, the shows over. ;( 83 * On the sun4c they are usually asyncronous memory errors, on the 84 * the sun4m they could be either due to mem errors or a software 85 * initiated interrupt from the prom/kern on an SMP box saying "I 86 * command you to do CPU tricks, read your mailbox for more info." 87 */ 88 #define NMI_TRAP \
89 rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
90
91 /* Window overflows/underflows are special and we need to try and be as 92 * efficient as possible here.... 93 */ 94 #define WINDOW_SPILL \
95 rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
96
97 #define WINDOW_FILL \
98 rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
99
100 #endif__SPARC_HEAD_H