patch-2.4.21 linux-2.4.21/arch/sparc/kernel/entry.S
Next file: linux-2.4.21/arch/sparc/kernel/etrap.S
Previous file: linux-2.4.21/arch/sparc/kernel/auxio.c
Back to the patch index
Back to the overall index
- Lines: 579
- Date:
2003-06-13 07:51:32.000000000 -0700
- Orig file:
linux-2.4.20/arch/sparc/kernel/entry.S
- Orig date:
2001-11-13 09:16:05.000000000 -0800
diff -urN linux-2.4.20/arch/sparc/kernel/entry.S linux-2.4.21/arch/sparc/kernel/entry.S
@@ -38,6 +38,14 @@
#define NR_SYSCALLS 256 /* Each OS is different... */
+/* These are just handy. */
+#define _SV save %sp, -STACKFRAME_SZ, %sp
+#define _RS restore
+
+#define FLUSH_ALL_KERNEL_WINDOWS \
+ _SV; _SV; _SV; _SV; _SV; _SV; _SV; \
+ _RS; _RS; _RS; _RS; _RS; _RS; _RS;
+
/* First, KGDB low level things. This is a rewrite
* of the routines found in the sparc-stub.c asm() statement
* from the gdb distribution. This is also dual-purpose
@@ -70,11 +78,11 @@
/* Make sure kgdb sees the same state we just saved. */
LOAD_PT_GLOBALS(sp)
LOAD_PT_INS(sp)
- ld [%sp + REGWIN_SZ + PT_Y], %l4
- ld [%sp + REGWIN_SZ + PT_WIM], %l3
- ld [%sp + REGWIN_SZ + PT_PSR], %l0
- ld [%sp + REGWIN_SZ + PT_PC], %l1
- ld [%sp + REGWIN_SZ + PT_NPC], %l2
+ ld [%sp + STACKFRAME_SZ + PT_Y], %l4
+ ld [%sp + STACKFRAME_SZ + PT_WIM], %l3
+ ld [%sp + STACKFRAME_SZ + PT_PSR], %l0
+ ld [%sp + STACKFRAME_SZ + PT_PC], %l1
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l2
rd %tbr, %l5 /* Never changes... */
/* Make kgdb exception frame. */
@@ -94,7 +102,7 @@
WRITE_PAUSE
call C_LABEL(handle_exception)
- add %sp, REGWIN_SZ, %o0 ! Pass address of registers
+ add %sp, STACKFRAME_SZ, %o0 ! Pass address of registers
/* Load new kgdb register set. */
LOAD_KGDB_GLOBALS(sp)
@@ -263,7 +271,7 @@
mov 11, %o0 ! floppy irq level (unused anyway)
mov %g0, %o1 ! devid is not used in fast interrupts
call C_LABEL(sparc_floppy_irq)
- add %sp, REGWIN_SZ, %o2 ! struct pt_regs *regs
+ add %sp, STACKFRAME_SZ, %o2 ! struct pt_regs *regs
RESTORE_ALL
@@ -312,7 +320,7 @@
mov %l7, %o0 ! irq level
patch_handler_irq:
call C_LABEL(handler_irq)
- add %sp, REGWIN_SZ, %o1 ! pt_regs ptr
+ add %sp, STACKFRAME_SZ, %o1 ! pt_regs ptr
or %l0, PSR_PIL, %g2 ! restore PIL after handler_irq
wr %g2, PSR_ET, %psr ! keep ET up
WRITE_PAUSE
@@ -329,7 +337,7 @@
wr %g2, PSR_ET, %psr
WRITE_PAUSE
call C_LABEL(smp4m_percpu_timer_interrupt)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
wr %l0, PSR_ET, %psr
WRITE_PAUSE
RESTORE_ALL
@@ -436,7 +444,7 @@
wr %g2, PSR_ET, %psr
WRITE_PAUSE
call C_LABEL(smp4d_percpu_timer_interrupt)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
wr %l0, PSR_ET, %psr
WRITE_PAUSE
RESTORE_ALL
@@ -498,7 +506,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(do_illegal_instruction)
@@ -518,7 +526,7 @@
wr %l0, PSR_ET, %psr
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(do_priv_instruction)
@@ -541,7 +549,7 @@
ld [%l1], %o1
call C_LABEL(kernel_unaligned_trap)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
RESTORE_ALL
@@ -553,7 +561,7 @@
ld [%l1], %o1
call C_LABEL(user_unaligned_trap)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
RESTORE_ALL
@@ -566,7 +574,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(do_fpd_trap)
@@ -605,7 +613,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(do_fpe_trap)
@@ -622,7 +630,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(handle_tag_overflow)
@@ -639,7 +647,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(handle_watchpoint)
@@ -656,7 +664,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(handle_reg_access)
@@ -673,7 +681,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(handle_cp_disabled)
@@ -690,7 +698,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(handle_cp_exception)
@@ -707,7 +715,7 @@
wr %l0, PSR_ET, %psr ! re-enable traps
WRITE_PAUSE
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
mov %l1, %o1
mov %l2, %o2
call C_LABEL(handle_hw_divzero)
@@ -731,10 +739,10 @@
nop
/* Advance over the trap instruction. */
- ld [%sp + REGWIN_SZ + PT_NPC], %l1
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1
add %l1, 0x4, %l2
- st %l1, [%sp + REGWIN_SZ + PT_PC]
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
RESTORE_ALL
@@ -746,10 +754,10 @@
FLUSH_ALL_KERNEL_WINDOWS
/* Advance over the trap instruction. */
- ld [%sp + REGWIN_SZ + PT_NPC], %l1
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1
add %l1, 0x4, %l2
- st %l1, [%sp + REGWIN_SZ + PT_PC]
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
RESTORE_ALL
@@ -818,7 +826,7 @@
sub %o0, 0x4, %o0
lda [%o0] ASI_CONTROL, %o3 ! async error
call C_LABEL(sparc_lvl15_nmi)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
RESTORE_ALL
@@ -1152,7 +1160,7 @@
WRITE_PAUSE
call C_LABEL(do_sun4c_fault)
- add %sp, REGWIN_SZ, %o0 ! arg1 = pt_regs ptr
+ add %sp, STACKFRAME_SZ, %o0 ! arg1 = pt_regs ptr
RESTORE_ALL
@@ -1186,7 +1194,7 @@
WRITE_PAUSE
call C_LABEL(do_sparc_fault)
- add %sp, REGWIN_SZ, %o0 ! arg1 = pt_regs ptr
+ add %sp, STACKFRAME_SZ, %o0 ! arg1 = pt_regs ptr
RESTORE_ALL
@@ -1224,7 +1232,7 @@
.globl C_LABEL(sys_nis_syscall)
C_LABEL(sys_nis_syscall):
mov %o7, %l5
- add %sp, REGWIN_SZ, %o0 ! pt_regs *regs arg
+ add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
call C_LABEL(c_sys_nis_syscall)
mov %l5, %o7
@@ -1232,7 +1240,7 @@
.globl C_LABEL(sys_ptrace)
C_LABEL(sys_ptrace):
call C_LABEL(do_ptrace)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
ld [%curptr + AOFF_task_ptrace], %l5
andcc %l5, 0x02, %g0
@@ -1249,7 +1257,7 @@
.globl C_LABEL(sys_execve)
C_LABEL(sys_execve):
mov %o7, %l5
- add %sp, REGWIN_SZ, %o0 ! pt_regs *regs arg
+ add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
call C_LABEL(sparc_execve)
mov %l5, %o7
@@ -1257,7 +1265,7 @@
.globl C_LABEL(sys_pipe)
C_LABEL(sys_pipe):
mov %o7, %l5
- add %sp, REGWIN_SZ, %o0 ! pt_regs *regs arg
+ add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
call C_LABEL(sparc_pipe)
mov %l5, %o7
@@ -1282,7 +1290,7 @@
C_LABEL(sys_sigpause):
/* Note: %o0 already has correct value... */
call C_LABEL(do_sigpause)
- add %sp, REGWIN_SZ, %o1
+ add %sp, STACKFRAME_SZ, %o1
ld [%curptr + AOFF_task_ptrace], %l5
andcc %l5, 0x02, %g0
@@ -1300,7 +1308,7 @@
.globl C_LABEL(sys_sigsuspend)
C_LABEL(sys_sigsuspend):
call C_LABEL(do_sigsuspend)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
ld [%curptr + AOFF_task_ptrace], %l5
andcc %l5, 0x02, %g0
@@ -1319,7 +1327,7 @@
C_LABEL(sys_rt_sigsuspend):
/* Note: %o0, %o1 already have correct value... */
call C_LABEL(do_rt_sigsuspend)
- add %sp, REGWIN_SZ, %o2
+ add %sp, STACKFRAME_SZ, %o2
ld [%curptr + AOFF_task_ptrace], %l5
andcc %l5, 0x02, %g0
@@ -1337,7 +1345,7 @@
.globl C_LABEL(sys_sigreturn)
C_LABEL(sys_sigreturn):
call C_LABEL(do_sigreturn)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
ld [%curptr + AOFF_task_ptrace], %l5
andcc %l5, 0x02, %g0
@@ -1357,7 +1365,7 @@
.globl C_LABEL(sys_rt_sigreturn)
C_LABEL(sys_rt_sigreturn):
call C_LABEL(do_rt_sigreturn)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
ld [%curptr + AOFF_task_ptrace], %l5
andcc %l5, 0x02, %g0
@@ -1391,7 +1399,7 @@
WRITE_PAUSE
mov %fp, %o1 ! arg1: usp
std %g4, [%curptr + AOFF_task_thread + AOFF_thread_fork_kpsr]
- add %sp, REGWIN_SZ, %o2 ! arg2: pt_regs ptr
+ add %sp, STACKFRAME_SZ, %o2 ! arg2: pt_regs ptr
mov 0, %o3
call C_LABEL(do_fork)
mov %l5, %o7
@@ -1414,7 +1422,7 @@
andn %o1, 7, %o1 ! no, align to 8 bytes
1:
std %g4, [%curptr + AOFF_task_thread + AOFF_thread_fork_kpsr]
- add %sp, REGWIN_SZ, %o2 ! arg2: pt_regs ptr
+ add %sp, STACKFRAME_SZ, %o2 ! arg2: pt_regs ptr
mov 0, %o3
call C_LABEL(do_fork)
mov %l5, %o7
@@ -1435,7 +1443,7 @@
sethi %hi(C_LABEL(do_fork)), %l1
mov 0, %o3
jmpl %l1 + %lo(C_LABEL(do_fork)), %g0
- add %sp, REGWIN_SZ, %o2
+ add %sp, STACKFRAME_SZ, %o2
.align 4
linux_sparc_ni_syscall:
@@ -1466,7 +1474,7 @@
call schedule_tail
mov %g3, %o0
b C_LABEL(ret_sys_call)
- ld [%sp + REGWIN_SZ + PT_I0], %o0
+ ld [%sp + STACKFRAME_SZ + PT_I0], %o0
/* Linux native and SunOS system calls enter here... */
.align 4
@@ -1501,13 +1509,13 @@
call %l7
mov %i5, %o5
- st %o0, [%sp + REGWIN_SZ + PT_I0]
+ st %o0, [%sp + STACKFRAME_SZ + PT_I0]
.globl C_LABEL(ret_sys_call)
C_LABEL(ret_sys_call):
ld [%curptr + AOFF_task_ptrace], %l6
cmp %o0, -ENOIOCTLCMD
- ld [%sp + REGWIN_SZ + PT_PSR], %g3
+ ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
set PSR_C, %g2
bgeu 1f
andcc %l6, 0x02, %l6
@@ -1515,35 +1523,35 @@
/* System call success, clear Carry condition code. */
andn %g3, %g2, %g3
clr %l6
- st %g3, [%sp + REGWIN_SZ + PT_PSR]
+ st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
bne linux_syscall_trace2
- ld [%sp + REGWIN_SZ + PT_NPC], %l1 /* pc = npc */
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
add %l1, 0x4, %l2 /* npc = npc+4 */
- st %l1, [%sp + REGWIN_SZ + PT_PC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
b ret_trap_entry
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
1:
/* System call failure, set Carry condition code.
* Also, get abs(errno) to return to the process.
*/
sub %g0, %o0, %o0
or %g3, %g2, %g3
- st %o0, [%sp + REGWIN_SZ + PT_I0]
+ st %o0, [%sp + STACKFRAME_SZ + PT_I0]
mov 1, %l6
- st %g3, [%sp + REGWIN_SZ + PT_PSR]
+ st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
bne linux_syscall_trace2
- ld [%sp + REGWIN_SZ + PT_NPC], %l1 /* pc = npc */
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
add %l1, 0x4, %l2 /* npc = npc+4 */
- st %l1, [%sp + REGWIN_SZ + PT_PC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
b ret_trap_entry
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
linux_syscall_trace2:
call C_LABEL(syscall_trace)
add %l1, 0x4, %l2 /* npc = npc+4 */
- st %l1, [%sp + REGWIN_SZ + PT_PC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
b ret_trap_entry
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
/*
@@ -1581,19 +1589,19 @@
mov %i0, %l5
call C_LABEL(do_solaris_syscall)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
- st %o0, [%sp + REGWIN_SZ + PT_I0]
+ st %o0, [%sp + STACKFRAME_SZ + PT_I0]
set PSR_C, %g2
cmp %o0, -ENOIOCTLCMD
bgeu 1f
- ld [%sp + REGWIN_SZ + PT_PSR], %g3
+ ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
/* System call success, clear Carry condition code. */
andn %g3, %g2, %g3
clr %l6
b 2f
- st %g3, [%sp + REGWIN_SZ + PT_PSR]
+ st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
1:
/* System call failure, set Carry condition code.
@@ -1601,9 +1609,9 @@
*/
sub %g0, %o0, %o0
mov 1, %l6
- st %o0, [%sp + REGWIN_SZ + PT_I0]
+ st %o0, [%sp + STACKFRAME_SZ + PT_I0]
or %g3, %g2, %g3
- st %g3, [%sp + REGWIN_SZ + PT_PSR]
+ st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
/* Advance the pc and npc over the trap instruction.
* If the npc is unaligned (has a 1 in the lower byte), it means
@@ -1612,19 +1620,19 @@
* nPC (setcontext).
*/
2:
- ld [%sp + REGWIN_SZ + PT_NPC], %l1 /* pc = npc */
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
andcc %l1, 1, %g0
bne 1f
add %l1, 0x4, %l2 /* npc = npc+4 */
- st %l1, [%sp + REGWIN_SZ + PT_PC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
b ret_trap_entry
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
/* kernel knows what it is doing, fixup npc and continue */
1:
sub %l1, 1, %l1
b ret_trap_entry
- st %l1, [%sp + REGWIN_SZ + PT_NPC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_NPC]
#ifndef CONFIG_SUNOS_EMUL
.align 4
@@ -1637,7 +1645,7 @@
nop
mov %i0, %l5
call C_LABEL(do_sunos_syscall)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
#endif
/* {net, open}bsd system calls enter here... */
@@ -1674,17 +1682,17 @@
call %l7
mov %i5, %o5
- st %o0, [%sp + REGWIN_SZ + PT_I0]
+ st %o0, [%sp + STACKFRAME_SZ + PT_I0]
set PSR_C, %g2
cmp %o0, -ENOIOCTLCMD
bgeu 1f
- ld [%sp + REGWIN_SZ + PT_PSR], %g3
+ ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
/* System call success, clear Carry condition code. */
andn %g3, %g2, %g3
clr %l6
b 2f
- st %g3, [%sp + REGWIN_SZ + PT_PSR]
+ st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
1:
/* System call failure, set Carry condition code.
@@ -1698,17 +1706,17 @@
ld [%o3 + %o0], %o0
#endif
mov 1, %l6
- st %o0, [%sp + REGWIN_SZ + PT_I0]
+ st %o0, [%sp + STACKFRAME_SZ + PT_I0]
or %g3, %g2, %g3
- st %g3, [%sp + REGWIN_SZ + PT_PSR]
+ st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
/* Advance the pc and npc over the trap instruction. */
2:
- ld [%sp + REGWIN_SZ + PT_NPC], %l1 /* pc = npc */
+ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
add %l1, 0x4, %l2 /* npc = npc+4 */
- st %l1, [%sp + REGWIN_SZ + PT_PC]
+ st %l1, [%sp + STACKFRAME_SZ + PT_PC]
b ret_trap_entry
- st %l2, [%sp + REGWIN_SZ + PT_NPC]
+ st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
/* Saving and restoring the FPU state is best done from lowlevel code.
*
@@ -1794,13 +1802,23 @@
retl
nop
+ .globl C_LABEL(ndelay)
+C_LABEL(ndelay):
+ save %sp, -STACKFRAME_SZ, %sp
+ mov %i0, %o0
+ call .umul
+ mov 5, %o1
+ ba delay_continue
+ nop
+
.globl C_LABEL(udelay)
C_LABEL(udelay):
- save %sp, -REGWIN_SZ, %sp
+ save %sp, -STACKFRAME_SZ, %sp
mov %i0, %o0
sethi %hi(0x10c6), %o1
call .umul
or %o1, %lo(0x10c6), %o1
+delay_continue:
#ifndef CONFIG_SMP
sethi %hi(C_LABEL(loops_per_jiffy)), %o3
call .umul
@@ -1832,9 +1850,9 @@
wr %l0, PSR_ET, %psr
WRITE_PAUSE
- st %i0, [%sp + REGWIN_SZ + PT_G0] ! for restarting syscalls
+ st %i0, [%sp + STACKFRAME_SZ + PT_G0] ! for restarting syscalls
call C_LABEL(sparc_breakpoint)
- add %sp, REGWIN_SZ, %o0
+ add %sp, STACKFRAME_SZ, %o0
RESTORE_ALL
@@ -1928,7 +1946,7 @@
WRITE_PAUSE
call C_LABEL(pcic_nmi)
- add %sp, REGWIN_SZ, %o1 ! struct pt_regs *regs
+ add %sp, STACKFRAME_SZ, %o1 ! struct pt_regs *regs
RESTORE_ALL
.globl C_LABEL(pcic_nmi_trap_patch)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)