1 INTERFACE [sparc && debug]:
3 #include "trap_state.h"
9 typedef void (*Dbg_extension_entry)(Thread *t, Entry_frame *r);
10 static Dbg_extension_entry dbg_extension[64];
12 static int call_nested_trap_handler(Trap_state *ts) asm ("call_nested_trap_handler");
13 static Trap_state::Handler nested_trap_handler FIASCO_FASTCALL;
16 //------------------------------------------------------------------------------
17 IMPLEMENTATION [sparc && debug]:
19 Thread::Dbg_extension_entry Thread::dbg_extension[64];
20 Trap_state::Handler Thread::nested_trap_handler FIASCO_FASTCALL;
22 extern "C" void sys_kdb_ke()
25 Thread *t = current_thread();
27 //arriving from outx function
28 //unsigned *x = (unsigned *)t->regs()->ip();
29 if(t->regs()->r[29] == (Mword)-0x24 && t->regs()->r[2] & (1 << 31)) //ip && r3
32 unsigned func = (unsigned)t->regs()->r[1] & 0xffff; //r4
33 if(Thread::dbg_extension[func])
35 Thread::dbg_extension[func](t, t->regs());
40 char str[32] = "USER ENTRY";
41 //arriving from enter_kdebug
42 if (t->regs()->r[29] == (Mword)-0x24 && t->regs()->r[2] & (1 << 30)) //ip && r3
44 //t->mem_space()->copy_from_user(str, (char *)(x + 1), sizeof(str));
45 str[sizeof(str)-1] = 0;
53 Thread::call_nested_trap_handler(Trap_state * /*ts*/)
55 unsigned phys_cpu = Proc::cpu_id();
56 unsigned log_cpu = Cpu::cpus.find_cpu(Cpu::By_phys_id(phys_cpu));
59 printf("Trap on unknown CPU phys_id=%x\n", phys_cpu);
63 unsigned long &ntr = nested_trap_recover.cpu(log_cpu);
68 stack = dbg_stack.cpu(log_cpu).stack_top;
73 IMPLEMENTATION [sparc && !debug]:
75 extern "C" void sys_kdb_ke()
78 extern "C" void enter_jdb()