Changeset 14871
- Timestamp:
- Jul 8, 2011, 4:33:29 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/source/lisp-kernel/x86-exceptions.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/lisp-kernel/x86-exceptions.c
r14868 r14871 2474 2474 #endif 2475 2475 #ifdef X8632 2476 /* The lisp assembler might use both a modrm byte and a sib byte to2477 encode a memory operand that contains a displacement but no2478 base or index. Using the sib byte is necessary for 64-bit code,2479 since the sib-less form is used to indicate %rip-relative addressing2480 on x8664. On x8632, it's not necessary, slightly suboptimal, and2481 doesn't match what we expect; until that's fixed, we may need to2482 account for this extra byte when adjusting the PC */2483 #undef LISP_ASSEMBLER_EXTRA_SIB_BYTE2484 2476 #define TCR_SEG_PREFIX 0x64 2485 2477 … … 2493 2485 2494 2486 opcode load_allocptr_reg_from_tcr_save_allocptr_instruction[] = 2495 {TCR_SEG_PREFIX,0x8b,0x0d,SAVE_ALLOCPTR}; /* may have extra SIB byte */2487 {TCR_SEG_PREFIX,0x8b,0x0d,SAVE_ALLOCPTR}; 2496 2488 opcode compare_allocptr_reg_to_tcr_save_allocbase_instruction[] = 2497 {TCR_SEG_PREFIX,0x3b,0x0d,SAVE_ALLOCBASE}; /* may have extra SIB byte */2489 {TCR_SEG_PREFIX,0x3b,0x0d,SAVE_ALLOCBASE}; 2498 2490 opcode branch_around_alloc_trap_instruction[] = 2499 {0x77,0x02}; /* no SIB byte issue */2491 {0x77,0x02}; 2500 2492 opcode alloc_trap_instruction[] = 2501 {0xcd,0xc5}; /* no SIB byte issue */2493 {0xcd,0xc5}; 2502 2494 opcode clear_tcr_save_allocptr_tag_instruction[] = 2503 {TCR_SEG_PREFIX,0x80,0x25,SAVE_ALLOCPTR,0xf8}; /* maybe SIB byte */2495 {TCR_SEG_PREFIX,0x80,0x25,SAVE_ALLOCPTR,0xf8}; 2504 2496 opcode set_allocptr_header_instruction[] = 2505 {0x0f,0x7e,0x41,0xfa}; /* no SIB byte issue */2497 {0x0f,0x7e,0x41,0xfa}; 2506 2498 2507 2499 alloc_instruction_id … … 2510 2502 switch(program_counter[0]) { 2511 2503 case 0xcd: return ID_alloc_trap_instruction; 2512 /* 0x7f is jg, which we used to use here instead of ja */2513 case 0x7f:2514 2504 case 0x77: return ID_branch_around_alloc_trap_instruction; 2515 2505 case 0x0f: return ID_set_allocptr_header_instruction; … … 2569 2559 case ID_clear_tcr_save_allocptr_tag_instruction: 2570 2560 tcr->save_allocptr = (void *)(((LispObj)tcr->save_allocptr) & ~fulltagmask); 2571 #ifdef LISP_ASSEMBLER_EXTRA_SIB_BYTE2572 if (((pc)(xpPC(xp)))[2] == 0x24) {2573 xpPC(xp) += 1;2574 }2575 #endif2576 2561 xpPC(xp) += sizeof(clear_tcr_save_allocptr_tag_instruction); 2577 2562 … … 2591 2576 xpGPR(xp,Iallocptr) = VOID_ALLOCPTR; 2592 2577 tcr->save_allocptr += disp; 2593 #ifdef LISP_ASSEMBLER_EXTRA_SIB_BYTE2594 /* This assumes that TCR_SEG_PREFIX can't appear2595 anywhere but at the beginning of one of these2596 magic allocation-sequence instructions. */2597 xpPC(xp) -= (sizeof(branch_around_alloc_trap_instruction)+2598 sizeof(compare_allocptr_reg_to_tcr_save_allocbase_instruction));2599 if (*((pc)(xpPC(xp))) == TCR_SEG_PREFIX) {2600 xpPC(xp) -= sizeof(load_allocptr_reg_from_tcr_save_allocptr_instruction);2601 } else {2602 xpPC(xp) -= (sizeof(load_allocptr_reg_from_tcr_save_allocptr_instruction) + 2);2603 }2604 2605 #else2606 2578 xpPC(xp) -= (sizeof(branch_around_alloc_trap_instruction)+ 2607 2579 sizeof(compare_allocptr_reg_to_tcr_save_allocbase_instruction) + 2608 2580 sizeof(load_allocptr_reg_from_tcr_save_allocptr_instruction)); 2609 #endif2610 2581 } 2611 2582 break; … … 2633 2604 } 2634 2605 tcr->save_allocptr = (void *)(((LispObj)tcr->save_allocptr) & ~fulltagmask); 2635 #ifdef LISP_ASSEMBLER_EXTRA_SIB_BYTE2636 if (((pc)xpPC(xp))[2] == 0x24) {2637 xpPC(xp) += 1;2638 }2639 #endif2640 2606 xpPC(xp) += sizeof(clear_tcr_save_allocptr_tag_instruction); 2641 2607 } else { … … 2643 2609 xpPC(xp) -= (sizeof(compare_allocptr_reg_to_tcr_save_allocbase_instruction) + 2644 2610 sizeof(load_allocptr_reg_from_tcr_save_allocptr_instruction)); 2645 #ifdef LISP_ASSEMBLER_EXTRA_SIB_BYTE2646 if (*((pc)(xpPC(xp))) != TCR_SEG_PREFIX) {2647 /* skipped two instructions with extra SIB byte */2648 xpPC(xp) -= 2;2649 }2650 #endif2651 2611 xpGPR(xp,Iallocptr) = VOID_ALLOCPTR; 2652 2612 if (interrupt_displacement) { … … 2662 2622 xpGPR(xp,Iallocptr) = VOID_ALLOCPTR; 2663 2623 xpPC(xp) -= sizeof(load_allocptr_reg_from_tcr_save_allocptr_instruction); 2664 #ifdef LISP_ASSEMBLER_EXTRA_SIB_BYTE2665 if (*((pc)xpPC(xp)) != TCR_SEG_PREFIX) {2666 xpPC(xp) -= 1;2667 }2668 #endif2669 2624 /* Fall through */ 2670 2625 case ID_load_allocptr_reg_from_tcr_save_allocptr_instruction:
Note:
See TracChangeset
for help on using the changeset viewer.
