Changeset 92256 in vbox for trunk/src/VBox/ValidationKit/bootsectors
- Timestamp:
- Nov 8, 2021 8:33:27 AM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r90470 r92256 356 356 bs3-mode-TestDoModesByMax.c \ 357 357 bs3-mode-TestDoModesHlp.asm \ 358 bs3-mode-BiosInt15hE820.asm \ 358 359 359 360 # The 16-bit real mode BS3Kit library. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c
r82968 r92256 93 93 * BIOS installs their INT 10h handler there as well, and seemingly 94 94 * must be using it internally or something. 95 * 96 * We also keep 15h working for memory interfaces (see bs3-mode-BiosInt15*). 95 97 */ 96 98 for (iIvt = 0; iIvt < 256; iIvt++) 97 if (iIvt != 0x10 && iIvt != 0x 6d && iIvt != BS3_TRAP_SYSCALL)99 if (iIvt != 0x10 && iIvt != 0x15 && iIvt != 0x6d && iIvt != BS3_TRAP_SYSCALL) 98 100 { 99 101 paIvt[iIvt].off = (uint16_t)(uintptr_t)Bs3TrapRmV86GenericEntries + iIvt * 8; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c
r82968 r92256 30 30 *********************************************************************************************************************************/ 31 31 #define BS3_USE_RM_TEXT_SEG 1 32 #define BS3_BIOS_INLINE_RM 32 33 #include "bs3kit-template-header.h" 33 34 #include "bs3-cmn-memory.h" … … 35 36 #include <VBox/VMMDevTesting.h> 36 37 37 38 /*********************************************************************************************************************************39 * Structures and Typedefs *40 *********************************************************************************************************************************/41 42 typedef struct INT15E820ENTRY43 {44 uint64_t uBaseAddr;45 uint64_t cbRange;46 /** Memory type this entry describes, see INT15E820_TYPE_XXX. */47 uint32_t uType;48 uint32_t fAcpi3;49 } INT15E820ENTRY;50 AssertCompileSize(INT15E820ENTRY,24);51 52 53 /** @name INT15E820_TYPE_XXX - Memory types returned by int 15h function 0xe820.54 * @{ */55 #define INT15E820_TYPE_USABLE 1 /**< Usable RAM. */56 #define INT15E820_TYPE_RESERVED 2 /**< Reserved by the system, unusable. */57 #define INT15E820_TYPE_ACPI_RECLAIMABLE 3 /**< ACPI reclaimable memory, whatever that means. */58 #define INT15E820_TYPE_ACPI_NVS 4 /**< ACPI non-volatile storage? */59 #define INT15E820_TYPE_BAD 5 /**< Bad memory, unusable. */60 /** @} */61 62 63 /**64 * Performs a int 15h function 0xe820 call.65 *66 * @returns Continuation value on success, 0 on failure.67 * (Because of the way the API works, EBX should never be zero when68 * data is returned.)69 * @param pEntry The return buffer.70 * @param cbEntry The size of the buffer (min 20 bytes).71 * @param uContinuationValue Zero the first time, the return value from the72 * previous call after that.73 */74 BS3_DECL(uint32_t) Bs3BiosInt15hE820(INT15E820ENTRY BS3_FAR *pEntry, size_t cbEntry, uint32_t uContinuationValue);75 #pragma aux Bs3BiosInt15hE820 = \76 ".386" \77 "shl ebx, 10h" \78 "mov bx, ax" /* ebx = continutation */ \79 "movzx ecx, cx" \80 "movzx edi, di" \81 "mov edx, 0534d4150h" /*SMAP*/ \82 "mov eax, 0xe820" \83 "int 15h" \84 "jc failed" \85 "cmp eax, 0534d4150h" \86 "jne failed" \87 "cmp cx, 20" \88 "jb failed" \89 "mov ax, bx" \90 "shr ebx, 10h" /* ax:bx = continuation */ \91 "jmp done" \92 "failed:" \93 "xor ax, ax" \94 "xor bx, bx" \95 "done:" \96 parm [es di] [cx] [ax bx] \97 value [ax bx] \98 modify exact [ax bx cx dx di es];99 100 /**101 * Performs a int 15h function 0x88 call.102 *103 * @returns UINT32_MAX on failure, number of KBs above 1MB otherwise.104 */105 BS3_DECL(uint32_t) Bs3BiosInt15h88(void);106 #pragma aux Bs3BiosInt15h88 = \107 ".286" \108 "clc" \109 "mov ax, 08800h" \110 "int 15h" \111 "jc failed" \112 "xor dx, dx" \113 "jmp done" \114 "failed:" \115 "xor ax, ax" \116 "dec ax" \117 "mov dx, ax" \118 "done:" \119 value [ax dx] \120 modify exact [ax bx cx dx es];121 38 122 39 … … 250 167 BS3_DECL(void) BS3_FAR_CODE Bs3InitMemory_rm_far(void) 251 168 { 169 INT15E820ENTRY Entry = { 0, 0, 0, 0 }; 170 uint32_t cbEntry = sizeof(Entry); 171 uint32_t uCont = 0; 252 172 uint16_t i; 253 173 uint16_t cPages; 254 174 uint32_t u32; 255 INT15E820ENTRY Entry;256 175 uint32_t BS3_FAR *pu32Mmio; 257 176 … … 316 235 in entries describing usable memory, ASSUMING of course no overlaps. */ 317 236 if ( (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386 318 && Bs3BiosInt15hE820(&Entry, sizeof(Entry), 0) != 0) 319 { 320 uint32_t uCont = 0; 321 i = 0; 322 while ( (uCont = Bs3BiosInt15hE820(&Entry, sizeof(Entry), uCont)) != 0 323 && i++ < 2048) 237 && Bs3BiosInt15hE820_rm_far(&Entry, &cbEntry, &uCont)) 238 { 239 unsigned i = 0; 240 do 241 { 324 242 if (Entry.uType == INT15E820_TYPE_USABLE) 325 243 if (!(Entry.uBaseAddr >> 32)) … … 327 245 bs3InitMemoryAddRange32((uint32_t)Entry.uBaseAddr, 328 246 (Entry.cbRange >> 32) ? UINT32_C(0xfffff000) : (uint32_t)Entry.cbRange); 247 248 /* next */ 249 Entry.uType = 0; 250 cbEntry = sizeof(Entry); 251 i++; 252 } while ( uCont != 0 253 && i < 2048 254 && Bs3BiosInt15hE820_rm_far(&Entry, &cbEntry, &uCont)); 329 255 } 330 256 /* Try the 286+ API for getting memory above 1MB and (usually) below 16MB. */ 331 else if ( (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80 386257 else if ( (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80286 332 258 && (u32 = Bs3BiosInt15h88()) != UINT32_MAX 333 259 && u32 > 0) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk
r90470 r92256 144 144 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,bs3PagingGetPaePte) 145 145 $(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,Bs3SwitchTo32BitAndCallC) 146 $(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,Bs3BiosInt15h88) 147 $(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,Bs3BiosInt15hE820) 146 148 $(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,Bs3TrapInit) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
r90470 r92256 198 198 #define Bs3UtilSetFullIdtr BS3_CMN_MANGLER(Bs3UtilSetFullIdtr) 199 199 #ifndef BS3_CMN_ONLY 200 # define Bs3BiosInt15h88 BS3_MODE_MANGLER(Bs3BiosInt15h88) 201 # define Bs3BiosInt15hE820 BS3_MODE_MANGLER(Bs3BiosInt15hE820) 200 202 # define Bs3CpuDetect BS3_MODE_MANGLER(Bs3CpuDetect) 201 203 # define Bs3SwitchTo32BitAndCallC BS3_MODE_MANGLER(Bs3SwitchTo32BitAndCallC) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
r90470 r92256 198 198 #undef Bs3UtilSetFullIdtr 199 199 #ifndef BS3_CMN_ONLY 200 # undef Bs3BiosInt15h88 201 # undef Bs3BiosInt15hE820 200 202 # undef Bs3CpuDetect 201 203 # undef Bs3SwitchTo32BitAndCallC -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r90470 r92256 3951 3951 BS3_MODE_PROTO_NOSB(void, Bs3TestDoModesByMax,(PCBS3TESTMODEBYMAXENTRY paEntries, size_t cEntries)); 3952 3952 3953 3954 3953 /** @} */ 3954 3955 3956 /** @defgroup grp_bs3kit_bios_int15 BIOS - int 15h 3957 * @{ */ 3958 3959 /** An INT15E820 data entry. */ 3960 typedef struct INT15E820ENTRY 3961 { 3962 uint64_t uBaseAddr; 3963 uint64_t cbRange; 3964 /** Memory type this entry describes, see INT15E820_TYPE_XXX. */ 3965 uint32_t uType; 3966 /** Optional. */ 3967 uint32_t fAcpi3; 3968 } INT15E820ENTRY; 3969 AssertCompileSize(INT15E820ENTRY,24); 3970 3971 3972 /** @name INT15E820_TYPE_XXX - Memory types returned by int 15h function 0xe820. 3973 * @{ */ 3974 #define INT15E820_TYPE_USABLE 1 /**< Usable RAM. */ 3975 #define INT15E820_TYPE_RESERVED 2 /**< Reserved by the system, unusable. */ 3976 #define INT15E820_TYPE_ACPI_RECLAIMABLE 3 /**< ACPI reclaimable memory, whatever that means. */ 3977 #define INT15E820_TYPE_ACPI_NVS 4 /**< ACPI non-volatile storage? */ 3978 #define INT15E820_TYPE_BAD 5 /**< Bad memory, unusable. */ 3979 /** @} */ 3980 3981 3982 /** 3983 * Performs an int 15h function 0xe820 call. 3984 * 3985 * @returns Success indicator. 3986 * @param pEntry The return buffer. 3987 * @param pcbEntry Input: The size of the buffer (min 20 bytes); 3988 * Output: The size of the returned data. 3989 * @param puContinuationValue Where to get and return the continuation value (EBX) 3990 * Set to zero the for the first call. Returned as zero 3991 * after the last entry. 3992 */ 3993 BS3_MODE_PROTO_STUB(bool, Bs3BiosInt15hE820,(INT15E820ENTRY BS3_FAR *pEntry, uint32_t BS3_FAR *pcbEntry, 3994 uint32_t BS3_FAR *puContinuationValue)); 3995 3996 /** 3997 * Performs an int 15h function 0x88 call. 3998 * 3999 * @returns UINT32_MAX on failure, number of KBs above 1MB otherwise. 4000 */ 4001 #if ARCH_BITS != 16 || !defined(BS3_BIOS_INLINE_RM) 4002 BS3_MODE_PROTO_STUB(uint32_t, Bs3BiosInt15h88,(void)); 4003 #else 4004 BS3_DECL(uint32_t) Bs3BiosInt15h88(void); 4005 # pragma aux Bs3BiosInt15h88 = \ 4006 ".286" \ 4007 "clc" \ 4008 "mov ax, 08800h" \ 4009 "int 15h" \ 4010 "jc failed" \ 4011 "xor dx, dx" \ 4012 "jmp done" \ 4013 "failed:" \ 4014 "xor ax, ax" \ 4015 "dec ax" \ 4016 "mov dx, ax" \ 4017 "done:" \ 4018 value [ax dx] \ 4019 modify exact [ax bx cx dx es]; 4020 #endif 4021 4022 /** @} */ 4023 3955 4024 3956 4025 /** @} */ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
r82968 r92256 689 689 %define BS3_PBC_NEAR 1 ;;< Only near. 690 690 %define BS3_PBC_FAR 2 ;;< Only far. 691 %define BS3_PBC_HYBRID 3 ;;< Hybrid near/far procedure, trashing AX 692 %define BS3_PBC_HYBRID_SAFE 4 ;;< Hybrid near/far procedure, no trashing but slower. 691 %define BS3_PBC_HYBRID 3 ;;< Hybrid near/far procedure, trashing AX. Use BS3_HYBRID_RET to return. 692 %define BS3_PBC_HYBRID_SAFE 4 ;;< Hybrid near/far procedure, no trashing but slower. Use BS3_HYBRID_RET to return. 693 693 %define BS3_PBC_HYBRID_0_ARGS 5 ;;< Hybrid near/far procedure, no parameters so separate far stub, no trashing, fast near calls. 694 694 ;; @}
Note:
See TracChangeset
for help on using the changeset viewer.