Commit ffc422b7 authored by Paul Mackerras's avatar Paul Mackerras

PPC32: miscellanous small fixes.

Rename print_backtrace to show_stack and improve it, remove the
#if 0 around set_fpexc mode and add get_fpexc_mode, add the
__NR_security define and reserve syscall 225 for Tux.
parent 8712e9ef
...@@ -1297,6 +1297,8 @@ _GLOBAL(sys_call_table) ...@@ -1297,6 +1297,8 @@ _GLOBAL(sys_call_table)
.long sys_sched_setaffinity .long sys_sched_setaffinity
.long sys_sched_getaffinity .long sys_sched_getaffinity
.long sys_security .long sys_security
.long sys_ni_syscall /* 225 - reserved for Tux */
.rept NR_syscalls-(.-sys_call_table)/4 .rept NR_syscalls-(.-sys_call_table)/4
.long sys_ni_syscall .long sys_ni_syscall
.endr .endr
...@@ -149,16 +149,15 @@ struct hw_interrupt_type open_pic_ipi = { ...@@ -149,16 +149,15 @@ struct hw_interrupt_type open_pic_ipi = {
* data has probably been corrupted and we're going to panic or deadlock later * data has probably been corrupted and we're going to panic or deadlock later
* anyway --Troy * anyway --Troy
*/ */
extern unsigned long* _get_SP(void);
#define check_arg_irq(irq) \ #define check_arg_irq(irq) \
if (irq < open_pic_irq_offset || irq >= NumSources+open_pic_irq_offset \ if (irq < open_pic_irq_offset || irq >= NumSources+open_pic_irq_offset \
|| ISR[irq - open_pic_irq_offset] == 0) { \ || ISR[irq - open_pic_irq_offset] == 0) { \
printk("open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \ printk("open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \
print_backtrace(_get_SP()); } show_stack(NULL); }
#define check_arg_cpu(cpu) \ #define check_arg_cpu(cpu) \
if (cpu < 0 || cpu >= NumProcessors){ \ if (cpu < 0 || cpu >= NumProcessors){ \
printk("open_pic.c:%d: illegal cpu %d\n", __LINE__, cpu); \ printk("open_pic.c:%d: illegal cpu %d\n", __LINE__, cpu); \
print_backtrace(_get_SP()); } show_stack(NULL); }
#else #else
#define check_arg_ipi(ipi) do {} while (0) #define check_arg_ipi(ipi) do {} while (0)
#define check_arg_timer(timer) do {} while (0) #define check_arg_timer(timer) do {} while (0)
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/hardirq.h>
#ifdef CONFIG_PPC_ISERIES #ifdef CONFIG_PPC_ISERIES
#include <asm/iSeries/Paca.h> #include <asm/iSeries/Paca.h>
#endif #endif
...@@ -293,7 +294,7 @@ void show_regs(struct pt_regs * regs) ...@@ -293,7 +294,7 @@ void show_regs(struct pt_regs * regs)
break; break;
} }
printk("\n"); printk("\n");
print_backtrace((unsigned long *)regs->gpr[1]); show_stack((unsigned long *)regs->gpr[1]);
} }
void exit_thread(void) void exit_thread(void)
...@@ -418,7 +419,6 @@ void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp) ...@@ -418,7 +419,6 @@ void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp)
#endif /* CONFIG_ALTIVEC */ #endif /* CONFIG_ALTIVEC */
} }
#if 0
int set_fpexc_mode(struct task_struct *tsk, unsigned int val) int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
{ {
struct pt_regs *regs = tsk->thread.regs; struct pt_regs *regs = tsk->thread.regs;
...@@ -431,7 +431,14 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val) ...@@ -431,7 +431,14 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
| tsk->thread.fpexc_mode; | tsk->thread.fpexc_mode;
return 0; return 0;
} }
#endif
int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
{
unsigned int val;
val = __unpack_fe01(tsk->thread.fpexc_mode);
return put_user(val, (unsigned int *) adr);
}
int sys_clone(int p1, int p2, int p3, int p4, int p5, int p6, int sys_clone(int p1, int p2, int p3, int p4, int p5, int p6,
struct pt_regs *regs) struct pt_regs *regs)
...@@ -486,20 +493,25 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, ...@@ -486,20 +493,25 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
} }
void void
print_backtrace(unsigned long *sp) show_stack(unsigned long *sp)
{ {
int cnt = 0; int cnt = 0;
unsigned long i; unsigned long i;
if (sp == NULL)
sp = (unsigned long *)_get_SP();
printk("Call backtrace: "); printk("Call backtrace: ");
while (sp) { for (;;) {
if (__get_user( i, &sp[1] )) if (__get_user(sp, (unsigned long **)sp))
break;
if (sp == NULL)
break;
if (__get_user(i, &sp[1]))
break; break;
if (cnt++ % 7 == 0) if (cnt++ % 7 == 0)
printk("\n"); printk("\n");
printk("%08lX ", i); printk("%08lX ", i);
if (cnt > 32) break; if (cnt > 32)
if (__get_user(sp, (unsigned long **)sp))
break; break;
} }
printk("\n"); printk("\n");
......
...@@ -196,10 +196,11 @@ ...@@ -196,10 +196,11 @@
#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ #define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */
#define SPRN_EAR 0x11A /* External Address Register */ #define SPRN_EAR 0x11A /* External Address Register */
#define SPRN_ESR 0x3D4 /* Exception Syndrome Register */ #define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
#define ESR_IMCP 0x80000000 /* Instr. Machine Check - Protection */ #define ESR_MCI 0x80000000 /* 405 Machine Check - Instruction */
#define ESR_IMCN 0x40000000 /* Instr. Machine Check - Non-config */ #define ESR_IMCP 0x80000000 /* 403 Inst. Mach. Check - Protection */
#define ESR_IMCB 0x20000000 /* Instr. Machine Check - Bus error */ #define ESR_IMCN 0x40000000 /* 403 Inst. Mach. Check - Non-config */
#define ESR_IMCT 0x10000000 /* Instr. Machine Check - Timeout */ #define ESR_IMCB 0x20000000 /* 403 Inst. Mach. Check - Bus error */
#define ESR_IMCT 0x10000000 /* 403 Inst. Mach. Check - Timeout */
#define ESR_PIL 0x08000000 /* Program Exception - Illegal */ #define ESR_PIL 0x08000000 /* Program Exception - Illegal */
#define ESR_PPR 0x04000000 /* Program Exception - Priveleged */ #define ESR_PPR 0x04000000 /* Program Exception - Priveleged */
#define ESR_PTR 0x02000000 /* Program Exception - Trap */ #define ESR_PTR 0x02000000 /* Program Exception - Trap */
...@@ -747,9 +748,10 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -747,9 +748,10 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0) #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
/* Get/set floating-point exception mode */ /* Get/set floating-point exception mode */
#define GET_FP_EXC_MODE(tsk) __unpack_fe01((tsk)->thread.fpexc_mode) #define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr))
#define SET_FP_EXC_MODE(tsk, val) set_fpexc_mode((tsk), (val)) #define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val))
extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr);
extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val); extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val);
static inline unsigned int __unpack_fe01(unsigned int msr_bits) static inline unsigned int __unpack_fe01(unsigned int msr_bits)
......
...@@ -231,6 +231,8 @@ ...@@ -231,6 +231,8 @@
#define __NR_futex 221 #define __NR_futex 221
#define __NR_sched_setaffinity 222 #define __NR_sched_setaffinity 222
#define __NR_sched_getaffinity 223 #define __NR_sched_getaffinity 223
#define __NR_security 224
#define __NR_tuxcall 225
#define __NR(n) #n #define __NR(n) #n
......
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