main.c (ab129972c8b41e15b0521895a46fd9c752b68a5e) | main.c (2bfe11c8fac96db4f94abbe818fbc964a6744130) |
---|---|
1/* 2 * qemu user main 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 93 unchanged lines hidden (view full) --- 102{ 103 return -1; 104} 105#endif 106 107/***********************************************************/ 108/* Helper routines for implementing atomic operations. */ 109 | 1/* 2 * qemu user main 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 93 unchanged lines hidden (view full) --- 102{ 103 return -1; 104} 105#endif 106 107/***********************************************************/ 108/* Helper routines for implementing atomic operations. */ 109 |
110/* To implement exclusive operations we force all cpus to syncronise. 111 We don't require a full sync, only that no cpus are executing guest code. 112 The alternative is to map target atomic ops onto host equivalents, 113 which requires quite a lot of per host/target work. */ 114static pthread_mutex_t cpu_list_mutex = PTHREAD_MUTEX_INITIALIZER; 115static pthread_mutex_t exclusive_lock = PTHREAD_MUTEX_INITIALIZER; 116static pthread_cond_t exclusive_cond = PTHREAD_COND_INITIALIZER; 117static pthread_cond_t exclusive_resume = PTHREAD_COND_INITIALIZER; 118static int pending_cpus; 119 |
|
110/* Make sure everything is in a consistent state for calling fork(). */ 111void fork_start(void) 112{ | 120/* Make sure everything is in a consistent state for calling fork(). */ 121void fork_start(void) 122{ |
113 cpu_list_lock(); | |
114 qemu_mutex_lock(&tcg_ctx.tb_ctx.tb_lock); | 123 qemu_mutex_lock(&tcg_ctx.tb_ctx.tb_lock); |
124 pthread_mutex_lock(&exclusive_lock); |
|
115 mmap_fork_start(); 116} 117 118void fork_end(int child) 119{ 120 mmap_fork_end(child); 121 if (child) { 122 CPUState *cpu, *next_cpu; 123 /* Child processes created by fork() only have a single thread. 124 Discard information about the parent threads. */ 125 CPU_FOREACH_SAFE(cpu, next_cpu) { 126 if (cpu != thread_cpu) { 127 QTAILQ_REMOVE(&cpus, cpu, node); 128 } 129 } | 125 mmap_fork_start(); 126} 127 128void fork_end(int child) 129{ 130 mmap_fork_end(child); 131 if (child) { 132 CPUState *cpu, *next_cpu; 133 /* Child processes created by fork() only have a single thread. 134 Discard information about the parent threads. */ 135 CPU_FOREACH_SAFE(cpu, next_cpu) { 136 if (cpu != thread_cpu) { 137 QTAILQ_REMOVE(&cpus, cpu, node); 138 } 139 } |
140 pending_cpus = 0; 141 pthread_mutex_init(&exclusive_lock, NULL); 142 pthread_mutex_init(&cpu_list_mutex, NULL); 143 pthread_cond_init(&exclusive_cond, NULL); 144 pthread_cond_init(&exclusive_resume, NULL); |
|
130 qemu_mutex_init(&tcg_ctx.tb_ctx.tb_lock); | 145 qemu_mutex_init(&tcg_ctx.tb_ctx.tb_lock); |
131 qemu_init_cpu_list(); | |
132 gdbserver_fork(thread_cpu); 133 } else { | 146 gdbserver_fork(thread_cpu); 147 } else { |
148 pthread_mutex_unlock(&exclusive_lock); |
|
134 qemu_mutex_unlock(&tcg_ctx.tb_ctx.tb_lock); | 149 qemu_mutex_unlock(&tcg_ctx.tb_ctx.tb_lock); |
135 cpu_list_unlock(); | |
136 } 137} 138 | 150 } 151} 152 |
153/* Wait for pending exclusive operations to complete. The exclusive lock 154 must be held. */ 155static inline void exclusive_idle(void) 156{ 157 while (pending_cpus) { 158 pthread_cond_wait(&exclusive_resume, &exclusive_lock); 159 } 160} 161 162/* Start an exclusive operation. 163 Must only be called from outside cpu_exec. */ 164static inline void start_exclusive(void) 165{ 166 CPUState *other_cpu; 167 168 pthread_mutex_lock(&exclusive_lock); 169 exclusive_idle(); 170 171 pending_cpus = 1; 172 /* Make all other cpus stop executing. */ 173 CPU_FOREACH(other_cpu) { 174 if (other_cpu->running) { 175 pending_cpus++; 176 cpu_exit(other_cpu); 177 } 178 } 179 if (pending_cpus > 1) { 180 pthread_cond_wait(&exclusive_cond, &exclusive_lock); 181 } 182} 183 184/* Finish an exclusive operation. */ 185static inline void __attribute__((unused)) end_exclusive(void) 186{ 187 pending_cpus = 0; 188 pthread_cond_broadcast(&exclusive_resume); 189 pthread_mutex_unlock(&exclusive_lock); 190} 191 192/* Wait for exclusive ops to finish, and begin cpu execution. */ 193static inline void cpu_exec_start(CPUState *cpu) 194{ 195 pthread_mutex_lock(&exclusive_lock); 196 exclusive_idle(); 197 cpu->running = true; 198 pthread_mutex_unlock(&exclusive_lock); 199} 200 201/* Mark cpu as not executing, and release pending exclusive ops. */ 202static inline void cpu_exec_end(CPUState *cpu) 203{ 204 pthread_mutex_lock(&exclusive_lock); 205 cpu->running = false; 206 if (pending_cpus > 1) { 207 pending_cpus--; 208 if (pending_cpus == 1) { 209 pthread_cond_signal(&exclusive_cond); 210 } 211 } 212 exclusive_idle(); 213 pthread_mutex_unlock(&exclusive_lock); 214} 215 216void cpu_list_lock(void) 217{ 218 pthread_mutex_lock(&cpu_list_mutex); 219} 220 221void cpu_list_unlock(void) 222{ 223 pthread_mutex_unlock(&cpu_list_mutex); 224} 225 226 |
|
139#ifdef TARGET_I386 140/***********************************************************/ 141/* CPUX86 core interface */ 142 143uint64_t cpu_get_tsc(CPUX86State *env) 144{ 145 return cpu_get_host_ticks(); 146} --- 56 unchanged lines hidden (view full) --- 203 abi_ulong pc; 204 abi_ulong ret; 205 target_siginfo_t info; 206 207 for(;;) { 208 cpu_exec_start(cs); 209 trapnr = cpu_exec(cs); 210 cpu_exec_end(cs); | 227#ifdef TARGET_I386 228/***********************************************************/ 229/* CPUX86 core interface */ 230 231uint64_t cpu_get_tsc(CPUX86State *env) 232{ 233 return cpu_get_host_ticks(); 234} --- 56 unchanged lines hidden (view full) --- 291 abi_ulong pc; 292 abi_ulong ret; 293 target_siginfo_t info; 294 295 for(;;) { 296 cpu_exec_start(cs); 297 trapnr = cpu_exec(cs); 298 cpu_exec_end(cs); |
211 process_queued_cpu_work(cs); 212 | |
213 switch(trapnr) { 214 case 0x80: 215 /* linux syscall from int $0x80 */ 216 ret = do_syscall(env, 217 env->regs[R_EAX], 218 env->regs[R_EBX], 219 env->regs[R_ECX], 220 env->regs[R_EDX], --- 425 unchanged lines hidden (view full) --- 646 target_siginfo_t info; 647 uint32_t addr; 648 abi_ulong ret; 649 650 for(;;) { 651 cpu_exec_start(cs); 652 trapnr = cpu_exec(cs); 653 cpu_exec_end(cs); | 299 switch(trapnr) { 300 case 0x80: 301 /* linux syscall from int $0x80 */ 302 ret = do_syscall(env, 303 env->regs[R_EAX], 304 env->regs[R_EBX], 305 env->regs[R_ECX], 306 env->regs[R_EDX], --- 425 unchanged lines hidden (view full) --- 732 target_siginfo_t info; 733 uint32_t addr; 734 abi_ulong ret; 735 736 for(;;) { 737 cpu_exec_start(cs); 738 trapnr = cpu_exec(cs); 739 cpu_exec_end(cs); |
654 process_queued_cpu_work(cs); 655 | |
656 switch(trapnr) { 657 case EXCP_UDEF: 658 { 659 TaskState *ts = cs->opaque; 660 uint32_t opcode; 661 int rc; 662 663 /* we handle the FPU emulation here, as Linux */ --- 320 unchanged lines hidden (view full) --- 984 int trapnr, sig; 985 abi_long ret; 986 target_siginfo_t info; 987 988 for (;;) { 989 cpu_exec_start(cs); 990 trapnr = cpu_exec(cs); 991 cpu_exec_end(cs); | 740 switch(trapnr) { 741 case EXCP_UDEF: 742 { 743 TaskState *ts = cs->opaque; 744 uint32_t opcode; 745 int rc; 746 747 /* we handle the FPU emulation here, as Linux */ --- 320 unchanged lines hidden (view full) --- 1068 int trapnr, sig; 1069 abi_long ret; 1070 target_siginfo_t info; 1071 1072 for (;;) { 1073 cpu_exec_start(cs); 1074 trapnr = cpu_exec(cs); 1075 cpu_exec_end(cs); |
992 process_queued_cpu_work(cs); | |
993 994 switch (trapnr) { 995 case EXCP_SWI: 996 ret = do_syscall(env, 997 env->xregs[8], 998 env->xregs[0], 999 env->xregs[1], 1000 env->xregs[2], --- 72 unchanged lines hidden (view full) --- 1073 int trapnr; 1074 unsigned int n, insn; 1075 target_siginfo_t info; 1076 1077 for (;;) { 1078 cpu_exec_start(cs); 1079 trapnr = cpu_exec(cs); 1080 cpu_exec_end(cs); | 1076 1077 switch (trapnr) { 1078 case EXCP_SWI: 1079 ret = do_syscall(env, 1080 env->xregs[8], 1081 env->xregs[0], 1082 env->xregs[1], 1083 env->xregs[2], --- 72 unchanged lines hidden (view full) --- 1156 int trapnr; 1157 unsigned int n, insn; 1158 target_siginfo_t info; 1159 1160 for (;;) { 1161 cpu_exec_start(cs); 1162 trapnr = cpu_exec(cs); 1163 cpu_exec_end(cs); |
1081 process_queued_cpu_work(cs); 1082 | |
1083 switch (trapnr) { 1084 case UC32_EXCP_PRIV: 1085 { 1086 /* system call */ 1087 get_user_u32(insn, env->regs[31] - 4); 1088 n = insn & 0xffffff; 1089 1090 if (n >= UC32_SYSCALL_BASE) { --- 189 unchanged lines hidden (view full) --- 1280 int trapnr; 1281 abi_long ret; 1282 target_siginfo_t info; 1283 1284 while (1) { 1285 cpu_exec_start(cs); 1286 trapnr = cpu_exec(cs); 1287 cpu_exec_end(cs); | 1164 switch (trapnr) { 1165 case UC32_EXCP_PRIV: 1166 { 1167 /* system call */ 1168 get_user_u32(insn, env->regs[31] - 4); 1169 n = insn & 0xffffff; 1170 1171 if (n >= UC32_SYSCALL_BASE) { --- 189 unchanged lines hidden (view full) --- 1361 int trapnr; 1362 abi_long ret; 1363 target_siginfo_t info; 1364 1365 while (1) { 1366 cpu_exec_start(cs); 1367 trapnr = cpu_exec(cs); 1368 cpu_exec_end(cs); |
1288 process_queued_cpu_work(cs); | |
1289 1290 /* Compute PSR before exposing state. */ 1291 if (env->cc_op != CC_OP_FLAGS) { 1292 cpu_get_psr(env); 1293 } 1294 1295 switch (trapnr) { 1296#ifndef TARGET_SPARC64 --- 256 unchanged lines hidden (view full) --- 1553 target_siginfo_t info; 1554 int trapnr; 1555 target_ulong ret; 1556 1557 for(;;) { 1558 cpu_exec_start(cs); 1559 trapnr = cpu_exec(cs); 1560 cpu_exec_end(cs); | 1369 1370 /* Compute PSR before exposing state. */ 1371 if (env->cc_op != CC_OP_FLAGS) { 1372 cpu_get_psr(env); 1373 } 1374 1375 switch (trapnr) { 1376#ifndef TARGET_SPARC64 --- 256 unchanged lines hidden (view full) --- 1633 target_siginfo_t info; 1634 int trapnr; 1635 target_ulong ret; 1636 1637 for(;;) { 1638 cpu_exec_start(cs); 1639 trapnr = cpu_exec(cs); 1640 cpu_exec_end(cs); |
1561 process_queued_cpu_work(cs); 1562 | |
1563 switch(trapnr) { 1564 case POWERPC_EXCP_NONE: 1565 /* Just go on */ 1566 break; 1567 case POWERPC_EXCP_CRITICAL: /* Critical input */ 1568 cpu_abort(cs, "Critical interrupt while in user mode. " 1569 "Aborting\n"); 1570 break; --- 830 unchanged lines hidden (view full) --- 2401# ifdef TARGET_ABI_MIPSO32 2402 unsigned int syscall_num; 2403# endif 2404 2405 for(;;) { 2406 cpu_exec_start(cs); 2407 trapnr = cpu_exec(cs); 2408 cpu_exec_end(cs); | 1641 switch(trapnr) { 1642 case POWERPC_EXCP_NONE: 1643 /* Just go on */ 1644 break; 1645 case POWERPC_EXCP_CRITICAL: /* Critical input */ 1646 cpu_abort(cs, "Critical interrupt while in user mode. " 1647 "Aborting\n"); 1648 break; --- 830 unchanged lines hidden (view full) --- 2479# ifdef TARGET_ABI_MIPSO32 2480 unsigned int syscall_num; 2481# endif 2482 2483 for(;;) { 2484 cpu_exec_start(cs); 2485 trapnr = cpu_exec(cs); 2486 cpu_exec_end(cs); |
2409 process_queued_cpu_work(cs); 2410 | |
2411 switch(trapnr) { 2412 case EXCP_SYSCALL: 2413 env->active_tc.PC += 4; 2414# ifdef TARGET_ABI_MIPSO32 2415 syscall_num = env->active_tc.gpr[2] - 4000; 2416 if (syscall_num >= sizeof(mips_syscall_args)) { 2417 ret = -TARGET_ENOSYS; 2418 } else { --- 224 unchanged lines hidden (view full) --- 2643 CPUState *cs = CPU(openrisc_env_get_cpu(env)); 2644 int trapnr, gdbsig; 2645 abi_long ret; 2646 2647 for (;;) { 2648 cpu_exec_start(cs); 2649 trapnr = cpu_exec(cs); 2650 cpu_exec_end(cs); | 2487 switch(trapnr) { 2488 case EXCP_SYSCALL: 2489 env->active_tc.PC += 4; 2490# ifdef TARGET_ABI_MIPSO32 2491 syscall_num = env->active_tc.gpr[2] - 4000; 2492 if (syscall_num >= sizeof(mips_syscall_args)) { 2493 ret = -TARGET_ENOSYS; 2494 } else { --- 224 unchanged lines hidden (view full) --- 2719 CPUState *cs = CPU(openrisc_env_get_cpu(env)); 2720 int trapnr, gdbsig; 2721 abi_long ret; 2722 2723 for (;;) { 2724 cpu_exec_start(cs); 2725 trapnr = cpu_exec(cs); 2726 cpu_exec_end(cs); |
2651 process_queued_cpu_work(cs); | |
2652 gdbsig = 0; 2653 2654 switch (trapnr) { 2655 case EXCP_RESET: 2656 qemu_log_mask(CPU_LOG_INT, "\nReset request, exit, pc is %#x\n", env->pc); 2657 exit(EXIT_FAILURE); 2658 break; 2659 case EXCP_BUSERR: --- 78 unchanged lines hidden (view full) --- 2738 CPUState *cs = CPU(sh_env_get_cpu(env)); 2739 int trapnr, ret; 2740 target_siginfo_t info; 2741 2742 while (1) { 2743 cpu_exec_start(cs); 2744 trapnr = cpu_exec(cs); 2745 cpu_exec_end(cs); | 2727 gdbsig = 0; 2728 2729 switch (trapnr) { 2730 case EXCP_RESET: 2731 qemu_log_mask(CPU_LOG_INT, "\nReset request, exit, pc is %#x\n", env->pc); 2732 exit(EXIT_FAILURE); 2733 break; 2734 case EXCP_BUSERR: --- 78 unchanged lines hidden (view full) --- 2813 CPUState *cs = CPU(sh_env_get_cpu(env)); 2814 int trapnr, ret; 2815 target_siginfo_t info; 2816 2817 while (1) { 2818 cpu_exec_start(cs); 2819 trapnr = cpu_exec(cs); 2820 cpu_exec_end(cs); |
2746 process_queued_cpu_work(cs); | |
2747 2748 switch (trapnr) { 2749 case 0x160: 2750 env->pc += 2; 2751 ret = do_syscall(env, 2752 env->gregs[3], 2753 env->gregs[4], 2754 env->gregs[5], --- 50 unchanged lines hidden (view full) --- 2805 CPUState *cs = CPU(cris_env_get_cpu(env)); 2806 int trapnr, ret; 2807 target_siginfo_t info; 2808 2809 while (1) { 2810 cpu_exec_start(cs); 2811 trapnr = cpu_exec(cs); 2812 cpu_exec_end(cs); | 2821 2822 switch (trapnr) { 2823 case 0x160: 2824 env->pc += 2; 2825 ret = do_syscall(env, 2826 env->gregs[3], 2827 env->gregs[4], 2828 env->gregs[5], --- 50 unchanged lines hidden (view full) --- 2879 CPUState *cs = CPU(cris_env_get_cpu(env)); 2880 int trapnr, ret; 2881 target_siginfo_t info; 2882 2883 while (1) { 2884 cpu_exec_start(cs); 2885 trapnr = cpu_exec(cs); 2886 cpu_exec_end(cs); |
2813 process_queued_cpu_work(cs); 2814 | |
2815 switch (trapnr) { 2816 case 0xaa: 2817 { 2818 info.si_signo = TARGET_SIGSEGV; 2819 info.si_errno = 0; 2820 /* XXX: check env->error_code */ 2821 info.si_code = TARGET_SEGV_MAPERR; 2822 info._sifields._sigfault._addr = env->pregs[PR_EDA]; --- 49 unchanged lines hidden (view full) --- 2872 CPUState *cs = CPU(mb_env_get_cpu(env)); 2873 int trapnr, ret; 2874 target_siginfo_t info; 2875 2876 while (1) { 2877 cpu_exec_start(cs); 2878 trapnr = cpu_exec(cs); 2879 cpu_exec_end(cs); | 2887 switch (trapnr) { 2888 case 0xaa: 2889 { 2890 info.si_signo = TARGET_SIGSEGV; 2891 info.si_errno = 0; 2892 /* XXX: check env->error_code */ 2893 info.si_code = TARGET_SEGV_MAPERR; 2894 info._sifields._sigfault._addr = env->pregs[PR_EDA]; --- 49 unchanged lines hidden (view full) --- 2944 CPUState *cs = CPU(mb_env_get_cpu(env)); 2945 int trapnr, ret; 2946 target_siginfo_t info; 2947 2948 while (1) { 2949 cpu_exec_start(cs); 2950 trapnr = cpu_exec(cs); 2951 cpu_exec_end(cs); |
2880 process_queued_cpu_work(cs); 2881 | |
2882 switch (trapnr) { 2883 case 0xaa: 2884 { 2885 info.si_signo = TARGET_SIGSEGV; 2886 info.si_errno = 0; 2887 /* XXX: check env->error_code */ 2888 info.si_code = TARGET_SEGV_MAPERR; 2889 info._sifields._sigfault._addr = 0; --- 101 unchanged lines hidden (view full) --- 2991 unsigned int n; 2992 target_siginfo_t info; 2993 TaskState *ts = cs->opaque; 2994 2995 for(;;) { 2996 cpu_exec_start(cs); 2997 trapnr = cpu_exec(cs); 2998 cpu_exec_end(cs); | 2952 switch (trapnr) { 2953 case 0xaa: 2954 { 2955 info.si_signo = TARGET_SIGSEGV; 2956 info.si_errno = 0; 2957 /* XXX: check env->error_code */ 2958 info.si_code = TARGET_SEGV_MAPERR; 2959 info._sifields._sigfault._addr = 0; --- 101 unchanged lines hidden (view full) --- 3061 unsigned int n; 3062 target_siginfo_t info; 3063 TaskState *ts = cs->opaque; 3064 3065 for(;;) { 3066 cpu_exec_start(cs); 3067 trapnr = cpu_exec(cs); 3068 cpu_exec_end(cs); |
2999 process_queued_cpu_work(cs); 3000 | |
3001 switch(trapnr) { 3002 case EXCP_ILLEGAL: 3003 { 3004 if (ts->sim_syscalls) { 3005 uint16_t nr; 3006 get_user_u16(nr, env->pc + 2); 3007 env->pc += 4; 3008 do_m68k_simcall(env, nr); --- 127 unchanged lines hidden (view full) --- 3136 int trapnr; 3137 target_siginfo_t info; 3138 abi_long sysret; 3139 3140 while (1) { 3141 cpu_exec_start(cs); 3142 trapnr = cpu_exec(cs); 3143 cpu_exec_end(cs); | 3069 switch(trapnr) { 3070 case EXCP_ILLEGAL: 3071 { 3072 if (ts->sim_syscalls) { 3073 uint16_t nr; 3074 get_user_u16(nr, env->pc + 2); 3075 env->pc += 4; 3076 do_m68k_simcall(env, nr); --- 127 unchanged lines hidden (view full) --- 3204 int trapnr; 3205 target_siginfo_t info; 3206 abi_long sysret; 3207 3208 while (1) { 3209 cpu_exec_start(cs); 3210 trapnr = cpu_exec(cs); 3211 cpu_exec_end(cs); |
3144 process_queued_cpu_work(cs); | |
3145 3146 /* All of the traps imply a transition through PALcode, which 3147 implies an REI instruction has been executed. Which means 3148 that the intr_flag should be cleared. */ 3149 env->intr_flag = 0; 3150 3151 switch (trapnr) { 3152 case EXCP_RESET: --- 176 unchanged lines hidden (view full) --- 3329 target_siginfo_t info; 3330 target_ulong addr; 3331 abi_long ret; 3332 3333 while (1) { 3334 cpu_exec_start(cs); 3335 trapnr = cpu_exec(cs); 3336 cpu_exec_end(cs); | 3212 3213 /* All of the traps imply a transition through PALcode, which 3214 implies an REI instruction has been executed. Which means 3215 that the intr_flag should be cleared. */ 3216 env->intr_flag = 0; 3217 3218 switch (trapnr) { 3219 case EXCP_RESET: --- 176 unchanged lines hidden (view full) --- 3396 target_siginfo_t info; 3397 target_ulong addr; 3398 abi_long ret; 3399 3400 while (1) { 3401 cpu_exec_start(cs); 3402 trapnr = cpu_exec(cs); 3403 cpu_exec_end(cs); |
3337 process_queued_cpu_work(cs); 3338 | |
3339 switch (trapnr) { 3340 case EXCP_INTERRUPT: 3341 /* Just indicate that signals should be handled asap. */ 3342 break; 3343 3344 case EXCP_SVC: 3345 n = env->int_svc_code; 3346 if (!n) { --- 293 unchanged lines hidden (view full) --- 3640{ 3641 CPUState *cs = CPU(tilegx_env_get_cpu(env)); 3642 int trapnr; 3643 3644 while (1) { 3645 cpu_exec_start(cs); 3646 trapnr = cpu_exec(cs); 3647 cpu_exec_end(cs); | 3404 switch (trapnr) { 3405 case EXCP_INTERRUPT: 3406 /* Just indicate that signals should be handled asap. */ 3407 break; 3408 3409 case EXCP_SVC: 3410 n = env->int_svc_code; 3411 if (!n) { --- 293 unchanged lines hidden (view full) --- 3705{ 3706 CPUState *cs = CPU(tilegx_env_get_cpu(env)); 3707 int trapnr; 3708 3709 while (1) { 3710 cpu_exec_start(cs); 3711 trapnr = cpu_exec(cs); 3712 cpu_exec_end(cs); |
3648 process_queued_cpu_work(cs); 3649 | |
3650 switch (trapnr) { 3651 case TILEGX_EXCP_SYSCALL: 3652 { 3653 abi_ulong ret = do_syscall(env, env->regs[TILEGX_R_NR], 3654 env->regs[0], env->regs[1], 3655 env->regs[2], env->regs[3], 3656 env->regs[4], env->regs[5], 3657 env->regs[6], env->regs[7]); --- 43 unchanged lines hidden (view full) --- 3701 process_pending_signals(env); 3702 } 3703} 3704 3705#endif 3706 3707THREAD CPUState *thread_cpu; 3708 | 3713 switch (trapnr) { 3714 case TILEGX_EXCP_SYSCALL: 3715 { 3716 abi_ulong ret = do_syscall(env, env->regs[TILEGX_R_NR], 3717 env->regs[0], env->regs[1], 3718 env->regs[2], env->regs[3], 3719 env->regs[4], env->regs[5], 3720 env->regs[6], env->regs[7]); --- 43 unchanged lines hidden (view full) --- 3764 process_pending_signals(env); 3765 } 3766} 3767 3768#endif 3769 3770THREAD CPUState *thread_cpu; 3771 |
3709bool qemu_cpu_is_self(CPUState *cpu) 3710{ 3711 return thread_cpu == cpu; 3712} 3713 3714void qemu_cpu_kick(CPUState *cpu) 3715{ 3716 cpu_exit(cpu); 3717} 3718 | |
3719void task_settid(TaskState *ts) 3720{ 3721 if (ts->ts_tid == 0) { 3722 ts->ts_tid = (pid_t)syscall(SYS_gettid); 3723 } 3724} 3725 3726void stop_all_tasks(void) --- 426 unchanged lines hidden (view full) --- 4153 int optind; 4154 char **target_environ, **wrk; 4155 char **target_argv; 4156 int target_argc; 4157 int i; 4158 int ret; 4159 int execfd; 4160 | 3772void task_settid(TaskState *ts) 3773{ 3774 if (ts->ts_tid == 0) { 3775 ts->ts_tid = (pid_t)syscall(SYS_gettid); 3776 } 3777} 3778 3779void stop_all_tasks(void) --- 426 unchanged lines hidden (view full) --- 4206 int optind; 4207 char **target_environ, **wrk; 4208 char **target_argv; 4209 int target_argc; 4210 int i; 4211 int ret; 4212 int execfd; 4213 |
4161 qemu_init_cpu_list(); | |
4162 module_call_init(MODULE_INIT_QOM); 4163 4164 if ((envlist = envlist_create()) == NULL) { 4165 (void) fprintf(stderr, "Unable to allocate envlist\n"); 4166 exit(EXIT_FAILURE); 4167 } 4168 4169 /* add current environment into the list */ --- 573 unchanged lines hidden (view full) --- 4743 if (gdbstub_port) { 4744 if (gdbserver_start(gdbstub_port) < 0) { 4745 fprintf(stderr, "qemu: could not open gdbserver on port %d\n", 4746 gdbstub_port); 4747 exit(EXIT_FAILURE); 4748 } 4749 gdb_handlesig(cpu, 0); 4750 } | 4214 module_call_init(MODULE_INIT_QOM); 4215 4216 if ((envlist = envlist_create()) == NULL) { 4217 (void) fprintf(stderr, "Unable to allocate envlist\n"); 4218 exit(EXIT_FAILURE); 4219 } 4220 4221 /* add current environment into the list */ --- 573 unchanged lines hidden (view full) --- 4795 if (gdbstub_port) { 4796 if (gdbserver_start(gdbstub_port) < 0) { 4797 fprintf(stderr, "qemu: could not open gdbserver on port %d\n", 4798 gdbstub_port); 4799 exit(EXIT_FAILURE); 4800 } 4801 gdb_handlesig(cpu, 0); 4802 } |
4751 trace_init_vcpu_events(); | |
4752 cpu_loop(env); 4753 /* never exits */ 4754 return 0; 4755} | 4803 cpu_loop(env); 4804 /* never exits */ 4805 return 0; 4806} |