2 * Simulator hook mechanism
9 #define HOOK_TRIG_ADDR 0xb7000000
10 #define HOOK_MEM_BASE_ADDR 0xce000000
12 static volatile unsigned *hook_base
;
14 #define HOOK_DATA(offset) hook_base[offset]
15 #define VHOOK_DATA(offset) hook_base[offset]
16 #define HOOK_TRIG(funcid) \
18 *((unsigned *) HOOK_TRIG_ADDR) = funcid; \
20 #define HOOK_DATA_BYTE(offset) ((unsigned char *)hook_base)[offset]
22 static void hook_init(void)
27 hook_base
= ioremap(HOOK_MEM_BASE_ADDR
, 8192);
31 static unsigned hook_trig(unsigned id
)
35 /* preempt_disable(); */
37 /* Dummy read from mem to make sure data has propagated to memory
44 /* wait for call to finish */
45 while (VHOOK_DATA(0) > 0) ;
47 /* extract return value */
54 int hook_call(unsigned id
, unsigned pcnt
, ...)
65 for (i
= 1; i
<= pcnt
; i
++)
66 HOOK_DATA(i
) = va_arg(ap
, unsigned);
74 int hook_call_str(unsigned id
, unsigned size
, const char *str
)
84 for (i
= 0; i
< size
; i
++)
85 HOOK_DATA_BYTE(8 + i
) = str
[i
];
86 HOOK_DATA_BYTE(8 + i
) = 0;
93 void print_str(const char *str
)
96 /* find null at end of string */
97 for (i
= 1; str
[i
]; i
++) ;
98 hook_call(hook_print_str
, i
, str
);
101 void CPU_WATCHDOG_TIMEOUT(unsigned t
)