blob: 25460390fc7076cd48cdc4289b2772d8922a7b5e [file] [log] [blame]
Sam Ravnborgf5e706a2008-07-17 21:55:51 -07001#ifndef __SPARC_HEAD_H
2#define __SPARC_HEAD_H
3
4#define KERNBASE 0xf0000000 /* First address the kernel will eventually be */
5#define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */
6#define SUN4C_SEGSZ (1 << 18)
7#define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2) /* Used in boot remapping. */
8#define INTS_ENAB 0x01 /* entry.S uses this. */
9
10#define SUN4_PROM_VECTOR 0xFFE81000 /* SUN4 PROM needs to be hardwired */
11
12#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
13#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
14
15/* Here are some trap goodies */
16
17/* Generic trap entry. */
18#define TRAP_ENTRY(type, label) \
19 rd %psr, %l0; b label; rd %wim, %l3; nop;
20
Sam Ravnborg306f1232012-05-11 11:35:06 +000021/* Data/text faults */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070022#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7;
23#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7;
24
25/* This is for traps we should NEVER get. */
26#define BAD_TRAP(num) \
27 rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
28
29/* This is for traps when we want just skip the instruction which caused it */
30#define SKIP_TRAP(type, name) \
31 jmpl %l2, %g0; rett %l2 + 4; nop; nop;
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(sys_call_table), %l7; \
42 or %l7, %lo(sys_call_table), %l7; \
43 b linux_sparc_syscall; \
44 rd %psr, %l0;
45
46#define BREAKPOINT_TRAP \
47 b breakpoint_trap; \
48 rd %psr,%l0; \
49 nop; \
50 nop;
51
52#ifdef CONFIG_KGDB
53#define KGDB_TRAP(num) \
54 b kgdb_trap_low; \
55 rd %psr,%l0; \
56 nop; \
57 nop;
58#else
59#define KGDB_TRAP(num) \
60 BAD_TRAP(num)
61#endif
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/* The Get PSR software trap for userland. */
72#define GETPSR_TRAP \
73 mov %psr, %i0; jmp %l2; rett %l2 + 4; 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 mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
80
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070081/* Window overflows/underflows are special and we need to try to be as
82 * efficient as possible here....
83 */
84#define WINDOW_SPILL \
85 rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
86
87#define WINDOW_FILL \
88 rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
89
90#endif /* __SPARC_HEAD_H */