Home | History | Annotate | Download | only in target-arm
      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <string.h>
      4 
      5 #include "cpu.h"
      6 #include "exec-all.h"
      7 #include "gdbstub.h"
      8 #include "def-helper.h"
      9 #include "helper-android.h"
     10 #include "qemu-common.h"
     11 
     12 /* copy a string from the simulated virtual space to a buffer in QEMU */
     13 void vstrcpy(target_ulong ptr, char *buf, int max)
     14 {
     15     int  index;
     16 
     17     if (buf == NULL) return;
     18 
     19     for (index = 0; index < max; index += 1) {
     20         cpu_physical_memory_read(ptr + index, (uint8_t*)buf + index, 1);
     21         if (buf[index] == 0)
     22             break;
     23     }
     24 }
     25 
     26 #ifdef CONFIG_TRACE
     27 #include "android-trace.h"
     28 
     29 void  HELPER(traceTicks)(uint32_t  ticks)
     30 {
     31     sim_time += ticks;
     32 }
     33 
     34 void  HELPER(traceInsn)(void)
     35 {
     36     trace_insn_helper();
     37 }
     38 
     39 #if HOST_LONG_BITS == 32
     40 void HELPER(traceBB32)(uint64_t  bb_num, uint32_t  tb)
     41 {
     42     trace_bb_helper(bb_num, (void*)tb);
     43 }
     44 #endif
     45 
     46 #if HOST_LONG_BITS == 64
     47 void HELPER(traceBB64)(uint64_t  bb_num, uint64_t  tb)
     48 {
     49     trace_bb_helper(bb_num, (void*)tb);
     50 }
     51 #endif
     52 
     53 #endif /* CONFIG_TRACE */
     54 
     55 #ifdef CONFIG_MEMCHECK
     56 #include "memcheck/memcheck_api.h"
     57 
     58 void HELPER(on_call)(target_ulong pc, target_ulong ret) {
     59     memcheck_on_call(pc, ret);
     60 }
     61 
     62 void HELPER(on_ret)(target_ulong ret) {
     63     memcheck_on_ret(ret);
     64 }
     65 #endif  // CONFIG_MEMCHECK
     66