Changeset 37675 in vbox for trunk/src/recompiler/cpu-exec.c
- Timestamp:
- Jun 29, 2011 7:07:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/cpu-exec.c
r36768 r37675 49 49 #endif 50 50 51 #if defined(__sparc__) && !defined( HOST_SOLARIS)51 #if defined(__sparc__) && !defined(CONFIG_SOLARIS) 52 52 // Work around ugly bugs in glibc that mangle global register contents 53 53 #undef env … … 57 57 int tb_invalidated_flag; 58 58 59 //#define DEBUG_EXEC59 //#define CONFIG_DEBUG_EXEC 60 60 //#define DEBUG_SIGNAL 61 61 … … 217 217 218 218 if (!env->watchpoint_hit) 219 TAILQ_FOREACH(wp, &env->watchpoints, entry)219 QTAILQ_FOREACH(wp, &env->watchpoints, entry) 220 220 wp->flags &= ~BP_WATCHPOINT_HIT; 221 221 … … 425 425 RAWEx_ProfileStop(env, STATS_RAW_CHECK); 426 426 427 { 428 RTGCPTR mypc = env->eip + env->segs[R_CS].base; 429 if (mypc == 0x00fe0d2 || mypc == 0x00f19e9 || mypc == 0x000f0827 || mypc == 0x000fe090) { 430 RTLogFlags(NULL, "enabled"); 431 loglevel = ~0; 432 Log(("BANG CRASH!\n")); 433 } 434 } 435 #ifdef CONFIG_DEBUG_EXEC 436 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { 437 /* restore flags in standard format */ 438 regs_to_env(); 439 env->eflags = env->eflags | helper_cc_compute_all(CC_OP) | (DF & DF_MASK); 440 log_cpu_state(env, X86_DUMP_CCOP); 441 env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); 442 } 443 #endif 427 444 RAWEx_ProfileStart(env, STATS_TLB_LOOKUP); 428 445 spin_lock(&tb_lock); … … 437 454 tb_invalidated_flag = 0; 438 455 } 456 #ifdef CONFIG_DEBUG_EXEC 457 qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s [sp=%RGv, bp=%RGv\n", 458 (long)tb->tc_ptr, tb->pc, lookup_symbol(tb->pc), (RTGCPTR)env->regs[R_ESP], (RTGCPTR)env->regs[R_EBP]); 459 #endif 460 439 461 440 462 /* see if we can patch the calling TB. When the TB … … 562 584 env_to_regs(); 563 585 #if defined(TARGET_I386) 564 /* put eflags in CPU temporary format */ 565 CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); 566 DF = 1 - (2 * ((env->eflags >> 10) & 1)); 567 CC_OP = CC_OP_EFLAGS; 568 env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); 586 if (!kvm_enabled()) { 587 /* put eflags in CPU temporary format */ 588 CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); 589 DF = 1 - (2 * ((env->eflags >> 10) & 1)); 590 CC_OP = CC_OP_EFLAGS; 591 env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); 592 } 569 593 #elif defined(TARGET_SPARC) 570 594 #elif defined(TARGET_M68K) … … 579 603 #elif defined(TARGET_SH4) 580 604 #elif defined(TARGET_CRIS) 605 #elif defined(TARGET_S390X) 581 606 /* XXXXX */ 582 607 #else … … 588 613 for(;;) { 589 614 if (setjmp(env->jmp_env) == 0) { 590 #if defined(__sparc__) && !defined( HOST_SOLARIS)615 #if defined(__sparc__) && !defined(CONFIG_SOLARIS) 591 616 #undef env 592 617 env = cpu_single_env; … … 651 676 env->exception_index = -1; 652 677 } 653 #ifdef CONFIG_KQEMU654 if (kqemu_is_ok(env) && env->interrupt_request == 0 && env->exit_request == 0) {655 int ret;656 env->eflags = env->eflags | helper_cc_compute_all(CC_OP) | (DF & DF_MASK);657 ret = kqemu_cpu_exec(env);658 /* put eflags in CPU temporary format */659 CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);660 DF = 1 - (2 * ((env->eflags >> 10) & 1));661 CC_OP = CC_OP_EFLAGS;662 env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);663 if (ret == 1) {664 /* exception */665 longjmp(env->jmp_env, 1);666 } else if (ret == 2) {667 /* softmmu execution needed */668 } else {669 if (env->interrupt_request != 0 || env->exit_request != 0) {670 /* hardware interrupt will be executed just after */671 } else {672 /* otherwise, we restart */673 longjmp(env->jmp_env, 1);674 }675 }676 }677 #endif678 678 679 679 if (kvm_enabled()) { … … 744 744 intno = cpu_get_pic_interrupt(env); 745 745 qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); 746 #if defined(__sparc__) && !defined( HOST_SOLARIS)746 #if defined(__sparc__) && !defined(CONFIG_SOLARIS) 747 747 #undef env 748 748 env = cpu_single_env; … … 771 771 #if 0 772 772 if ((interrupt_request & CPU_INTERRUPT_RESET)) { 773 cpu_ ppc_reset(env);773 cpu_reset(env); 774 774 } 775 775 #endif … … 815 815 do_interrupt(env); 816 816 env->interrupt_index = 0; 817 #if !defined(CONFIG_USER_ONLY)818 cpu_check_irqs(env);819 #endif820 817 next_tb = 0; 821 818 } … … 898 895 cpu_loop_exit(); 899 896 } 900 #ifdef DEBUG_EXEC897 #ifdef CONFIG_DEBUG_EXEC 901 898 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { 902 899 /* restore flags in standard format */ … … 944 941 tb_invalidated_flag = 0; 945 942 } 946 #ifdef DEBUG_EXEC943 #ifdef CONFIG_DEBUG_EXEC 947 944 qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", 948 945 (long)tb->tc_ptr, tb->pc, … … 953 950 jump. */ 954 951 { 955 if (next_tb != 0 && 956 #ifdef CONFIG_KQEMU 957 (env->kqemu_enabled != 2) && 958 #endif 959 tb->page_addr[1] == -1) { 952 if (next_tb != 0 && tb->page_addr[1] == -1) { 960 953 tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); 961 954 } … … 974 967 tc_ptr = tb->tc_ptr; 975 968 /* execute the generated code */ 976 #if defined(__sparc__) && !defined( HOST_SOLARIS)969 #if defined(__sparc__) && !defined(CONFIG_SOLARIS) 977 970 #undef env 978 971 env = cpu_single_env; … … 1011 1004 /* reset soft MMU for next block (it can currently 1012 1005 only be set by a memory fault) */ 1013 #if defined(CONFIG_KQEMU)1014 #define MIN_CYCLE_BEFORE_SWITCH (100 * 1000)1015 if (kqemu_is_ok(env) &&1016 (cpu_get_time_fast() - env->last_io_time) >= MIN_CYCLE_BEFORE_SWITCH) {1017 cpu_loop_exit();1018 }1019 #endif1020 1006 } /* for(;;) */ 1021 1007 } else { … … 1042 1028 #elif defined(TARGET_ALPHA) 1043 1029 #elif defined(TARGET_CRIS) 1030 #elif defined(TARGET_S390X) 1044 1031 /* XXXXX */ 1045 1032 #else … … 1117 1104 1118 1105 #if defined(TARGET_I386) 1106 #define EXCEPTION_ACTION raise_exception_err(env->exception_index, env->error_code) 1107 #else 1108 #define EXCEPTION_ACTION cpu_loop_exit() 1109 #endif 1119 1110 1120 1111 /* 'pc' is the host PC at which the exception was raised. 'address' is … … 1141 1132 1142 1133 /* see if it is an MMU fault */ 1143 ret = cpu_ x86_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1134 ret = cpu_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0); 1144 1135 if (ret < 0) 1145 1136 return 0; /* not an MMU fault */ … … 1153 1144 cpu_restore_state(tb, env, pc, puc); 1154 1145 } 1155 if (ret == 1) { 1156 #if 0 1157 printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", 1158 env->eip, env->cr[2], env->error_code); 1159 #endif 1160 /* we restore the process signal mask as the sigreturn should 1161 do it (XXX: use sigsetjmp) */ 1162 sigprocmask(SIG_SETMASK, old_set, NULL); 1163 raise_exception_err(env->exception_index, env->error_code); 1164 } else { 1165 /* activate soft MMU for this block */ 1166 env->hflags |= HF_SOFTMMU_MASK; 1167 cpu_resume_from_signal(env, puc); 1168 } 1169 /* never comes here */ 1170 return 1; 1171 } 1172 1173 #elif defined(TARGET_ARM) 1174 static inline int handle_cpu_signal(unsigned long pc, unsigned long address, 1175 int is_write, sigset_t *old_set, 1176 void *puc) 1177 { 1178 TranslationBlock *tb; 1179 int ret; 1180 1181 if (cpu_single_env) 1182 env = cpu_single_env; /* XXX: find a correct solution for multithread */ 1183 #if defined(DEBUG_SIGNAL) 1184 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 1185 pc, address, is_write, *(unsigned long *)old_set); 1186 #endif 1187 /* XXX: locking issue */ 1188 if (is_write && page_unprotect(h2g(address), pc, puc)) { 1189 return 1; 1190 } 1191 /* see if it is an MMU fault */ 1192 ret = cpu_arm_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0); 1193 if (ret < 0) 1194 return 0; /* not an MMU fault */ 1195 if (ret == 0) 1196 return 1; /* the MMU fault was handled without causing real CPU fault */ 1197 /* now we have a real cpu fault */ 1198 tb = tb_find_pc(pc); 1199 if (tb) { 1200 /* the PC is inside the translated code. It means that we have 1201 a virtual CPU fault */ 1202 cpu_restore_state(tb, env, pc, puc); 1203 } 1146 1204 1147 /* we restore the process signal mask as the sigreturn should 1205 1148 do it (XXX: use sigsetjmp) */ 1206 1149 sigprocmask(SIG_SETMASK, old_set, NULL); 1207 cpu_loop_exit(); 1150 EXCEPTION_ACTION; 1151 1208 1152 /* never comes here */ 1209 1153 return 1; 1210 1154 } 1211 #elif defined(TARGET_SPARC)1212 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1213 int is_write, sigset_t *old_set,1214 void *puc)1215 {1216 TranslationBlock *tb;1217 int ret;1218 1219 if (cpu_single_env)1220 env = cpu_single_env; /* XXX: find a correct solution for multithread */1221 #if defined(DEBUG_SIGNAL)1222 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1223 pc, address, is_write, *(unsigned long *)old_set);1224 #endif1225 /* XXX: locking issue */1226 if (is_write && page_unprotect(h2g(address), pc, puc)) {1227 return 1;1228 }1229 /* see if it is an MMU fault */1230 ret = cpu_sparc_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1231 if (ret < 0)1232 return 0; /* not an MMU fault */1233 if (ret == 0)1234 return 1; /* the MMU fault was handled without causing real CPU fault */1235 /* now we have a real cpu fault */1236 tb = tb_find_pc(pc);1237 if (tb) {1238 /* the PC is inside the translated code. It means that we have1239 a virtual CPU fault */1240 cpu_restore_state(tb, env, pc, puc);1241 }1242 /* we restore the process signal mask as the sigreturn should1243 do it (XXX: use sigsetjmp) */1244 sigprocmask(SIG_SETMASK, old_set, NULL);1245 cpu_loop_exit();1246 /* never comes here */1247 return 1;1248 }1249 #elif defined (TARGET_PPC)1250 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1251 int is_write, sigset_t *old_set,1252 void *puc)1253 {1254 TranslationBlock *tb;1255 int ret;1256 1257 if (cpu_single_env)1258 env = cpu_single_env; /* XXX: find a correct solution for multithread */1259 #if defined(DEBUG_SIGNAL)1260 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1261 pc, address, is_write, *(unsigned long *)old_set);1262 #endif1263 /* XXX: locking issue */1264 if (is_write && page_unprotect(h2g(address), pc, puc)) {1265 return 1;1266 }1267 1268 /* see if it is an MMU fault */1269 ret = cpu_ppc_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1270 if (ret < 0)1271 return 0; /* not an MMU fault */1272 if (ret == 0)1273 return 1; /* the MMU fault was handled without causing real CPU fault */1274 1275 /* now we have a real cpu fault */1276 tb = tb_find_pc(pc);1277 if (tb) {1278 /* the PC is inside the translated code. It means that we have1279 a virtual CPU fault */1280 cpu_restore_state(tb, env, pc, puc);1281 }1282 if (ret == 1) {1283 #if 01284 printf("PF exception: NIP=0x%08x error=0x%x %p\n",1285 env->nip, env->error_code, tb);1286 #endif1287 /* we restore the process signal mask as the sigreturn should1288 do it (XXX: use sigsetjmp) */1289 sigprocmask(SIG_SETMASK, old_set, NULL);1290 cpu_loop_exit();1291 } else {1292 /* activate soft MMU for this block */1293 cpu_resume_from_signal(env, puc);1294 }1295 /* never comes here */1296 return 1;1297 }1298 1299 #elif defined(TARGET_M68K)1300 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1301 int is_write, sigset_t *old_set,1302 void *puc)1303 {1304 TranslationBlock *tb;1305 int ret;1306 1307 if (cpu_single_env)1308 env = cpu_single_env; /* XXX: find a correct solution for multithread */1309 #if defined(DEBUG_SIGNAL)1310 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1311 pc, address, is_write, *(unsigned long *)old_set);1312 #endif1313 /* XXX: locking issue */1314 if (is_write && page_unprotect(address, pc, puc)) {1315 return 1;1316 }1317 /* see if it is an MMU fault */1318 ret = cpu_m68k_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1319 if (ret < 0)1320 return 0; /* not an MMU fault */1321 if (ret == 0)1322 return 1; /* the MMU fault was handled without causing real CPU fault */1323 /* now we have a real cpu fault */1324 tb = tb_find_pc(pc);1325 if (tb) {1326 /* the PC is inside the translated code. It means that we have1327 a virtual CPU fault */1328 cpu_restore_state(tb, env, pc, puc);1329 }1330 /* we restore the process signal mask as the sigreturn should1331 do it (XXX: use sigsetjmp) */1332 sigprocmask(SIG_SETMASK, old_set, NULL);1333 cpu_loop_exit();1334 /* never comes here */1335 return 1;1336 }1337 1338 #elif defined (TARGET_MIPS)1339 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1340 int is_write, sigset_t *old_set,1341 void *puc)1342 {1343 TranslationBlock *tb;1344 int ret;1345 1346 if (cpu_single_env)1347 env = cpu_single_env; /* XXX: find a correct solution for multithread */1348 #if defined(DEBUG_SIGNAL)1349 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1350 pc, address, is_write, *(unsigned long *)old_set);1351 #endif1352 /* XXX: locking issue */1353 if (is_write && page_unprotect(h2g(address), pc, puc)) {1354 return 1;1355 }1356 1357 /* see if it is an MMU fault */1358 ret = cpu_mips_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1359 if (ret < 0)1360 return 0; /* not an MMU fault */1361 if (ret == 0)1362 return 1; /* the MMU fault was handled without causing real CPU fault */1363 1364 /* now we have a real cpu fault */1365 tb = tb_find_pc(pc);1366 if (tb) {1367 /* the PC is inside the translated code. It means that we have1368 a virtual CPU fault */1369 cpu_restore_state(tb, env, pc, puc);1370 }1371 if (ret == 1) {1372 #if 01373 printf("PF exception: PC=0x" TARGET_FMT_lx " error=0x%x %p\n",1374 env->PC, env->error_code, tb);1375 #endif1376 /* we restore the process signal mask as the sigreturn should1377 do it (XXX: use sigsetjmp) */1378 sigprocmask(SIG_SETMASK, old_set, NULL);1379 cpu_loop_exit();1380 } else {1381 /* activate soft MMU for this block */1382 cpu_resume_from_signal(env, puc);1383 }1384 /* never comes here */1385 return 1;1386 }1387 1388 #elif defined (TARGET_MICROBLAZE)1389 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1390 int is_write, sigset_t *old_set,1391 void *puc)1392 {1393 TranslationBlock *tb;1394 int ret;1395 1396 if (cpu_single_env)1397 env = cpu_single_env; /* XXX: find a correct solution for multithread */1398 #if defined(DEBUG_SIGNAL)1399 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1400 pc, address, is_write, *(unsigned long *)old_set);1401 #endif1402 /* XXX: locking issue */1403 if (is_write && page_unprotect(h2g(address), pc, puc)) {1404 return 1;1405 }1406 1407 /* see if it is an MMU fault */1408 ret = cpu_mb_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1409 if (ret < 0)1410 return 0; /* not an MMU fault */1411 if (ret == 0)1412 return 1; /* the MMU fault was handled without causing real CPU fault */1413 1414 /* now we have a real cpu fault */1415 tb = tb_find_pc(pc);1416 if (tb) {1417 /* the PC is inside the translated code. It means that we have1418 a virtual CPU fault */1419 cpu_restore_state(tb, env, pc, puc);1420 }1421 if (ret == 1) {1422 #if 01423 printf("PF exception: PC=0x" TARGET_FMT_lx " error=0x%x %p\n",1424 env->PC, env->error_code, tb);1425 #endif1426 /* we restore the process signal mask as the sigreturn should1427 do it (XXX: use sigsetjmp) */1428 sigprocmask(SIG_SETMASK, old_set, NULL);1429 cpu_loop_exit();1430 } else {1431 /* activate soft MMU for this block */1432 cpu_resume_from_signal(env, puc);1433 }1434 /* never comes here */1435 return 1;1436 }1437 1438 #elif defined (TARGET_SH4)1439 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1440 int is_write, sigset_t *old_set,1441 void *puc)1442 {1443 TranslationBlock *tb;1444 int ret;1445 1446 if (cpu_single_env)1447 env = cpu_single_env; /* XXX: find a correct solution for multithread */1448 #if defined(DEBUG_SIGNAL)1449 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1450 pc, address, is_write, *(unsigned long *)old_set);1451 #endif1452 /* XXX: locking issue */1453 if (is_write && page_unprotect(h2g(address), pc, puc)) {1454 return 1;1455 }1456 1457 /* see if it is an MMU fault */1458 ret = cpu_sh4_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1459 if (ret < 0)1460 return 0; /* not an MMU fault */1461 if (ret == 0)1462 return 1; /* the MMU fault was handled without causing real CPU fault */1463 1464 /* now we have a real cpu fault */1465 tb = tb_find_pc(pc);1466 if (tb) {1467 /* the PC is inside the translated code. It means that we have1468 a virtual CPU fault */1469 cpu_restore_state(tb, env, pc, puc);1470 }1471 #if 01472 printf("PF exception: NIP=0x%08x error=0x%x %p\n",1473 env->nip, env->error_code, tb);1474 #endif1475 /* we restore the process signal mask as the sigreturn should1476 do it (XXX: use sigsetjmp) */1477 sigprocmask(SIG_SETMASK, old_set, NULL);1478 cpu_loop_exit();1479 /* never comes here */1480 return 1;1481 }1482 1483 #elif defined (TARGET_ALPHA)1484 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1485 int is_write, sigset_t *old_set,1486 void *puc)1487 {1488 TranslationBlock *tb;1489 int ret;1490 1491 if (cpu_single_env)1492 env = cpu_single_env; /* XXX: find a correct solution for multithread */1493 #if defined(DEBUG_SIGNAL)1494 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1495 pc, address, is_write, *(unsigned long *)old_set);1496 #endif1497 /* XXX: locking issue */1498 if (is_write && page_unprotect(h2g(address), pc, puc)) {1499 return 1;1500 }1501 1502 /* see if it is an MMU fault */1503 ret = cpu_alpha_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1504 if (ret < 0)1505 return 0; /* not an MMU fault */1506 if (ret == 0)1507 return 1; /* the MMU fault was handled without causing real CPU fault */1508 1509 /* now we have a real cpu fault */1510 tb = tb_find_pc(pc);1511 if (tb) {1512 /* the PC is inside the translated code. It means that we have1513 a virtual CPU fault */1514 cpu_restore_state(tb, env, pc, puc);1515 }1516 #if 01517 printf("PF exception: NIP=0x%08x error=0x%x %p\n",1518 env->nip, env->error_code, tb);1519 #endif1520 /* we restore the process signal mask as the sigreturn should1521 do it (XXX: use sigsetjmp) */1522 sigprocmask(SIG_SETMASK, old_set, NULL);1523 cpu_loop_exit();1524 /* never comes here */1525 return 1;1526 }1527 #elif defined (TARGET_CRIS)1528 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,1529 int is_write, sigset_t *old_set,1530 void *puc)1531 {1532 TranslationBlock *tb;1533 int ret;1534 1535 if (cpu_single_env)1536 env = cpu_single_env; /* XXX: find a correct solution for multithread */1537 #if defined(DEBUG_SIGNAL)1538 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",1539 pc, address, is_write, *(unsigned long *)old_set);1540 #endif1541 /* XXX: locking issue */1542 if (is_write && page_unprotect(h2g(address), pc, puc)) {1543 return 1;1544 }1545 1546 /* see if it is an MMU fault */1547 ret = cpu_cris_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0);1548 if (ret < 0)1549 return 0; /* not an MMU fault */1550 if (ret == 0)1551 return 1; /* the MMU fault was handled without causing real CPU fault */1552 1553 /* now we have a real cpu fault */1554 tb = tb_find_pc(pc);1555 if (tb) {1556 /* the PC is inside the translated code. It means that we have1557 a virtual CPU fault */1558 cpu_restore_state(tb, env, pc, puc);1559 }1560 /* we restore the process signal mask as the sigreturn should1561 do it (XXX: use sigsetjmp) */1562 sigprocmask(SIG_SETMASK, old_set, NULL);1563 cpu_loop_exit();1564 /* never comes here */1565 return 1;1566 }1567 1568 #else1569 #error unsupported target CPU1570 #endif1571 1155 1572 1156 #if defined(__i386__) … … 1578 1162 # define TRAP_sig(context) ((context)->uc_mcontext->es.trapno) 1579 1163 # define ERROR_sig(context) ((context)->uc_mcontext->es.err) 1164 # define MASK_sig(context) ((context)->uc_sigmask) 1165 #elif defined (__NetBSD__) 1166 # include <ucontext.h> 1167 1168 # define EIP_sig(context) ((context)->uc_mcontext.__gregs[_REG_EIP]) 1169 # define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO]) 1170 # define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR]) 1171 # define MASK_sig(context) ((context)->uc_sigmask) 1172 #elif defined (__FreeBSD__) || defined(__DragonFly__) 1173 # include <ucontext.h> 1174 1175 # define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext.mc_eip)) 1176 # define TRAP_sig(context) ((context)->uc_mcontext.mc_trapno) 1177 # define ERROR_sig(context) ((context)->uc_mcontext.mc_err) 1580 1178 # define MASK_sig(context) ((context)->uc_sigmask) 1581 1179 #elif defined(__OpenBSD__) … … 1595 1193 { 1596 1194 siginfo_t *info = pinfo; 1597 #if defined(__OpenBSD__) 1195 #if defined(__NetBSD__) || defined (__FreeBSD__) || defined(__DragonFly__) 1196 ucontext_t *uc = puc; 1197 #elif defined(__OpenBSD__) 1598 1198 struct sigcontext *uc = puc; 1599 1199 #else … … 1629 1229 #define ERROR_sig(context) ((context)->sc_err) 1630 1230 #define MASK_sig(context) ((context)->sc_mask) 1231 #elif defined (__FreeBSD__) || defined(__DragonFly__) 1232 #include <ucontext.h> 1233 1234 #define PC_sig(context) (*((unsigned long*)&(context)->uc_mcontext.mc_rip)) 1235 #define TRAP_sig(context) ((context)->uc_mcontext.mc_trapno) 1236 #define ERROR_sig(context) ((context)->uc_mcontext.mc_err) 1237 #define MASK_sig(context) ((context)->uc_sigmask) 1631 1238 #else 1632 1239 #define PC_sig(context) ((context)->uc_mcontext.gregs[REG_RIP]) … … 1641 1248 siginfo_t *info = pinfo; 1642 1249 unsigned long pc; 1643 #if def __NetBSD__1250 #if defined(__NetBSD__) || defined (__FreeBSD__) || defined(__DragonFly__) 1644 1251 ucontext_t *uc = puc; 1645 1252 #elif defined(__OpenBSD__) … … 1767 1374 int is_write; 1768 1375 uint32_t insn; 1769 #if !defined(__arch64__) || defined( HOST_SOLARIS)1376 #if !defined(__arch64__) || defined(CONFIG_SOLARIS) 1770 1377 uint32_t *regs = (uint32_t *)(info + 1); 1771 1378 void *sigmask = (regs + 20);
Note:
See TracChangeset
for help on using the changeset viewer.