Commit 35dca6a2 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by David S. Miller

[SPARC]: Colin Gibbs gcc-3.x support.

parent 5ac8451a
This diff is collapsed.
...@@ -88,7 +88,7 @@ trap_setup: ...@@ -88,7 +88,7 @@ trap_setup:
/* From kernel, allocate more kernel stack and /* From kernel, allocate more kernel stack and
* build a pt_regs trap frame. * build a pt_regs trap frame.
*/ */
sub %fp, (REGWIN_SZ + TRACEREG_SZ), %t_kstack sub %fp, (STACKFRAME_SZ + TRACEREG_SZ), %t_kstack
STORE_PT_ALL(t_kstack, t_psr, t_pc, t_npc, g2) STORE_PT_ALL(t_kstack, t_psr, t_pc, t_npc, g2)
/* See if we are in the trap window. */ /* See if we are in the trap window. */
...@@ -129,7 +129,7 @@ tsetup_patch2: ...@@ -129,7 +129,7 @@ tsetup_patch2:
jmpl %t_retpc + 0x8, %g0 ! return to caller jmpl %t_retpc + 0x8, %g0 ! return to caller
mov %t_kstack, %sp ! and onto new kernel stack mov %t_kstack, %sp ! and onto new kernel stack
#define STACK_OFFSET (THREAD_SIZE - (TRACEREG_SZ + REGWIN_SZ)) #define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - STACKFRAME_SZ)
trap_setup_from_user: trap_setup_from_user:
/* We can't use %curptr yet. */ /* We can't use %curptr yet. */
......
...@@ -1012,7 +1012,7 @@ sun4c_continue_boot: ...@@ -1012,7 +1012,7 @@ sun4c_continue_boot:
/* I want a kernel stack NOW! */ /* I want a kernel stack NOW! */
set C_LABEL(init_thread_union), %g1 set C_LABEL(init_thread_union), %g1
set (THREAD_SIZE - REGWIN_SZ), %g2 set (THREAD_SIZE - STACKFRAME_SZ), %g2
add %g1, %g2, %sp add %g1, %g2, %sp
mov 0, %fp /* And for good luck */ mov 0, %fp /* And for good luck */
......
...@@ -377,60 +377,12 @@ void flush_thread(void) ...@@ -377,60 +377,12 @@ void flush_thread(void)
current->thread.flags &= ~SPARC_FLAG_KTHREAD; current->thread.flags &= ~SPARC_FLAG_KTHREAD;
/* We must fixup kregs as well. */ /* We must fixup kregs as well. */
/* XXX This was not fixed for ti for a while, worked. Unused? */
current->thread.kregs = (struct pt_regs *) current->thread.kregs = (struct pt_regs *)
(((unsigned long)current) + ((char *)current->thread_info + (THREAD_SIZE - TRACEREG_SZ));
(THREAD_SIZE - TRACEREG_SZ));
} }
} }
static __inline__ void copy_regs(struct pt_regs *dst, struct pt_regs *src)
{
__asm__ __volatile__("ldd\t[%1 + 0x00], %%g2\n\t"
"ldd\t[%1 + 0x08], %%g4\n\t"
"ldd\t[%1 + 0x10], %%o4\n\t"
"std\t%%g2, [%0 + 0x00]\n\t"
"std\t%%g4, [%0 + 0x08]\n\t"
"std\t%%o4, [%0 + 0x10]\n\t"
"ldd\t[%1 + 0x18], %%g2\n\t"
"ldd\t[%1 + 0x20], %%g4\n\t"
"ldd\t[%1 + 0x28], %%o4\n\t"
"std\t%%g2, [%0 + 0x18]\n\t"
"std\t%%g4, [%0 + 0x20]\n\t"
"std\t%%o4, [%0 + 0x28]\n\t"
"ldd\t[%1 + 0x30], %%g2\n\t"
"ldd\t[%1 + 0x38], %%g4\n\t"
"ldd\t[%1 + 0x40], %%o4\n\t"
"std\t%%g2, [%0 + 0x30]\n\t"
"std\t%%g4, [%0 + 0x38]\n\t"
"ldd\t[%1 + 0x48], %%g2\n\t"
"std\t%%o4, [%0 + 0x40]\n\t"
"std\t%%g2, [%0 + 0x48]\n\t" : :
"r" (dst), "r" (src) :
"g2", "g3", "g4", "g5", "o4", "o5");
}
static __inline__ void copy_regwin(struct reg_window *dst, struct reg_window *src)
{
__asm__ __volatile__("ldd\t[%1 + 0x00], %%g2\n\t"
"ldd\t[%1 + 0x08], %%g4\n\t"
"ldd\t[%1 + 0x10], %%o4\n\t"
"std\t%%g2, [%0 + 0x00]\n\t"
"std\t%%g4, [%0 + 0x08]\n\t"
"std\t%%o4, [%0 + 0x10]\n\t"
"ldd\t[%1 + 0x18], %%g2\n\t"
"ldd\t[%1 + 0x20], %%g4\n\t"
"ldd\t[%1 + 0x28], %%o4\n\t"
"std\t%%g2, [%0 + 0x18]\n\t"
"std\t%%g4, [%0 + 0x20]\n\t"
"std\t%%o4, [%0 + 0x28]\n\t"
"ldd\t[%1 + 0x30], %%g2\n\t"
"ldd\t[%1 + 0x38], %%g4\n\t"
"std\t%%g2, [%0 + 0x30]\n\t"
"std\t%%g4, [%0 + 0x38]\n\t" : :
"r" (dst), "r" (src) :
"g2", "g3", "g4", "g5", "o4", "o5");
}
static __inline__ struct sparc_stackf * static __inline__ struct sparc_stackf *
clone_stackframe(struct sparc_stackf *dst, struct sparc_stackf *src) clone_stackframe(struct sparc_stackf *dst, struct sparc_stackf *src)
{ {
...@@ -495,8 +447,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -495,8 +447,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
{ {
struct thread_info *ti = p->thread_info; struct thread_info *ti = p->thread_info;
struct pt_regs *childregs; struct pt_regs *childregs;
struct reg_window *new_stack; char *new_stack;
unsigned long stack_offset;
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
if(last_task_used_math == current) { if(last_task_used_math == current) {
...@@ -513,15 +464,18 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -513,15 +464,18 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
p->set_child_tid = p->clear_child_tid = NULL; p->set_child_tid = p->clear_child_tid = NULL;
/* Calculate offset to stack_frame & pt_regs */ /*
stack_offset = THREAD_SIZE - TRACEREG_SZ; * p->thread_info new_stack childregs
* ! ! ! {if(PSR_PS) }
if(regs->psr & PSR_PS) * V V (stk.fr.) V (pt_regs) { (stk.fr.) }
stack_offset -= REGWIN_SZ; * +----- - - - - - ------+===========+============={+==========}+
childregs = ((struct pt_regs *) (((unsigned long)ti) + stack_offset)); */
copy_regs(childregs, regs); new_stack = (char*)ti + THREAD_SIZE;
new_stack = (((struct reg_window *) childregs) - 1); if (regs->psr & PSR_PS)
copy_regwin(new_stack, (((struct reg_window *) regs) - 1)); new_stack -= STACKFRAME_SZ;
new_stack -= STACKFRAME_SZ + TRACEREG_SZ;
memcpy(new_stack, (char *)regs - STACKFRAME_SZ, STACKFRAME_SZ + TRACEREG_SZ);
childregs = (struct pt_regs *) (new_stack + STACKFRAME_SZ);
/* /*
* A new process must start with interrupts closed in 2.5, * A new process must start with interrupts closed in 2.5,
...@@ -542,14 +496,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -542,14 +496,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
extern struct pt_regs fake_swapper_regs; extern struct pt_regs fake_swapper_regs;
p->thread.kregs = &fake_swapper_regs; p->thread.kregs = &fake_swapper_regs;
new_stack = (struct reg_window *) new_stack += STACKFRAME_SZ + TRACEREG_SZ;
((((unsigned long)ti) + (THREAD_SIZE)) - REGWIN_SZ);
childregs->u_regs[UREG_FP] = (unsigned long) new_stack; childregs->u_regs[UREG_FP] = (unsigned long) new_stack;
p->thread.flags |= SPARC_FLAG_KTHREAD; p->thread.flags |= SPARC_FLAG_KTHREAD;
p->thread.current_ds = KERNEL_DS; p->thread.current_ds = KERNEL_DS;
memcpy((void *)new_stack, memcpy(new_stack, (void *)regs->u_regs[UREG_FP], STACKFRAME_SZ);
(void *)regs->u_regs[UREG_FP],
sizeof(struct reg_window));
childregs->u_regs[UREG_G6] = (unsigned long) ti; childregs->u_regs[UREG_G6] = (unsigned long) ti;
} else { } else {
p->thread.kregs = childregs; p->thread.kregs = childregs;
......
...@@ -72,16 +72,16 @@ C_LABEL(ret_trap_lockless_ipi): ...@@ -72,16 +72,16 @@ C_LABEL(ret_trap_lockless_ipi):
signal_p: signal_p:
andcc %g2, (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING), %g0 andcc %g2, (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING), %g0
bz,a ret_trap_continue bz,a ret_trap_continue
ld [%sp + REGWIN_SZ + PT_PSR], %t_psr ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
clr %o0 clr %o0
mov %l5, %o2 mov %l5, %o2
mov %l6, %o3 mov %l6, %o3
call C_LABEL(do_signal) call C_LABEL(do_signal)
add %sp, REGWIN_SZ, %o1 ! pt_regs ptr add %sp, STACKFRAME_SZ, %o1 ! pt_regs ptr
/* Fall through. */ /* Fall through. */
ld [%sp + REGWIN_SZ + PT_PSR], %t_psr ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
clr %l6 clr %l6
ret_trap_continue: ret_trap_continue:
wr %t_psr, 0x0, %psr wr %t_psr, 0x0, %psr
...@@ -98,7 +98,7 @@ ret_trap_continue: ...@@ -98,7 +98,7 @@ ret_trap_continue:
mov 1, %o1 mov 1, %o1
call C_LABEL(try_to_clear_window_buffer) call C_LABEL(try_to_clear_window_buffer)
add %sp, REGWIN_SZ, %o0 add %sp, STACKFRAME_SZ, %o0
b signal_p b signal_p
ld [%curptr + TI_FLAGS], %g2 ld [%curptr + TI_FLAGS], %g2
...@@ -145,7 +145,7 @@ ret_trap_userwins_ok: ...@@ -145,7 +145,7 @@ ret_trap_userwins_ok:
nop nop
b ret_trap_unaligned_pc b ret_trap_unaligned_pc
add %sp, REGWIN_SZ, %o0 add %sp, STACKFRAME_SZ, %o0
1: 1:
LOAD_PT_YREG(sp, g1) LOAD_PT_YREG(sp, g1)
...@@ -158,9 +158,9 @@ ret_trap_userwins_ok: ...@@ -158,9 +158,9 @@ ret_trap_userwins_ok:
rett %t_npc rett %t_npc
ret_trap_unaligned_pc: ret_trap_unaligned_pc:
ld [%sp + REGWIN_SZ + PT_PC], %o1 ld [%sp + STACKFRAME_SZ + PT_PC], %o1
ld [%sp + REGWIN_SZ + PT_NPC], %o2 ld [%sp + STACKFRAME_SZ + PT_NPC], %o2
ld [%sp + REGWIN_SZ + PT_PSR], %o3 ld [%sp + STACKFRAME_SZ + PT_PSR], %o3
wr %t_wim, 0x0, %wim ! or else... wr %t_wim, 0x0, %wim ! or else...
...@@ -218,7 +218,7 @@ ret_trap_user_stack_is_bolixed: ...@@ -218,7 +218,7 @@ ret_trap_user_stack_is_bolixed:
WRITE_PAUSE WRITE_PAUSE
call C_LABEL(window_ret_fault) call C_LABEL(window_ret_fault)
add %sp, REGWIN_SZ, %o0 add %sp, STACKFRAME_SZ, %o0
b signal_p b signal_p
ld [%curptr + TI_FLAGS], %g2 ld [%curptr + TI_FLAGS], %g2
......
...@@ -753,7 +753,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc, ...@@ -753,7 +753,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
synchronize_user_stack(); synchronize_user_stack();
sfp = (svr4_signal_frame_t __user *) sfp = (svr4_signal_frame_t __user *)
get_sigframe(sa, regs, SVR4_SF_ALIGNED + REGWIN_SZ); get_sigframe(sa, regs, SVR4_SF_ALIGNED + sizeof(struct reg_window));
if (invalid_frame_pointer(sfp, sizeof(*sfp))) if (invalid_frame_pointer(sfp, sizeof(*sfp)))
goto sigill_and_return; goto sigill_and_return;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
.align 4 .align 4
/* When calling ret_sys_call, %o0 should contain the same /* When calling ret_sys_call, %o0 should contain the same
* value as in [%sp + REGWIN_SZ + PT_I0] */ * value as in [%sp + STACKFRAME_SZ + PT_I0] */
/* SunOS getpid() returns pid in %o0 and ppid in %o1 */ /* SunOS getpid() returns pid in %o0 and ppid in %o1 */
.globl C_LABEL(sunos_getpid) .globl C_LABEL(sunos_getpid)
...@@ -25,10 +25,10 @@ C_LABEL(sunos_getpid): ...@@ -25,10 +25,10 @@ C_LABEL(sunos_getpid):
nop nop
call C_LABEL(sys_getpid) call C_LABEL(sys_getpid)
st %o0, [%sp + REGWIN_SZ + PT_I1] st %o0, [%sp + STACKFRAME_SZ + PT_I1]
b C_LABEL(ret_sys_call) b C_LABEL(ret_sys_call)
st %o0, [%sp + REGWIN_SZ + PT_I0] st %o0, [%sp + STACKFRAME_SZ + PT_I0]
/* SunOS getuid() returns uid in %o0 and euid in %o1 */ /* SunOS getuid() returns uid in %o0 and euid in %o1 */
.globl C_LABEL(sunos_getuid) .globl C_LABEL(sunos_getuid)
...@@ -37,10 +37,10 @@ C_LABEL(sunos_getuid): ...@@ -37,10 +37,10 @@ C_LABEL(sunos_getuid):
nop nop
call C_LABEL(sys_getuid16) call C_LABEL(sys_getuid16)
st %o0, [%sp + REGWIN_SZ + PT_I1] st %o0, [%sp + STACKFRAME_SZ + PT_I1]
b C_LABEL(ret_sys_call) b C_LABEL(ret_sys_call)
st %o0, [%sp + REGWIN_SZ + PT_I0] st %o0, [%sp + STACKFRAME_SZ + PT_I0]
/* SunOS getgid() returns gid in %o0 and egid in %o1 */ /* SunOS getgid() returns gid in %o0 and egid in %o1 */
.globl C_LABEL(sunos_getgid) .globl C_LABEL(sunos_getgid)
...@@ -49,20 +49,20 @@ C_LABEL(sunos_getgid): ...@@ -49,20 +49,20 @@ C_LABEL(sunos_getgid):
nop nop
call C_LABEL(sys_getgid16) call C_LABEL(sys_getgid16)
st %o0, [%sp + REGWIN_SZ + PT_I1] st %o0, [%sp + STACKFRAME_SZ + PT_I1]
b C_LABEL(ret_sys_call) b C_LABEL(ret_sys_call)
st %o0, [%sp + REGWIN_SZ + PT_I0] st %o0, [%sp + STACKFRAME_SZ + PT_I0]
/* SunOS's execv() call only specifies the argv argument, the /* SunOS's execv() call only specifies the argv argument, the
* environment settings are the same as the calling processes. * environment settings are the same as the calling processes.
*/ */
.globl C_LABEL(sunos_execv) .globl C_LABEL(sunos_execv)
C_LABEL(sunos_execv): C_LABEL(sunos_execv):
st %g0, [%sp + REGWIN_SZ + PT_I2] st %g0, [%sp + STACKFRAME_SZ + PT_I2]
call C_LABEL(sparc_execve) call C_LABEL(sparc_execve)
add %sp, REGWIN_SZ, %o0 add %sp, STACKFRAME_SZ, %o0
b C_LABEL(ret_sys_call) b C_LABEL(ret_sys_call)
ld [%sp + REGWIN_SZ + PT_I0], %o0 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
...@@ -63,8 +63,8 @@ cpu3_startup: ...@@ -63,8 +63,8 @@ cpu3_startup:
and %g4, 0xc, %g4 and %g4, 0xc, %g4
ld [%g5 + %g4], %g6 ld [%g5 + %g4], %g6
sethi %hi(THREAD_SIZE - REGWIN_SZ), %sp sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
or %sp, %lo(THREAD_SIZE - REGWIN_SZ), %sp or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
add %g6, %sp, %sp add %g6, %sp, %sp
/* Turn on traps (PSR_ET). */ /* Turn on traps (PSR_ET). */
...@@ -142,8 +142,8 @@ C_LABEL(sun4d_cpu_startup): ...@@ -142,8 +142,8 @@ C_LABEL(sun4d_cpu_startup):
srl %g3, 1, %g4 srl %g3, 1, %g4
ld [%g5 + %g4], %g6 ld [%g5 + %g4], %g6
sethi %hi(THREAD_SIZE - REGWIN_SZ), %sp sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
or %sp, %lo(THREAD_SIZE - REGWIN_SZ), %sp or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
add %g6, %sp, %sp add %g6, %sp, %sp
/* Turn on traps (PSR_ET). */ /* Turn on traps (PSR_ET). */
......
...@@ -120,7 +120,7 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who) ...@@ -120,7 +120,7 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who)
unsigned long sp = tp->rwbuf_stkptrs[window]; unsigned long sp = tp->rwbuf_stkptrs[window];
if((sp & 7) || if((sp & 7) ||
copy_to_user((char *) sp, &tp->reg_window[window], REGWIN_SZ)) copy_to_user((char *) sp, &tp->reg_window[window], sizeof(struct reg_window)))
do_exit(SIGILL); do_exit(SIGILL);
} }
tp->w_saved = 0; tp->w_saved = 0;
......
...@@ -238,7 +238,7 @@ spwin_user_stack_is_bolixed: ...@@ -238,7 +238,7 @@ spwin_user_stack_is_bolixed:
spnwin_patch3: and %twin_tmp, 0xff, %twin_tmp ! patched on 7win Sparcs spnwin_patch3: and %twin_tmp, 0xff, %twin_tmp ! patched on 7win Sparcs
st %twin_tmp, [%curptr + TI_UWINMASK] st %twin_tmp, [%curptr + TI_UWINMASK]
#define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - REGWIN_SZ) #define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - STACKFRAME_SZ)
sethi %hi(STACK_OFFSET), %sp sethi %hi(STACK_OFFSET), %sp
or %sp, %lo(STACK_OFFSET), %sp or %sp, %lo(STACK_OFFSET), %sp
......
...@@ -140,7 +140,7 @@ fwin_from_user: ...@@ -140,7 +140,7 @@ fwin_from_user:
C_LABEL(fwin_mmu_patchme): b C_LABEL(sun4c_fwin_stackchk) C_LABEL(fwin_mmu_patchme): b C_LABEL(sun4c_fwin_stackchk)
andcc %sp, 0x7, %g0 andcc %sp, 0x7, %g0
#define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - REGWIN_SZ) #define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - STACKFRAME_SZ)
fwin_user_stack_is_bolixed: fwin_user_stack_is_bolixed:
/* LOCATION: Window 'W' */ /* LOCATION: Window 'W' */
......
...@@ -52,43 +52,43 @@ struct kgdb_frame { ...@@ -52,43 +52,43 @@ struct kgdb_frame {
#define KGDB_NPC 0x114 #define KGDB_NPC 0x114
#define SAVE_KGDB_GLOBALS(reg) \ #define SAVE_KGDB_GLOBALS(reg) \
std %g0, [%reg + REGWIN_SZ + KGDB_G0]; \ std %g0, [%reg + STACKFRAME_SZ + KGDB_G0]; \
std %g2, [%reg + REGWIN_SZ + KGDB_G2]; \ std %g2, [%reg + STACKFRAME_SZ + KGDB_G2]; \
std %g4, [%reg + REGWIN_SZ + KGDB_G4]; \ std %g4, [%reg + STACKFRAME_SZ + KGDB_G4]; \
std %g6, [%reg + REGWIN_SZ + KGDB_G6]; std %g6, [%reg + STACKFRAME_SZ + KGDB_G6];
#define SAVE_KGDB_INS(reg) \ #define SAVE_KGDB_INS(reg) \
std %i0, [%reg + REGWIN_SZ + KGDB_I0]; \ std %i0, [%reg + STACKFRAME_SZ + KGDB_I0]; \
std %i2, [%reg + REGWIN_SZ + KGDB_I2]; \ std %i2, [%reg + STACKFRAME_SZ + KGDB_I2]; \
std %i4, [%reg + REGWIN_SZ + KGDB_I4]; \ std %i4, [%reg + STACKFRAME_SZ + KGDB_I4]; \
std %i6, [%reg + REGWIN_SZ + KGDB_I6]; std %i6, [%reg + STACKFRAME_SZ + KGDB_I6];
#define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ #define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \
st %reg_y, [%reg + REGWIN_SZ + KGDB_Y]; \ st %reg_y, [%reg + STACKFRAME_SZ + KGDB_Y]; \
st %reg_psr, [%reg + REGWIN_SZ + KGDB_PSR]; \ st %reg_psr, [%reg + STACKFRAME_SZ + KGDB_PSR]; \
st %reg_wim, [%reg + REGWIN_SZ + KGDB_WIM]; \ st %reg_wim, [%reg + STACKFRAME_SZ + KGDB_WIM]; \
st %reg_tbr, [%reg + REGWIN_SZ + KGDB_TBR]; \ st %reg_tbr, [%reg + STACKFRAME_SZ + KGDB_TBR]; \
st %reg_pc, [%reg + REGWIN_SZ + KGDB_PC]; \ st %reg_pc, [%reg + STACKFRAME_SZ + KGDB_PC]; \
st %reg_npc, [%reg + REGWIN_SZ + KGDB_NPC]; st %reg_npc, [%reg + STACKFRAME_SZ + KGDB_NPC];
#define LOAD_KGDB_GLOBALS(reg) \ #define LOAD_KGDB_GLOBALS(reg) \
ld [%reg + REGWIN_SZ + KGDB_G1], %g1; \ ld [%reg + STACKFRAME_SZ + KGDB_G1], %g1; \
ldd [%reg + REGWIN_SZ + KGDB_G2], %g2; \ ldd [%reg + STACKFRAME_SZ + KGDB_G2], %g2; \
ldd [%reg + REGWIN_SZ + KGDB_G4], %g4; \ ldd [%reg + STACKFRAME_SZ + KGDB_G4], %g4; \
ldd [%reg + REGWIN_SZ + KGDB_G6], %g6; ldd [%reg + STACKFRAME_SZ + KGDB_G6], %g6;
#define LOAD_KGDB_INS(reg) \ #define LOAD_KGDB_INS(reg) \
ldd [%reg + REGWIN_SZ + KGDB_I0], %i0; \ ldd [%reg + STACKFRAME_SZ + KGDB_I0], %i0; \
ldd [%reg + REGWIN_SZ + KGDB_I2], %i2; \ ldd [%reg + STACKFRAME_SZ + KGDB_I2], %i2; \
ldd [%reg + REGWIN_SZ + KGDB_I4], %i4; \ ldd [%reg + STACKFRAME_SZ + KGDB_I4], %i4; \
ldd [%reg + REGWIN_SZ + KGDB_I6], %i6; ldd [%reg + STACKFRAME_SZ + KGDB_I6], %i6;
#define LOAD_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ #define LOAD_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \
ld [%reg + REGWIN_SZ + KGDB_Y], %reg_y; \ ld [%reg + STACKFRAME_SZ + KGDB_Y], %reg_y; \
ld [%reg + REGWIN_SZ + KGDB_PSR], %reg_psr; \ ld [%reg + STACKFRAME_SZ + KGDB_PSR], %reg_psr; \
ld [%reg + REGWIN_SZ + KGDB_WIM], %reg_wim; \ ld [%reg + STACKFRAME_SZ + KGDB_WIM], %reg_wim; \
ld [%reg + REGWIN_SZ + KGDB_TBR], %reg_tbr; \ ld [%reg + STACKFRAME_SZ + KGDB_TBR], %reg_tbr; \
ld [%reg + REGWIN_SZ + KGDB_PC], %reg_pc; \ ld [%reg + STACKFRAME_SZ + KGDB_PC], %reg_pc; \
ld [%reg + REGWIN_SZ + KGDB_NPC], %reg_npc; ld [%reg + STACKFRAME_SZ + KGDB_NPC], %reg_npc;
#endif /* !(_SPARC_KGDB_H) */ #endif /* !(_SPARC_KGDB_H) */
...@@ -131,7 +131,7 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, ...@@ -131,7 +131,7 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc,
"std\t%%g0, [%0 + %3 + 0x30]\n\t" "std\t%%g0, [%0 + %3 + 0x30]\n\t"
"st\t%1, [%0 + %3 + 0x38]\n\t" "st\t%1, [%0 + %3 + 0x38]\n\t"
"st\t%%g0, [%0 + %3 + 0x3c]" "st\t%%g0, [%0 + %3 + 0x3c]"
: : "r" (regs), "r" (sp - REGWIN_SZ), "r" (zero), : : "r" (regs), "r" (sp - sizeof(struct reg_window)), "r" (zero),
"i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])));
} }
......
...@@ -58,7 +58,6 @@ struct sparc_stackf { ...@@ -58,7 +58,6 @@ struct sparc_stackf {
#define TRACEREG_SZ sizeof(struct pt_regs) #define TRACEREG_SZ sizeof(struct pt_regs)
#define STACKFRAME_SZ sizeof(struct sparc_stackf) #define STACKFRAME_SZ sizeof(struct sparc_stackf)
#define REGWIN_SZ sizeof(struct reg_window)
#ifdef __KERNEL__ #ifdef __KERNEL__
#define user_mode(regs) (!((regs)->psr & PSR_PS)) #define user_mode(regs) (!((regs)->psr & PSR_PS))
...@@ -70,7 +69,6 @@ extern void show_regs(struct pt_regs *); ...@@ -70,7 +69,6 @@ extern void show_regs(struct pt_regs *);
/* For assembly code. */ /* For assembly code. */
#define TRACEREG_SZ 0x50 #define TRACEREG_SZ 0x50
#define STACKFRAME_SZ 0x60 #define STACKFRAME_SZ 0x60
#define REGWIN_SZ 0x40
#endif #endif
/* /*
......
...@@ -11,14 +11,6 @@ ...@@ -11,14 +11,6 @@
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/psr.h> #include <asm/psr.h>
/* These are just handy. */
#define _SV save %sp, -REGWIN_SZ, %sp
#define _RS restore
#define FLUSH_ALL_KERNEL_WINDOWS \
_SV; _SV; _SV; _SV; _SV; _SV; _SV; \
_RS; _RS; _RS; _RS; _RS; _RS; _RS;
/* Store the register window onto the 8-byte aligned area starting /* Store the register window onto the 8-byte aligned area starting
* at %reg. It might be %sp, it might not, we don't care. * at %reg. It might be %sp, it might not, we don't care.
*/ */
...@@ -45,25 +37,25 @@ ...@@ -45,25 +37,25 @@
/* Loading and storing struct pt_reg trap frames. */ /* Loading and storing struct pt_reg trap frames. */
#define LOAD_PT_INS(base_reg) \ #define LOAD_PT_INS(base_reg) \
ldd [%base_reg + REGWIN_SZ + PT_I0], %i0; \ ldd [%base_reg + STACKFRAME_SZ + PT_I0], %i0; \
ldd [%base_reg + REGWIN_SZ + PT_I2], %i2; \ ldd [%base_reg + STACKFRAME_SZ + PT_I2], %i2; \
ldd [%base_reg + REGWIN_SZ + PT_I4], %i4; \ ldd [%base_reg + STACKFRAME_SZ + PT_I4], %i4; \
ldd [%base_reg + REGWIN_SZ + PT_I6], %i6; ldd [%base_reg + STACKFRAME_SZ + PT_I6], %i6;
#define LOAD_PT_GLOBALS(base_reg) \ #define LOAD_PT_GLOBALS(base_reg) \
ld [%base_reg + REGWIN_SZ + PT_G1], %g1; \ ld [%base_reg + STACKFRAME_SZ + PT_G1], %g1; \
ldd [%base_reg + REGWIN_SZ + PT_G2], %g2; \ ldd [%base_reg + STACKFRAME_SZ + PT_G2], %g2; \
ldd [%base_reg + REGWIN_SZ + PT_G4], %g4; \ ldd [%base_reg + STACKFRAME_SZ + PT_G4], %g4; \
ldd [%base_reg + REGWIN_SZ + PT_G6], %g6; ldd [%base_reg + STACKFRAME_SZ + PT_G6], %g6;
#define LOAD_PT_YREG(base_reg, scratch) \ #define LOAD_PT_YREG(base_reg, scratch) \
ld [%base_reg + REGWIN_SZ + PT_Y], %scratch; \ ld [%base_reg + STACKFRAME_SZ + PT_Y], %scratch; \
wr %scratch, 0x0, %y; wr %scratch, 0x0, %y;
#define LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \ #define LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \
ld [%base_reg + REGWIN_SZ + PT_PSR], %pt_psr; \ ld [%base_reg + STACKFRAME_SZ + PT_PSR], %pt_psr; \
ld [%base_reg + REGWIN_SZ + PT_PC], %pt_pc; \ ld [%base_reg + STACKFRAME_SZ + PT_PC], %pt_pc; \
ld [%base_reg + REGWIN_SZ + PT_NPC], %pt_npc; ld [%base_reg + STACKFRAME_SZ + PT_NPC], %pt_npc;
#define LOAD_PT_ALL(base_reg, pt_psr, pt_pc, pt_npc, scratch) \ #define LOAD_PT_ALL(base_reg, pt_psr, pt_pc, pt_npc, scratch) \
LOAD_PT_YREG(base_reg, scratch) \ LOAD_PT_YREG(base_reg, scratch) \
...@@ -72,25 +64,25 @@ ...@@ -72,25 +64,25 @@
LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc)
#define STORE_PT_INS(base_reg) \ #define STORE_PT_INS(base_reg) \
std %i0, [%base_reg + REGWIN_SZ + PT_I0]; \ std %i0, [%base_reg + STACKFRAME_SZ + PT_I0]; \
std %i2, [%base_reg + REGWIN_SZ + PT_I2]; \ std %i2, [%base_reg + STACKFRAME_SZ + PT_I2]; \
std %i4, [%base_reg + REGWIN_SZ + PT_I4]; \ std %i4, [%base_reg + STACKFRAME_SZ + PT_I4]; \
std %i6, [%base_reg + REGWIN_SZ + PT_I6]; std %i6, [%base_reg + STACKFRAME_SZ + PT_I6];
#define STORE_PT_GLOBALS(base_reg) \ #define STORE_PT_GLOBALS(base_reg) \
st %g1, [%base_reg + REGWIN_SZ + PT_G1]; \ st %g1, [%base_reg + STACKFRAME_SZ + PT_G1]; \
std %g2, [%base_reg + REGWIN_SZ + PT_G2]; \ std %g2, [%base_reg + STACKFRAME_SZ + PT_G2]; \
std %g4, [%base_reg + REGWIN_SZ + PT_G4]; \ std %g4, [%base_reg + STACKFRAME_SZ + PT_G4]; \
std %g6, [%base_reg + REGWIN_SZ + PT_G6]; std %g6, [%base_reg + STACKFRAME_SZ + PT_G6];
#define STORE_PT_YREG(base_reg, scratch) \ #define STORE_PT_YREG(base_reg, scratch) \
rd %y, %scratch; \ rd %y, %scratch; \
st %scratch, [%base_reg + REGWIN_SZ + PT_Y]; st %scratch, [%base_reg + STACKFRAME_SZ + PT_Y];
#define STORE_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \ #define STORE_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \
st %pt_psr, [%base_reg + REGWIN_SZ + PT_PSR]; \ st %pt_psr, [%base_reg + STACKFRAME_SZ + PT_PSR]; \
st %pt_pc, [%base_reg + REGWIN_SZ + PT_PC]; \ st %pt_pc, [%base_reg + STACKFRAME_SZ + PT_PC]; \
st %pt_npc, [%base_reg + REGWIN_SZ + PT_NPC]; st %pt_npc, [%base_reg + STACKFRAME_SZ + PT_NPC];
#define STORE_PT_ALL(base_reg, reg_psr, reg_pc, reg_npc, g_scratch) \ #define STORE_PT_ALL(base_reg, reg_psr, reg_pc, reg_npc, g_scratch) \
STORE_PT_PRIV(base_reg, reg_psr, reg_pc, reg_npc) \ STORE_PT_PRIV(base_reg, reg_psr, reg_pc, reg_npc) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment