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
4bb73c3d
Commit
4bb73c3d
authored
May 26, 2009
by
Michal Simek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
microblaze_mmu_v2: Add MMU related exceptions handling
Signed-off-by:
Michal Simek
<
monstr@monstr.eu
>
parent
0d6de953
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
8 deletions
+37
-8
arch/microblaze/kernel/exceptions.c
arch/microblaze/kernel/exceptions.c
+37
-8
No files found.
arch/microblaze/kernel/exceptions.c
View file @
4bb73c3d
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
#include <asm/exceptions.h>
#include <asm/exceptions.h>
#include <asm/entry.h>
/* For KM CPU var */
#include <asm/entry.h>
/* For KM CPU var */
#include <
asm
/uaccess.h>
#include <
linux
/uaccess.h>
#include <
asm
/errno.h>
#include <
linux
/errno.h>
#include <
asm
/ptrace.h>
#include <
linux
/ptrace.h>
#include <asm/current.h>
#include <asm/current.h>
#define MICROBLAZE_ILL_OPCODE_EXCEPTION 0x02
#define MICROBLAZE_ILL_OPCODE_EXCEPTION 0x02
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define MICROBLAZE_DBUS_EXCEPTION 0x04
#define MICROBLAZE_DBUS_EXCEPTION 0x04
#define MICROBLAZE_DIV_ZERO_EXCEPTION 0x05
#define MICROBLAZE_DIV_ZERO_EXCEPTION 0x05
#define MICROBLAZE_FPU_EXCEPTION 0x06
#define MICROBLAZE_FPU_EXCEPTION 0x06
#define MICROBLAZE_PRIVILEG_EXCEPTION 0x07
#define MICROBLAZE_PRIVILEG
ED
_EXCEPTION 0x07
static
DEFINE_SPINLOCK
(
die_lock
);
static
DEFINE_SPINLOCK
(
die_lock
);
...
@@ -66,6 +66,11 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
...
@@ -66,6 +66,11 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
asmlinkage
void
full_exception
(
struct
pt_regs
*
regs
,
unsigned
int
type
,
asmlinkage
void
full_exception
(
struct
pt_regs
*
regs
,
unsigned
int
type
,
int
fsr
,
int
addr
)
int
fsr
,
int
addr
)
{
{
#ifdef CONFIG_MMU
int
code
;
addr
=
regs
->
pc
;
#endif
#if 0
#if 0
printk(KERN_WARNING "Exception %02x in %s mode, FSR=%08x PC=%08x ESR=%08x\n",
printk(KERN_WARNING "Exception %02x in %s mode, FSR=%08x PC=%08x ESR=%08x\n",
type, user_mode(regs) ? "user" : "kernel", fsr,
type, user_mode(regs) ? "user" : "kernel", fsr,
...
@@ -74,7 +79,13 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
...
@@ -74,7 +79,13 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
switch
(
type
&
0x1F
)
{
switch
(
type
&
0x1F
)
{
case
MICROBLAZE_ILL_OPCODE_EXCEPTION
:
case
MICROBLAZE_ILL_OPCODE_EXCEPTION
:
_exception
(
SIGILL
,
regs
,
ILL_ILLOPC
,
addr
);
if
(
user_mode
(
regs
))
{
printk
(
KERN_WARNING
"Illegal opcode exception in user mode.
\n
"
);
_exception
(
SIGILL
,
regs
,
ILL_ILLOPC
,
addr
);
return
;
}
printk
(
KERN_WARNING
"Illegal opcode exception in kernel mode.
\n
"
);
die
(
"opcode exception"
,
regs
,
SIGBUS
);
break
;
break
;
case
MICROBLAZE_IBUS_EXCEPTION
:
case
MICROBLAZE_IBUS_EXCEPTION
:
if
(
user_mode
(
regs
))
{
if
(
user_mode
(
regs
))
{
...
@@ -95,11 +106,16 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
...
@@ -95,11 +106,16 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
die
(
"bus exception"
,
regs
,
SIGBUS
);
die
(
"bus exception"
,
regs
,
SIGBUS
);
break
;
break
;
case
MICROBLAZE_DIV_ZERO_EXCEPTION
:
case
MICROBLAZE_DIV_ZERO_EXCEPTION
:
printk
(
KERN_WARNING
"Divide by zero exception
\n
"
);
if
(
user_mode
(
regs
))
{
_exception
(
SIGILL
,
regs
,
ILL_ILLOPC
,
addr
);
printk
(
KERN_WARNING
"Divide by zero exception in user mode
\n
"
);
_exception
(
SIGILL
,
regs
,
ILL_ILLOPC
,
addr
);
return
;
}
printk
(
KERN_WARNING
"Divide by zero exception in kernel mode.
\n
"
);
die
(
"Divide by exception"
,
regs
,
SIGBUS
);
break
;
break
;
case
MICROBLAZE_FPU_EXCEPTION
:
case
MICROBLAZE_FPU_EXCEPTION
:
printk
(
KERN_WARNING
"FPU exception
\n
"
);
/* IEEE FP exception */
/* IEEE FP exception */
/* I removed fsr variable and use code var for storing fsr */
/* I removed fsr variable and use code var for storing fsr */
if
(
fsr
&
FSR_IO
)
if
(
fsr
&
FSR_IO
)
...
@@ -115,7 +131,20 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
...
@@ -115,7 +131,20 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
_exception
(
SIGFPE
,
regs
,
fsr
,
addr
);
_exception
(
SIGFPE
,
regs
,
fsr
,
addr
);
break
;
break
;
#ifdef CONFIG_MMU
case
MICROBLAZE_PRIVILEGED_EXCEPTION
:
printk
(
KERN_WARNING
"Privileged exception
\n
"
);
/* "brk r0,r0" - used as debug breakpoint */
if
(
get_user
(
code
,
(
unsigned
long
*
)
regs
->
pc
)
==
0
&&
code
==
0x980c0000
)
{
_exception
(
SIGTRAP
,
regs
,
TRAP_BRKPT
,
addr
);
}
else
{
_exception
(
SIGILL
,
regs
,
ILL_PRVOPC
,
addr
);
}
break
;
#endif
default:
default:
/* FIXME what to do in unexpected exception */
printk
(
KERN_WARNING
"Unexpected exception %02x "
printk
(
KERN_WARNING
"Unexpected exception %02x "
"PC=%08x in %s mode
\n
"
,
type
,
(
unsigned
int
)
addr
,
"PC=%08x in %s mode
\n
"
,
type
,
(
unsigned
int
)
addr
,
kernel_mode
(
regs
)
?
"kernel"
:
"user"
);
kernel_mode
(
regs
)
?
"kernel"
:
"user"
);
...
...
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