Changeset 14881 in vbox for trunk/src/recompiler_new/tcg/i386
- Timestamp:
- Dec 1, 2008 5:54:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler_new/tcg/i386/tcg-target.c
r14542 r14881 429 429 430 430 #ifdef VBOX 431 DECLINLINE(void) tcg_out_long_call(TCGContext *s, tcg_target_long dst) 432 { 433 intptr_t disp = dst - (tcg_target_long)s->code_ptr - 5; 431 DECLINLINE(void) 432 tcg_out_long_call(TCGContext *s, void* dst) 433 { 434 intptr_t disp = (uintptr_t)dst - (uintptr_t)s->code_ptr - 5; 434 435 tcg_out8(s, 0xe8); /* call disp32 */ 435 436 tcg_out32(s, disp); /* disp32 */ 436 437 } 437 438 DECLINLINE(void) 439 tcg_out_long_jmp(TCGContext *s, void* dst) 440 { 441 intptr_t disp = (uintptr_t)dst - (uintptr_t)s->code_ptr - 5; 442 tcg_out8(s, 0xe9); /* jmp disp32 */ 443 tcg_out32(s, disp); /* disp32 */ 444 } 438 445 #endif /* VBOX */ 439 446 … … 539 546 }; 540 547 548 #ifdef RT_OS_DARWIN 541 549 static void tcg_out_vbox_phys_read(TCGContext *s, int index, 542 550 int addr_reg, 543 int data_reg, int data_reg2) { 551 int data_reg, int data_reg2) 552 { 553 int useReg2 = ((index & 3) == 3); 554 555 /** @todo: should we make phys addess accessors fastcalls - probably not a big deal */ 556 /* out parameter (address), note that phys address is always 64-bit */ 557 AssertMsg(sizeof(RTGCPHYS) == 8, ("Physical address must be 64-bits, update caller\n")); 558 559 tcg_out8(s, 0xf7); tcg_out8(s, 0xc4); tcg_out32(s, 0xf); /* test $0xf, %esp */ 560 tcg_out8(s, 0x74); tcg_out8(s, 0x4); /* je 1 */ 561 tcg_out8(s, 0x8d); tcg_out8(s, 0x64); tcg_out8(s, 0x24); tcg_out8(s, 0xf8); /* lea -0x8(%esp),%esp */ 562 /* 1: */ 563 tcg_out8(s, 0x6a); tcg_out8(s, 0x00); /* push $0 */ 564 tcg_out_push(s, addr_reg); 565 566 tcg_out8(s, 0xe8); tcg_out32(s, 0); /* call 2 */ 567 /* 2: */ 568 tcg_out8(s, 0x74); tcg_out8(s, 0x6); /* je 3 */ 569 tcg_out8(s, 0x83); tcg_out8(s, 0x04); tcg_out8(s, 0x24); tcg_out8(s, 0x11); /* addl $0x11,(%esp) */ 570 tcg_out8(s, 0xeb); tcg_out8(s, 0x04); /* jmp 4 */ 571 /* 3: */ 572 tcg_out8(s, 0x83); tcg_out8(s, 0x04); tcg_out8(s, 0x24); tcg_out8(s, 0x14); /* addl $0x14,(%esp) */ 573 /* 4: */ 574 tcg_out_long_jmp(s, vbox_ld_helpers[index]); 575 576 /* return point 1: clear both parameter and alignment */ 577 tcg_out8(s, 0x83); tcg_out8(s, 0xc4); tcg_out8(s, 0x08); /* add $0x8,%esp */ 578 /* return point 2: clear only parameter */ 579 tcg_out8(s, 0x83); tcg_out8(s, 0xc4); tcg_out8(s, 0x08); /* add $0x8,%esp */ 580 /* mov %eax, data_reg */ 581 tcg_out_mov(s, data_reg, TCG_REG_EAX); 582 583 /* returned 64-bit value */ 584 if (useReg2) 585 tcg_out_mov(s, data_reg2, TCG_REG_EDX); 586 } 587 #else 588 static void tcg_out_vbox_phys_read(TCGContext *s, int index, 589 int addr_reg, 590 int data_reg, int data_reg2) 591 { 544 592 int useReg2 = ((index & 3) == 3); 545 593 … … 550 598 tcg_out_push(s, addr_reg); 551 599 552 tcg_out_long_call(s, (tcg_target_long)vbox_ld_helpers[index]);600 tcg_out_long_call(s, vbox_ld_helpers[index]); 553 601 554 602 /* mov %eax, data_reg */ … … 562 610 tcg_out_addi(s, TCG_REG_ESP, 8); 563 611 } 612 #endif 613 564 614 565 615 static void tcg_out_vbox_phys_write(TCGContext *s, int index, … … 580 630 581 631 /* call it */ 582 tcg_out_long_call(s, (tcg_target_long)vbox_st_helpers[index]);632 tcg_out_long_call(s, vbox_st_helpers[index]); 583 633 584 634 /* clean stack after us */ … … 1326 1376 TCG_REG_EBP, 1327 1377 TCG_REG_EBX, 1328 TCG_REG_ESI,/* currently used for the global env, so no1329 need to save */1378 /* TCG_REG_ESI ,*/ /* currently used for the global env, so no 1379 need to save */ 1330 1380 TCG_REG_EDI, 1331 1381 #endif
Note:
See TracChangeset
for help on using the changeset viewer.