Changeset 58814 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Nov 22, 2015 6:50:50 AM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r58812 r58814 123 123 TOOL_Bs3Vcc64_CXX = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXX) 124 124 TOOL_Bs3Vcc64_COBJSUFF = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COBJSUFF) 125 TOOL_Bs3Vcc64_CFLAGS = $( TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CFLAGS)125 TOOL_Bs3Vcc64_CFLAGS = $(filter-out -TC,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CFLAGS)) -TP # compile as C++ 126 126 TOOL_Bs3Vcc64_CFLAGS.debug = 127 127 TOOL_Bs3Vcc64_CFLAGS.dbgopt = -O1 … … 327 327 output raw offset=0x10000 \ 328 328 order \ 329 clname BS3FLAT segaddr=0x0000 \ 330 segment BS3FLAT segaddr=0x0000 \ 329 331 clname BS3CODE16 segaddr=0x1000 \ 330 332 segment BS3TEXT16 \ … … 354 356 segment BS3DATA64 \ 355 357 segment DATA64 \ 356 segment .data 358 segment .data \ 359 segment .pdata \ 360 segment .xdata \ 361 357 362 TEMPLATE_VBoxBS3KitImg_DEPS = \ 358 363 $(bs3-bootsector_1_TARGET) \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp
r58809 r58814 348 348 * Work the section table. 349 349 */ 350 bool fRet = true; 350 351 PCIMAGE_SECTION_HEADER paShdrs = (PCIMAGE_SECTION_HEADER)(pHdr + 1); 351 352 for (uint32_t i = 0; i < pHdr->NumberOfSections; i++) … … 374 375 return error(pszFile, "Raw data beyond the end of the file or overlapping the headers (section #%u)\n", i); 375 376 uint8_t *pbRawData = &pbFile[paShdrs[i].PointerToRawData]; 377 378 /* Is this a section which ends up in the binary? */ 379 bool const fInBinary = !(paShdrs[i].Characteristics & (IMAGE_SCN_LNK_REMOVE | IMAGE_SCN_LNK_INFO)); 380 bool const fIsPData = fInBinary 381 && memcmp(paShdrs[i].Name, RT_STR_TUPLE(".pdata\0")) == 0; 376 382 377 383 /* … … 425 431 426 432 /* Convert it. */ 433 uint8_t uDir = IMAGE_REL_AMD64_ABSOLUTE; 427 434 switch (paRelocs[j].Type) 428 435 { … … 441 448 uAddend, paRelocs[j].u.VirtualAddress, i, paShdrs[i].Name); 442 449 paRelocs[j].Type = IMAGE_REL_I386_DIR32; 450 uDir = IMAGE_REL_AMD64_ADDR64; 443 451 break; 444 452 } … … 462 470 case IMAGE_REL_AMD64_ADDR32: 463 471 paRelocs[j].Type = IMAGE_REL_I386_DIR32; 472 uDir = IMAGE_REL_AMD64_ADDR32; 464 473 break; 465 474 case IMAGE_REL_AMD64_ADDR32NB: 466 475 paRelocs[j].Type = IMAGE_REL_I386_DIR32NB; 476 uDir = IMAGE_REL_AMD64_ADDR32NB; 467 477 break; 468 478 case IMAGE_REL_AMD64_REL32: … … 489 499 paRelocs[j].u.VirtualAddress, i, paShdrs[i].Name); 490 500 } 501 502 /* 503 * Error no absolute fixup that we care about. We continue so 504 * the developer can get the full story before failing. 505 */ 506 if ( fInBinary 507 && !fIsPData 508 && uDir != IMAGE_REL_AMD64_ABSOLUTE) 509 { 510 error(pszFile, "%s at %#x in section %u '%-8.8s': wlink won't get this right\n", 511 g_apszCoffAmd64RelTypes[uDir], paRelocs[j].u.VirtualAddress, i, paShdrs[i].Name); 512 fRet = false; 513 } 491 514 } 492 515 } 493 516 } 494 return true;517 return fRet; 495 518 } 496 519 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c
r58789 r58814 43 43 */ 44 44 PBS3SLABHEAD pHead = enmKind == BS3MEMKIND_REAL 45 ? &BS3_ DATA_NM(g_aBs3LowSlabLists)[idxSlabList]46 : &BS3_ DATA_NM(g_aBs3UpperTiledSlabLists)[idxSlabList];45 ? &BS3_MSC64_FIXUP_HACK(BS3SLABHEAD, BS3_DATA_NM(g_aBs3LowSlabLists))[idxSlabList] 46 : &BS3_MSC64_FIXUP_HACK(BS3SLABHEAD, BS3_DATA_NM(g_aBs3UpperTiledSlabLists))[idxSlabList]; 47 47 48 BS3_ASSERT(BS3_ DATA_NM(g_aBs3LowSlabLists)[idxSlabList].cbChunk >= cb);48 BS3_ASSERT(BS3_MSC64_FIXUP_HACK(BS3SLABHEAD, BS3_DATA_NM(g_aBs3LowSlabLists))[idxSlabList].cbChunk >= cb); 49 49 pvRet = Bs3SlabListAlloc(pHead); 50 50 if (pvRet) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-memory.h
r58789 r58814 70 70 { 71 71 if (cbRequest <= BS3_DATA_NM(g_acbBs3SlabLists)[BS3_MEM_SLAB_LIST_COUNT - 1]) 72 return BS3_DATA_NM(g_aiBs3SlabListsByPowerOfTwo)[cbRequest ? ASMBitLastSetU16((uint16_t)(cbRequest - 1)) : 0]; 72 { 73 unsigned idx = cbRequest ? ASMBitLastSetU16((uint16_t)(cbRequest - 1)) : 0; 74 return BS3_MSC64_FIXUP_HACK(uint8_t const, BS3_DATA_NM(g_aiBs3SlabListsByPowerOfTwo))[idx]; 75 } 73 76 return UINT8_MAX; 74 77 } -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac
r58812 r58814 120 120 db 10,13,'eye-catcher: BS3TEXT64',10,13 121 121 122 %ifdef ASM_FORMAT_OMF 123 section TEXT64 align=4 CLASS=CODE PUBLIC USE32 124 ;section .text align=4 CLASS=CODE PUBLIC USE32 - nasm doesn't do '.' at the start of segments in OMF mode. Not that this helps anyways... 125 ;section .rdata align=4 CLASS=CODE PUBLIC USE32 126 ;GROUP CODE64 TEXT64 _text _rdata 127 %endif 128 122 129 %ifdef ASM_FORMAT_ELF 123 130 section BS3TEXT64_END align=1 progbits alloc exec nowrite -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-pe16.asm
r58812 r58814 54 54 55 55 extern _Bs3Printf_c32 56 extern Bs3Printf_c64 56 57 57 58 BS3_BEGIN_TEXT16 … … 65 66 call NAME(Bs3SwitchToPE32_rm) 66 67 BS3_SET_BITS 32 68 .halt: hlt 69 jmp .halt 67 70 call NAME(Bs3SwitchToRM_pe32) 68 71 BS3_SET_BITS 16 69 70 .halt: hlt71 jmp .halt72 72 73 73 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE32.asm
r58812 r58814 85 85 mov cr0, eax 86 86 jmp BS3_SEL_R0_CS32:dword .thirty_two_bit wrt FLAT 87 extern TODO_CONVINCE_WATCOM_TO_DO_FLAT_RELOCS88 87 BS3_BEGIN_TEXT32 89 88 .thirty_two_bit: … … 104 103 mov [esp + 8], eax ; Store it in the place right for 32-bit returns. 105 104 %endif 106 pop esp107 105 popfd 106 pop eax 108 107 ret 109 108 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r58812 r58814 372 372 #else 373 373 # define BS3_DATA_NM(a_Name) a_Name 374 #endif 375 376 /** @def BS3_MSC64_FIXUP_HACK 377 * Used to avoid IMAGE_REL_AMD64_ADDR32NB fixups where the compiler tries to 378 * make use of __ImageBase as a base pointer instead of emitting rip relative 379 * accesses. Happens when there are a bunch of global data accesses in the same 380 * function, probably to save space. 381 * 382 * The volatile variable in the lambda fixes it. 383 */ 384 #if _MSC_VER && ARCH_BITS == 64 385 # define BS3_MSC64_FIXUP_HACK(a_BaseType, a_Data) \ 386 ([]() -> a_BaseType * \ 387 { \ 388 a_BaseType * volatile x = a_Data; \ 389 return x; \ 390 }()) 391 392 #else 393 # define BS3_MSC64_FIXUP_HACK(a_BaseType, a_Data) (a_Data) 374 394 #endif 375 395 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
r58812 r58814 126 126 ;; @name Segment definitions. 127 127 ;; @{ 128 129 %ifdef ASM_FORMAT_OMF 130 ; !!HACK ALERT!! 131 ; 132 ; To make FLAT actually be flat, i.e. have a base of 0 rather than the same as 133 ; the target (?) segment, we tweak it a little bit here. We associate a segment 134 ; with it so that we can get at it in the class/segment ordering directives 135 ; we pass to the linker. The segment does not contain any data or anything, it 136 ; is just an empty one which we assign the address of zero. 137 ; 138 ; Look for 'clname BS3FLAT segaddr=0x0000' and 'segment BS3FLAT segaddr=0x0000' 139 ; in the makefile. 140 ; 141 ; !!HACK ALERT!! 142 segment BS3FLAT use32 class=BS3FLAT 143 GROUP FLAT BS3FLAT 144 %endif 145 128 146 %macro BS3_BEGIN_TEXT16 0 129 147 %ifndef BS3_BEGIN_TEXT16_NOT_FIRST
Note:
See TracChangeset
for help on using the changeset viewer.