Changeset 18597 in vbox
- Timestamp:
- Apr 1, 2009 1:34:19 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45501
- Location:
- trunk/src/recompiler_new
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler_new/VBoxRecompiler.c
r18596 r18597 390 390 STAM_REG(pVM, &gStatSelOutOfSyncStateBack[4], STAMTYPE_COUNTER, "/REM/StateBack/SelOutOfSync/FS", STAMUNIT_OCCURENCES, "FS out of sync"); 391 391 STAM_REG(pVM, &gStatSelOutOfSyncStateBack[5], STAMTYPE_COUNTER, "/REM/StateBack/SelOutOfSync/GS", STAMUNIT_OCCURENCES, "GS out of sync"); 392 393 STAM_REG(pVM, &pVM->rem.s.Env.StatTbFlush, STAMTYPE_PROFILE, "/REM/TbFlush", STAMUNIT_TICKS_PER_CALL, "profiling tb_flush()."); 392 394 #endif /* VBOX_WITH_STATISTICS */ 393 395 -
trunk/src/recompiler_new/exec.c
r18595 r18597 182 182 #define L1_BITS (TARGET_VIRT_ADDR_SPACE_BITS - L2_BITS - TARGET_PAGE_BITS) 183 183 #else 184 # ifdef VBOX /* > 4GB please. */185 #define L1_BITS (TARGET_PHYS_ADDR_SPACE_BITS - L2_BITS - TARGET_PAGE_BITS)186 # else187 184 #define L1_BITS (32 - L2_BITS - TARGET_PAGE_BITS) 188 # endif 189 #endif 190 185 #endif 186 #ifdef VBOX 187 /* Note: Not for PhysPageDesc, only to speed up page_flush_tb. */ 188 #define L0_BITS (TARGET_PHYS_ADDR_SPACE_BITS - 32) 189 #endif 190 191 #ifdef VBOX 192 #define L0_SIZE (1 << L0_BITS) 193 #endif 191 194 #define L1_SIZE (1 << L1_BITS) 192 195 #define L2_SIZE (1 << L2_BITS) … … 200 203 201 204 /* XXX: for system emulation, it could just be an array */ 205 #ifndef VBOX 202 206 static PageDesc *l1_map[L1_SIZE]; 207 #else 208 static l0_map_max_used = 0; 209 static PageDesc **l0_map[L0_SIZE]; 210 #endif 203 211 static PhysPageDesc **l1_phys_map; 204 212 … … 353 361 #endif 354 362 { 363 #ifndef VBOX 355 364 #if TARGET_LONG_BITS > 32 356 365 /* Host memory outside guest VM. For 32-bit targets we have already 357 366 excluded high addresses. */ 358 # ifndef VBOX359 367 if (index > ((target_ulong)L2_SIZE * L1_SIZE)) 360 368 return NULL; 361 # else /* VBOX */ 362 AssertMsgReturn(index < (target_ulong)L2_SIZE * L1_SIZE, 363 ("index=%RGp >= %RGp; L1_SIZE=%#x L2_SIZE=%#x\n", 364 (RTGCPHYS)index, (RTGCPHYS)L2_SIZE * L1_SIZE, L1_SIZE, L2_SIZE), 369 #endif 370 return &l1_map[index >> L2_BITS]; 371 #else /* VBOX */ 372 PageDesc **l1_map; 373 AssertMsgReturn(index < (target_ulong)L2_SIZE * L1_SIZE * L0_SIZE, 374 ("index=%RGp >= %RGp; L1_SIZE=%#x L2_SIZE=%#x L0_SIZE=%#x\n", 375 (RTGCPHYS)index, (RTGCPHYS)L2_SIZE * L1_SIZE, L1_SIZE, L2_SIZE, L0_SIZE), 365 376 NULL); 366 # endif /* VBOX */ 367 368 #endif 369 return &l1_map[index >> L2_BITS]; 377 l1_map = l0_map[index >> (L1_BITS + L2_BITS)]; 378 if (RT_UNLIKELY(!l1_map)) 379 { 380 unsigned i0 = index >> (L1_BITS + L2_BITS); 381 l0_map[i0] = l1_map = qemu_mallocz(sizeof(PageDesc *) * L1_SIZE); 382 if (RT_UNLIKELY(!l1_map)) 383 return NULL; 384 if (i0 >= l0_map_max_used) 385 l0_map_max_used = i0 + 1; 386 } 387 return &l1_map[(index >> L2_BITS) & (L1_SIZE - 1)]; 388 #endif /* VBOX */ 370 389 } 371 390 … … 703 722 int i, j; 704 723 PageDesc *p; 705 706 for(i = 0; i < L1_SIZE; i++) { 707 p = l1_map[i]; 708 if (p) { 709 for(j = 0; j < L2_SIZE; j++) { 710 p->first_tb = NULL; 711 invalidate_page_bitmap(p); 712 p++; 724 #ifdef VBOX 725 int k; 726 #endif 727 728 #ifdef VBOX 729 k = l0_map_max_used; 730 while (k-- > 0) { 731 PageDesc **l1_map = l0_map[k]; 732 if (l1_map) { 733 #endif 734 for(i = 0; i < L1_SIZE; i++) { 735 p = l1_map[i]; 736 if (p) { 737 for(j = 0; j < L2_SIZE; j++) { 738 p->first_tb = NULL; 739 invalidate_page_bitmap(p); 740 p++; 741 } 742 } 713 743 } 714 } 715 } 744 #ifdef VBOX 745 } 746 } 747 #endif 716 748 } 717 749 … … 721 753 { 722 754 CPUState *env; 755 #ifdef VBOX 756 STAM_PROFILE_START(&env1->StatTbFlush, a); 757 #endif 723 758 #if defined(DEBUG_FLUSH) 724 759 printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n", … … 743 778 expensive */ 744 779 tb_flush_count++; 780 #ifdef VBOX 781 STAM_PROFILE_STOP(&env1->StatTbFlush, a); 782 #endif 745 783 } 746 784 -
trunk/src/recompiler_new/target-i386/cpu.h
r17274 r18597 62 62 # include <iprt/asm.h> 63 63 # include <VBox/vmm.h> 64 # include <VBox/stam.h> 64 65 #endif /* VBOX */ 65 66 … … 677 678 #else 678 679 uint32_t alignment2[3]; 680 /** Profiling tb_flush. */ 681 STAMPROFILE StatTbFlush; 679 682 #endif 680 683 } CPUX86State;
Note:
See TracChangeset
for help on using the changeset viewer.