1 /* $Id: head.h,v 1.19 1995/11/25 02:31:47 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 /* This is for traps we should NEVER get. */ 26 #define BAD_TRAP(num) \
27 rd %psr, %l0; movnum, %l7; b bad_trap_handler; rd %wim, %l3;
28
29 /* Notice that for the system calls we pull a trick. We load up a 30 * different pointer to the system call vector table in %l7, but call 31 * the same generic system call low-level entry point. The trap table 32 * entry sequences are also HyperSparc pipeline friendly ;-) 33 */ 34
35 /* Software trap for Linux system calls. */ 36 #define LINUX_SYSCALL_TRAP \
37 sethi %hi(C_LABEL(sys_call_table)), %l7; \
38 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
39 blinux_sparc_syscall; \
40 rd %psr, %l0;
41
42 /* Software trap for SunOS4.1.x system calls. */ 43 #define SUNOS_SYSCALL_TRAP \
44 sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
45 or %l7, %lo(C_LABEL(sunos_sys_table)), %l7; \
46 blinux_sparc_syscall; \
47 rd %psr, %l0;
48
49 /* Software trap for Slowaris system calls. */ 50 #define SOLARIS_SYSCALL_TRAP \
51 sethi %hi(C_LABEL(sys_call_table)), %l7; \
52 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
53 blinux_sparc_syscall; \
54 rd %psr, %l0;
55
56 /* Software trap for Sparc-netbsd system calls. */ 57 #define NETBSD_SYSCALL_TRAP \
58 sethi %hi(C_LABEL(sys_call_table)), %l7; \
59 or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
60 blinux_sparc_syscall; \
61 rd %psr, %l0;
62
63 /* The Get Condition Codes software trap for userland. */ 64 #define GETCC_TRAP \
65 b getcc_trap_handler; mov %psr, %l0; nop; nop 66
67 /* The Set Condition Codes software trap for userland. */ 68 #define SETCC_TRAP \
69 b setcc_trap_handler; mov %psr, %l0; nop; nop 70
71 /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and 72 * gets handled with another macro. 73 */ 74 #define TRAP_ENTRY_INTERRUPT(int_level) \
75 movint_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
76
77 /* This is for software interrupts, which currently (atleast on the sun4c) 78 * correspond to IRQ levels 1, 4, and 6. 79 */ 80 #define TRAP_ENTRY_SOFTINT(int_level) \
81 movint_level, %l7; rd %psr, %l0; b soft_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 asyncronous 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; 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