41 #ifndef __ARCH_SIM_H__
42 #define __ARCH_SIM_H__
49 #include <arch/spr_def.h>
58 sim_is_simulator(
void)
118 sim_set_tracing(
unsigned int mask)
146 sim_dump(
unsigned int mask)
158 sim_print(
const char*
str)
160 for ( ; *str !=
'\0'; str++)
176 sim_print_string(
const char* str)
178 for ( ; *str !=
'\0'; str++)
200 sim_command(
const char* str)
226 __asm__ __volatile__ (
"mtspr SIM_CONTROL, r0"
227 :
"=R00" (result) :
"R00" (val));
234 __asm__ __volatile__ (
"{ and zero, r1, r1; mtspr SIM_CONTROL, r0 }"
235 :
"=R00" (result) :
"R00" (val),
"R01" (arg1));
239 static __inline long _sim_syscall2(
int val,
long arg1,
long arg2)
242 __asm__ __volatile__ (
"{ and zero, r1, r2; mtspr SIM_CONTROL, r0 }"
244 :
"R00" (val),
"R01" (arg1),
"R02" (arg2));
253 static __inline long _sim_syscall3(
int val,
long arg1,
long arg2,
long arg3)
256 __asm__ __volatile__ (
"{ and zero, r3, r3 };"
257 "{ and zero, r1, r2; mtspr SIM_CONTROL, r0 }"
259 :
"R00" (val),
"R01" (arg1),
"R02" (arg2),
264 static __inline long _sim_syscall4(
int val,
long arg1,
long arg2,
long arg3,
268 __asm__ __volatile__ (
"{ and zero, r3, r4 };"
269 "{ and zero, r1, r2; mtspr SIM_CONTROL, r0 }"
271 :
"R00" (val),
"R01" (arg1),
"R02" (arg2),
272 "R03" (arg3),
"R04" (arg4));
276 static __inline long _sim_syscall5(
int val,
long arg1,
long arg2,
long arg3,
277 long arg4,
long arg5)
280 __asm__ __volatile__ (
"{ and zero, r3, r4; and zero, r5, r5 };"
281 "{ and zero, r1, r2; mtspr SIM_CONTROL, r0 }"
283 :
"R00" (val),
"R01" (arg1),
"R02" (arg2),
284 "R03" (arg3),
"R04" (arg4),
"R05" (arg5));
298 #define _sim_syscall(syscall_num, nr, args...) \
300 ((syscall_num) << _SIM_CONTROL_OPERATOR_BITS) | SIM_CONTROL_SYSCALL, \
305 #define SIM_WATCHPOINT_READ 1
306 #define SIM_WATCHPOINT_WRITE 2
307 #define SIM_WATCHPOINT_EXECUTE 4
311 sim_add_watchpoint(
unsigned int process_id,
314 unsigned int access_mask,
318 address, size, access_mask, user_data);
323 sim_remove_watchpoint(
unsigned int process_id,
326 unsigned int access_mask,
330 address, size, access_mask, user_data);
358 sim_query_watchpoint(unsigned
int process_id)
363 __asm__ __volatile__ (
"{ and zero, r1, r1; mtspr SIM_CONTROL, r0 }"
367 :
"R00" (val),
"R01" (process_id));
374 sim_validate_lines_evicted(
unsigned long long pa,
unsigned long length)
380 0 , (
long)(pa), (
long)(pa >> 32), length);
387 sim_query_cpu_speed(
void)
428 sim_set_shaping(
unsigned shim,
444 sim_enable_mpipe_links(
unsigned mpipe,
unsigned long link_mask)
448 (mpipe << 8) | (1 << 16) | ((
uint_reg_t)link_mask << 32)));
453 sim_disable_mpipe_links(
unsigned mpipe,
unsigned long link_mask)
457 (mpipe << 8) | (0 << 16) | ((
uint_reg_t)link_mask << 32)));
469 #define sim_enable_functional() \
470 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_ENABLE_FUNCTIONAL)
472 #define sim_disable_functional() \
473 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_DISABLE_FUNCTIONAL)
490 sim_profiler_enable(
void)
498 sim_profiler_disable(
void)
514 sim_profiler_set_enabled(
int enabled)
530 sim_profiler_is_enabled(
void)
543 sim_profiler_clear(
void)
565 sim_profiler_chip_enable(
unsigned int mask)
587 sim_profiler_chip_disable(
unsigned int mask)
609 sim_profiler_chip_clear(
unsigned int mask)
622 sim_event_begin(
unsigned int x)
624 #if defined(__tile__) && !defined(__NO_EVENT_SPR__)
630 sim_event_end(
unsigned int x)
632 #if defined(__tile__) && !defined(__NO_EVENT_SPR__)