Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __SPARC_HEAD_H
0003 #define __SPARC_HEAD_H
0004 
0005 #define KERNBASE        0xf0000000  /* First address the kernel will eventually be */
0006 
0007 #define WRITE_PAUSE      nop; nop; nop; /* Have to do this after %wim/%psr chg */
0008 
0009 /* Here are some trap goodies */
0010 
0011 /* Generic trap entry. */
0012 #define TRAP_ENTRY(type, label) \
0013     rd %psr, %l0; b label; rd %wim, %l3; nop;
0014 
0015 /* Data/text faults */
0016 #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7;
0017 #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7;
0018 
0019 /* This is for traps we should NEVER get. */
0020 #define BAD_TRAP(num) \
0021         rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
0022 
0023 /* This is for traps when we want just skip the instruction which caused it */
0024 #define SKIP_TRAP(type, name) \
0025     jmpl %l2, %g0; rett %l2 + 4; nop; nop;
0026 
0027 /* Notice that for the system calls we pull a trick.  We load up a
0028  * different pointer to the system call vector table in %l7, but call
0029  * the same generic system call low-level entry point.  The trap table
0030  * entry sequences are also HyperSparc pipeline friendly ;-)
0031  */
0032 
0033 /* Software trap for Linux system calls. */
0034 #define LINUX_SYSCALL_TRAP \
0035         sethi %hi(sys_call_table), %l7; \
0036         or %l7, %lo(sys_call_table), %l7; \
0037         b linux_sparc_syscall; \
0038         rd %psr, %l0;
0039 
0040 #define BREAKPOINT_TRAP \
0041     b breakpoint_trap; \
0042     rd %psr,%l0; \
0043     nop; \
0044     nop;
0045 
0046 #ifdef CONFIG_KGDB
0047 #define KGDB_TRAP(num)                  \
0048     mov num, %l7;                   \
0049     b kgdb_trap_low;                \
0050     rd %psr,%l0;                    \
0051     nop;
0052 #else
0053 #define KGDB_TRAP(num) \
0054     BAD_TRAP(num)
0055 #endif
0056 
0057 /* The Get Condition Codes software trap for userland. */
0058 #define GETCC_TRAP \
0059         b getcc_trap_handler; rd %psr, %l0; nop; nop;
0060 
0061 /* The Set Condition Codes software trap for userland. */
0062 #define SETCC_TRAP \
0063         b setcc_trap_handler; rd %psr, %l0; nop; nop;
0064 
0065 /* The Get PSR software trap for userland. */
0066 #define GETPSR_TRAP \
0067     rd %psr, %i0; jmp %l2; rett %l2 + 4; nop;
0068 
0069 /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
0070  * gets handled with another macro.
0071  */
0072 #define TRAP_ENTRY_INTERRUPT(int_level) \
0073         mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
0074 
0075 /* Window overflows/underflows are special and we need to try to be as
0076  * efficient as possible here....
0077  */
0078 #define WINDOW_SPILL \
0079         rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
0080 
0081 #define WINDOW_FILL \
0082         rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
0083 
0084 #endif /* __SPARC_HEAD_H */