OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [ppc/] [kernel/] [traps.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/*
2
 *  linux/arch/ppc/kernel/traps.c
3
 *
4
 *  Copyright (C) 1995  Gary Thomas
5
 *  Adapted for PowerPC by Gary Thomas
6
 */
7
 
8
/*
9
 * This file handles the architecture-dependent parts of hardware exceptions
10
 */
11
 
12
#include <linux/errno.h>
13
#include <linux/sched.h>
14
#include <linux/kernel.h>
15
#include <linux/mm.h>
16
#include <linux/stddef.h>
17
#include <linux/unistd.h>
18
#include <linux/ptrace.h>
19
#include <linux/malloc.h>
20
#include <linux/ldt.h>
21
#include <linux/user.h>
22
#include <linux/a.out.h>
23
 
24
#include <asm/pgtable.h>
25
#include <asm/segment.h>
26
#include <asm/system.h>
27
#include <asm/io.h>
28
 
29
#include <asm/ppc_machine.h>
30
 
31
/*
32
 * Trap & Exception support
33
 */
34
 
35
void
36
trap_init(void)
37
{
38
}
39
 
40
void
41
_exception(int signr, struct pt_regs *regs)
42
{
43
/*      dump_regs(regs);*/
44
        force_sig(signr, current);
45
        if (!user_mode(regs))
46
        {
47
                printk("Failure in kernel at PC: %x, MSR: %x\n", regs->nip, regs->msr);
48
                while (1) ;
49
        }
50
}
51
 
52
MachineCheckException(struct pt_regs *regs)
53
{
54
/*      printk("Machine check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);*/
55
        _exception(SIGSEGV, regs);
56
}
57
 
58
ProgramCheckException(struct pt_regs *regs)
59
{
60
/*      printk("Program check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);*/
61
        if (current->flags & PF_PTRACED)
62
        {
63
                _exception(SIGTRAP, regs);
64
        } else
65
        {
66
                _exception(SIGILL, regs);
67
        }
68
}
69
 
70
SingleStepException(struct pt_regs *regs)
71
{
72
/*      printk("Single step at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);*/
73
        regs->msr &= ~MSR_SE;  /* Turn off 'trace' bit */
74
        _exception(SIGTRAP, regs);
75
}
76
 
77
FloatingPointCheckException(struct pt_regs *regs)
78
{
79
/*      printk("Floating point check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);*/
80
        _exception(SIGFPE, regs);
81
}
82
 
83
AlignmentException(struct pt_regs *regs)
84
{
85
/*      printk("Alignment error at PC: %x, SR: %x\n", regs->nip, regs->msr);
86
        dump_regs(regs);
87
        printk("Alignment error at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);*/
88
        _exception(SIGBUS, regs);
89
}
90
 
91
bad_stack(struct pt_regs *regs)
92
{
93
/*      printk("Kernel stack overflow at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
94
        dump_regs(regs);*/
95
        while (1) ;
96
}
97
 
98
dump_regs(struct pt_regs *regs)
99
{
100
        int i;
101
        printk("NIP: %08X, MSR: %08X, XER: %08X, LR: %08X, FRAME: %08X\n", regs->nip, regs->msr, regs->xer, regs->link, regs);
102
#if 0   
103
        printk("HASH = %08X/%08X, MISS = %08X/%08X, CMP = %08X/%08X\n", regs->hash1, regs->hash2, regs->imiss, regs->dmiss, regs->icmp, regs->dcmp);
104
#endif  
105
        printk("TASK = %x[%d] '%s'\n", current, current->pid, current->comm);
106
        for (i = 0;  i < 32;  i++)
107
        {
108
                if ((i % 8) == 0)
109
                {
110
                        printk("GPR%02d: ", i);
111
                }
112
                printk("%08X ", regs->gpr[i]);
113
                if ((i % 8) == 7)
114
                {
115
                        printk("\n");
116
                }
117
        }
118
#if 0   
119
        if (regs->nip >= 0x1000)
120
                dump_buf(regs->nip-32, 64);
121
        dump_buf((regs->nip&0x0FFFFFFF)|KERNELBASE, 32);
122
#endif
123
}
124
 
125
trace_syscall(struct pt_regs *regs)
126
{
127
        static int count;
128
        printk("Task: %08X(%d), PC: %08X/%08X, Syscall: %3d, Result: %s%d\n", current, current->pid, regs->nip, regs->link, regs->gpr[0], regs->ccr&0x10000000?"Error=":"", regs->gpr[3]);
129
        if (++count == 20)
130
        {
131
                count = 0;
132
        }
133
}
134
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.