Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
86417780
Commit
86417780
authored
Oct 10, 2005
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
powerpc: Reduce the 32/64-bit differences in traps.c
Signed-off-by:
Paul Mackerras
<
paulus@samba.org
>
parent
b42b6617
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
41 deletions
+17
-41
arch/powerpc/kernel/traps.c
arch/powerpc/kernel/traps.c
+17
-41
No files found.
arch/powerpc/kernel/traps.c
View file @
86417780
...
@@ -31,29 +31,33 @@
...
@@ -31,29 +31,33 @@
#include <linux/prctl.h>
#include <linux/prctl.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/kprobes.h>
#include <linux/kprobes.h>
#include <asm/kdebug.h>
#include <asm/kdebug.h>
#include <asm/pgtable.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/rtas.h>
#include <asm/xmon.h>
#ifdef CONFIG_PPC32
#ifdef CONFIG_PPC32
#include <asm/reg.h>
#include <asm/reg.h>
#include <asm/xmon.h>
#include <asm/perfmon.h>
#endif
#ifdef CONFIG_PMAC_BACKLIGHT
#ifdef CONFIG_PMAC_BACKLIGHT
#include <asm/backlight.h>
#include <asm/backlight.h>
#endif
#endif
#include <asm/perfmon.h>
#endif
#ifdef CONFIG_PPC64
#ifdef CONFIG_PPC64
#include <asm/firmware.h>
#include <asm/processor.h>
#include <asm/processor.h>
#include <asm/ppcdebug.h>
#include <asm/rtas.h>
#include <asm/systemcfg.h>
#include <asm/systemcfg.h>
#include <asm/machdep.h>
#include <asm/pmc.h>
#include <asm/pmc.h>
#endif
#endif
#ifdef CONFIG_PPC64
/* XXX */
#define _IO_BASE pci_io_base
#endif
#ifdef CONFIG_DEBUGGER
#ifdef CONFIG_DEBUGGER
int
(
*
__debugger
)(
struct
pt_regs
*
regs
);
int
(
*
__debugger
)(
struct
pt_regs
*
regs
);
int
(
*
__debugger_ipi
)(
struct
pt_regs
*
regs
);
int
(
*
__debugger_ipi
)(
struct
pt_regs
*
regs
);
...
@@ -277,7 +281,6 @@ static inline int check_io_access(struct pt_regs *regs)
...
@@ -277,7 +281,6 @@ static inline int check_io_access(struct pt_regs *regs)
}
}
#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
/* On 4xx, the reason for the machine check or program exception
/* On 4xx, the reason for the machine check or program exception
is in the ESR. */
is in the ESR. */
#define get_reason(regs) ((regs)->dsisr)
#define get_reason(regs) ((regs)->dsisr)
...
@@ -296,7 +299,6 @@ static inline int check_io_access(struct pt_regs *regs)
...
@@ -296,7 +299,6 @@ static inline int check_io_access(struct pt_regs *regs)
#define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC)
#define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC)
#else
#else
/* On non-4xx, the reason for the machine check or program
/* On non-4xx, the reason for the machine check or program
exception is in the MSR. */
exception is in the MSR. */
#define get_reason(regs) ((regs)->msr)
#define get_reason(regs) ((regs)->msr)
...
@@ -475,7 +477,7 @@ void machine_check_exception(struct pt_regs *regs)
...
@@ -475,7 +477,7 @@ void machine_check_exception(struct pt_regs *regs)
* additional info, e.g. bus error registers.
* additional info, e.g. bus error registers.
*/
*/
platform_machine_check
(
regs
);
platform_machine_check
(
regs
);
#endif
/* CONFIG_PPC
32
*/
#endif
/* CONFIG_PPC
64
*/
if
(
debugger_fault_handler
(
regs
))
if
(
debugger_fault_handler
(
regs
))
return
;
return
;
...
@@ -486,12 +488,10 @@ void machine_check_exception(struct pt_regs *regs)
...
@@ -486,12 +488,10 @@ void machine_check_exception(struct pt_regs *regs)
panic
(
"Unrecoverable Machine check"
);
panic
(
"Unrecoverable Machine check"
);
}
}
#ifdef CONFIG_PPC32
void
SMIException
(
struct
pt_regs
*
regs
)
void
SMIException
(
struct
pt_regs
*
regs
)
{
{
die
(
"System Management Interrupt"
,
regs
,
SIGABRT
);
die
(
"System Management Interrupt"
,
regs
,
SIGABRT
);
}
}
#endif
void
unknown_exception
(
struct
pt_regs
*
regs
)
void
unknown_exception
(
struct
pt_regs
*
regs
)
{
{
...
@@ -511,12 +511,10 @@ void instruction_breakpoint_exception(struct pt_regs *regs)
...
@@ -511,12 +511,10 @@ void instruction_breakpoint_exception(struct pt_regs *regs)
_exception
(
SIGTRAP
,
regs
,
TRAP_BRKPT
,
regs
->
nip
);
_exception
(
SIGTRAP
,
regs
,
TRAP_BRKPT
,
regs
->
nip
);
}
}
#ifdef CONFIG_PPC32
void
RunModeException
(
struct
pt_regs
*
regs
)
void
RunModeException
(
struct
pt_regs
*
regs
)
{
{
_exception
(
SIGTRAP
,
regs
,
0
,
0
);
_exception
(
SIGTRAP
,
regs
,
0
,
0
);
}
}
#endif
void
__kprobes
single_step_exception
(
struct
pt_regs
*
regs
)
void
__kprobes
single_step_exception
(
struct
pt_regs
*
regs
)
{
{
...
@@ -542,7 +540,6 @@ static void emulate_single_step(struct pt_regs *regs)
...
@@ -542,7 +540,6 @@ static void emulate_single_step(struct pt_regs *regs)
if
(
single_stepping
(
regs
))
{
if
(
single_stepping
(
regs
))
{
clear_single_step
(
regs
);
clear_single_step
(
regs
);
_exception
(
SIGTRAP
,
regs
,
TRAP_TRACE
,
0
);
_exception
(
SIGTRAP
,
regs
,
TRAP_TRACE
,
0
);
single_step_exception
(
regs
);
}
}
}
}
...
@@ -587,6 +584,7 @@ static void parse_fpe(struct pt_regs *regs)
...
@@ -587,6 +584,7 @@ static void parse_fpe(struct pt_regs *regs)
* There are a couple of ways to do this, either "decode" the instruction
* There are a couple of ways to do this, either "decode" the instruction
* or directly match lots of bits. In this case, matching lots of
* or directly match lots of bits. In this case, matching lots of
* bits is faster and easier.
* bits is faster and easier.
*
*/
*/
#define INST_MFSPR_PVR 0x7c1f42a6
#define INST_MFSPR_PVR 0x7c1f42a6
#define INST_MFSPR_PVR_MASK 0xfc1fffff
#define INST_MFSPR_PVR_MASK 0xfc1fffff
...
@@ -597,8 +595,6 @@ static void parse_fpe(struct pt_regs *regs)
...
@@ -597,8 +595,6 @@ static void parse_fpe(struct pt_regs *regs)
#define INST_MCRXR 0x7c000400
#define INST_MCRXR 0x7c000400
#define INST_MCRXR_MASK 0x7c0007fe
#define INST_MCRXR_MASK 0x7c0007fe
#ifdef CONFIG_PPC32
#define INST_STRING 0x7c00042a
#define INST_STRING 0x7c00042a
#define INST_STRING_MASK 0x7c0007fe
#define INST_STRING_MASK 0x7c0007fe
#define INST_STRING_GEN_MASK 0x7c00067e
#define INST_STRING_GEN_MASK 0x7c00067e
...
@@ -674,7 +670,6 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword)
...
@@ -674,7 +670,6 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword)
return
0
;
return
0
;
}
}
#endif
/* CONFIG_PPC32 */
static
int
emulate_instruction
(
struct
pt_regs
*
regs
)
static
int
emulate_instruction
(
struct
pt_regs
*
regs
)
{
{
...
@@ -701,28 +696,17 @@ static int emulate_instruction(struct pt_regs *regs)
...
@@ -701,28 +696,17 @@ static int emulate_instruction(struct pt_regs *regs)
/* Emulate the mcrxr insn. */
/* Emulate the mcrxr insn. */
if
((
instword
&
INST_MCRXR_MASK
)
==
INST_MCRXR
)
{
if
((
instword
&
INST_MCRXR_MASK
)
==
INST_MCRXR
)
{
unsigned
int
shift
=
(
instword
>>
21
)
&
0x1c
;
int
shift
=
(
instword
>>
21
)
&
0x1c
;
unsigned
long
msk
=
0xf0000000UL
>>
shift
;
unsigned
long
msk
=
0xf0000000UL
>>
shift
;
#ifdef CONFIG_PPC64
static
int
warned
;
if
(
!
warned
)
{
printk
(
KERN_WARNING
"process %d (%s) uses obsolete 'mcrxr' insn
\n
"
,
current
->
pid
,
current
->
comm
);
warned
=
1
;
}
#endif
regs
->
ccr
=
(
regs
->
ccr
&
~
msk
)
|
((
regs
->
xer
>>
shift
)
&
msk
);
regs
->
ccr
=
(
regs
->
ccr
&
~
msk
)
|
((
regs
->
xer
>>
shift
)
&
msk
);
regs
->
xer
&=
~
0xf0000000UL
;
regs
->
xer
&=
~
0xf0000000UL
;
return
0
;
return
0
;
}
}
#ifdef CONFIG_PPC32
/* Emulate load/store string insn. */
/* Emulate load/store string insn. */
if
((
instword
&
INST_STRING_GEN_MASK
)
==
INST_STRING
)
if
((
instword
&
INST_STRING_GEN_MASK
)
==
INST_STRING
)
return
emulate_string_inst
(
regs
,
instword
);
return
emulate_string_inst
(
regs
,
instword
);
#endif
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -769,22 +753,18 @@ static int check_bug_trap(struct pt_regs *regs)
...
@@ -769,22 +753,18 @@ static int check_bug_trap(struct pt_regs *regs)
xmon_printf
(
KERN_ERR
"Badness in %s at %s:%d
\n
"
,
xmon_printf
(
KERN_ERR
"Badness in %s at %s:%d
\n
"
,
bug
->
function
,
bug
->
file
,
bug
->
function
,
bug
->
file
,
bug
->
line
&
~
BUG_WARNING_TRAP
);
bug
->
line
&
~
BUG_WARNING_TRAP
);
#endif
#endif
/* CONFIG_XMON */
printk
(
KERN_ERR
"Badness in %s at %s:%d
\n
"
,
printk
(
KERN_ERR
"Badness in %s at %s:%d
\n
"
,
bug
->
function
,
bug
->
file
,
bug
->
function
,
bug
->
file
,
bug
->
line
&
~
BUG_WARNING_TRAP
);
bug
->
line
&
~
BUG_WARNING_TRAP
);
#ifdef CONFIG_PPC32
dump_stack
();
dump_stack
();
#else
show_stack
(
current
,
(
void
*
)
regs
->
gpr
[
1
]);
#endif
return
1
;
return
1
;
}
}
#if
defined(CONFIG_PPC32) && defined(CONFIG_XMON)
#if
def CONFIG_XMON
xmon_printf
(
KERN_CRIT
"kernel BUG in %s at %s:%d!
\n
"
,
xmon_printf
(
KERN_CRIT
"kernel BUG in %s at %s:%d!
\n
"
,
bug
->
function
,
bug
->
file
,
bug
->
line
);
bug
->
function
,
bug
->
file
,
bug
->
line
);
xmon
(
regs
);
xmon
(
regs
);
#endif
#endif
/* CONFIG_XMON */
printk
(
KERN_CRIT
"kernel BUG in %s at %s:%d!
\n
"
,
printk
(
KERN_CRIT
"kernel BUG in %s at %s:%d!
\n
"
,
bug
->
function
,
bug
->
file
,
bug
->
line
);
bug
->
function
,
bug
->
file
,
bug
->
line
);
...
@@ -873,7 +853,6 @@ void alignment_exception(struct pt_regs *regs)
...
@@ -873,7 +853,6 @@ void alignment_exception(struct pt_regs *regs)
_exception
(
SIGBUS
,
regs
,
BUS_ADRALN
,
regs
->
dar
);
_exception
(
SIGBUS
,
regs
,
BUS_ADRALN
,
regs
->
dar
);
}
}
#ifdef CONFIG_PPC32
void
StackOverflow
(
struct
pt_regs
*
regs
)
void
StackOverflow
(
struct
pt_regs
*
regs
)
{
{
printk
(
KERN_CRIT
"Kernel stack overflow in process %p, r1=%lx
\n
"
,
printk
(
KERN_CRIT
"Kernel stack overflow in process %p, r1=%lx
\n
"
,
...
@@ -897,7 +876,6 @@ void trace_syscall(struct pt_regs *regs)
...
@@ -897,7 +876,6 @@ void trace_syscall(struct pt_regs *regs)
current
,
current
->
pid
,
regs
->
nip
,
regs
->
link
,
regs
->
gpr
[
0
],
current
,
current
->
pid
,
regs
->
nip
,
regs
->
link
,
regs
->
gpr
[
0
],
regs
->
ccr
&
0x10000000
?
"Error="
:
""
,
regs
->
gpr
[
3
],
print_tainted
());
regs
->
ccr
&
0x10000000
?
"Error="
:
""
,
regs
->
gpr
[
3
],
print_tainted
());
}
}
#endif
/* CONFIG_PPC32 */
void
kernel_fp_unavailable_exception
(
struct
pt_regs
*
regs
)
void
kernel_fp_unavailable_exception
(
struct
pt_regs
*
regs
)
{
{
...
@@ -963,7 +941,6 @@ void SoftwareEmulation(struct pt_regs *regs)
...
@@ -963,7 +941,6 @@ void SoftwareEmulation(struct pt_regs *regs)
}
}
#endif
/* CONFIG_8xx */
#endif
/* CONFIG_8xx */
#ifdef CONFIG_PPC32
#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
void
DebugException
(
struct
pt_regs
*
regs
,
unsigned
long
debug_status
)
void
DebugException
(
struct
pt_regs
*
regs
,
unsigned
long
debug_status
)
...
@@ -992,7 +969,6 @@ void TAUException(struct pt_regs *regs)
...
@@ -992,7 +969,6 @@ void TAUException(struct pt_regs *regs)
regs
->
nip
,
regs
->
msr
,
regs
->
trap
,
print_tainted
());
regs
->
nip
,
regs
->
msr
,
regs
->
trap
,
print_tainted
());
}
}
#endif
/* CONFIG_INT_TAU */
#endif
/* CONFIG_INT_TAU */
#endif
/* CONFIG_PPC32*/
#ifdef CONFIG_ALTIVEC
#ifdef CONFIG_ALTIVEC
void
altivec_assist_exception
(
struct
pt_regs
*
regs
)
void
altivec_assist_exception
(
struct
pt_regs
*
regs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment