Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66009
b: refs/heads/master
c: 1ffe664
h: refs/heads/master
i:
  66007: 1aff530
v: v3
  • Loading branch information
Mike Frysinger authored and Bryan Wu committed Aug 5, 2007
1 parent b5b0805 commit 0a21e36
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dbcc78bebe9daed8998d9f7c4e30bd3b73a4a169
refs/heads/master: 1ffe6646babf8471714e649849ec2c9662bf410c
38 changes: 36 additions & 2 deletions trunk/arch/blackfin/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ void __init trap_init(void)
CSYNC();
}

asmlinkage void trap_c(struct pt_regs *fp);

int kstack_depth_to_print = 48;

#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
Expand Down Expand Up @@ -693,6 +691,42 @@ asmlinkage int sys_bfin_spinlock(int *spinlock)
return ret;
}

int bfin_request_exception(unsigned int exception, void (*handler)(void))
{
void (*curr_handler)(void);

if (exception > 0x3F)
return -EINVAL;

curr_handler = ex_table[exception];

if (curr_handler != ex_replaceable)
return -EBUSY;

ex_table[exception] = handler;

return 0;
}
EXPORT_SYMBOL(bfin_request_exception);

int bfin_free_exception(unsigned int exception, void (*handler)(void))
{
void (*curr_handler)(void);

if (exception > 0x3F)
return -EINVAL;

curr_handler = ex_table[exception];

if (curr_handler != handler)
return -EBUSY;

ex_table[exception] = ex_replaceable;

return 0;
}
EXPORT_SYMBOL(bfin_free_exception);

void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
{
switch (cplb_panic) {
Expand Down
42 changes: 22 additions & 20 deletions trunk/arch/blackfin/mach-common/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ ENTRY(_ex_single_step)
cc = r6 == r7;
if !cc jump _ex_trap_c;

_return_from_exception:
ENTRY(_return_from_exception)
DEBUG_START_HWTRACE(p5, r7)
#if ANOMALY_05000257
R7=LC0;
Expand Down Expand Up @@ -171,6 +171,9 @@ ENTRY(_handle_bad_cplb)
[--sp] = ASTAT;
[--sp] = (R7:6, P5:4);

ENTRY(_ex_replaceable)
nop;

ENTRY(_ex_trap_c)
/* Call C code (trap_c) to handle the exception, which most
* likely involves sending a signal to the current process.
Expand Down Expand Up @@ -298,8 +301,8 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
r6.l = lo(SEQSTAT_EXCAUSE);
r6.h = hi(SEQSTAT_EXCAUSE);
r7 = r7 & r6;
p5.h = _extable;
p5.l = _extable;
p5.h = _ex_table;
p5.l = _ex_table;
p4 = r7;
p5 = p5 + (p4 << 2);
p4 = [p5];
Expand Down Expand Up @@ -818,28 +821,27 @@ ENTRY(_software_trace_buff)
#else
.data
#endif
ALIGN
_extable:
ENTRY(_ex_table)
/* entry for each EXCAUSE[5:0]
* This table must be in sync with the table in ./kernel/traps.c
* EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
*/
.long _ex_syscall; /* 0x00 - User Defined - Linux Syscall */
.long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
.long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
.long _ex_trap_c /* 0x02 - User Defined */
.long _ex_replaceable /* 0x02 - User Defined */
.long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
.long _ex_trap_c /* 0x04 - User Defined */
.long _ex_trap_c /* 0x05 - User Defined */
.long _ex_trap_c /* 0x06 - User Defined */
.long _ex_trap_c /* 0x07 - User Defined */
.long _ex_trap_c /* 0x08 - User Defined */
.long _ex_trap_c /* 0x09 - User Defined */
.long _ex_trap_c /* 0x0A - User Defined */
.long _ex_trap_c /* 0x0B - User Defined */
.long _ex_trap_c /* 0x0C - User Defined */
.long _ex_trap_c /* 0x0D - User Defined */
.long _ex_trap_c /* 0x0E - User Defined */
.long _ex_trap_c /* 0x0F - User Defined */
.long _ex_replaceable /* 0x04 - User Defined */
.long _ex_replaceable /* 0x05 - User Defined */
.long _ex_replaceable /* 0x06 - User Defined */
.long _ex_replaceable /* 0x07 - User Defined */
.long _ex_replaceable /* 0x08 - User Defined */
.long _ex_replaceable /* 0x09 - User Defined */
.long _ex_replaceable /* 0x0A - User Defined */
.long _ex_replaceable /* 0x0B - User Defined */
.long _ex_replaceable /* 0x0C - User Defined */
.long _ex_replaceable /* 0x0D - User Defined */
.long _ex_replaceable /* 0x0E - User Defined */
.long _ex_replaceable /* 0x0F - User Defined */
.long _ex_single_step /* 0x10 - HW Single step */
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
.long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
Expand Down Expand Up @@ -893,8 +895,8 @@ _extable:
.long _ex_trap_c /* 0x3D - Reserved */
.long _ex_trap_c /* 0x3E - Reserved */
.long _ex_trap_c /* 0x3F - Reserved */
END(_ex_table)

ALIGN
ENTRY(_sys_call_table)
.long _sys_restart_syscall /* 0 */
.long _sys_exit
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/asm-blackfin/irq_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ asmlinkage void evt_evt13(void);
asmlinkage void evt_soft_int1(void);
asmlinkage void evt_system_call(void);
asmlinkage void init_exception_buff(void);
asmlinkage void trap_c(struct pt_regs *fp);
asmlinkage void ex_replaceable(void);

extern void *ex_table[];
extern void return_from_exception(void);

extern int bfin_request_exception(unsigned int exception, void (*handler)(void));
extern int bfin_free_exception(unsigned int exception, void (*handler)(void));

#endif

0 comments on commit 0a21e36

Please sign in to comment.