- Timestamp:
- May 26, 2017 11:34:08 AM (8 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/inlines.h
r62509 r67112 4 4 5 5 /* 6 * Copyright (C) 2010-201 6Oracle Corporation6 * Copyright (C) 2010-2017 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 146 146 #if VBOX_BIOS_CPU >= 80386 147 147 148 /* Warning: msr_read/msr_write destroy high bits of 32-bit registers . */148 /* Warning: msr_read/msr_write destroy high bits of 32-bit registers (EAX, ECX, EDX). */ 149 149 150 150 uint64_t msr_read(uint32_t msr); … … 177 177 parm [ax bx cx dx] [di si] modify [] nomemory; 178 178 179 /* Warning: eflags_read/eflags_write destroy high bits of 32-bit registers (EDX). */ 180 uint32_t eflags_read( void ); 181 #pragma aux eflags_read = \ 182 ".386" \ 183 "pushfd" \ 184 "pop edx" \ 185 "mov ax, dx" \ 186 "shr edx, 16" \ 187 value [dx ax] modify [dx ax]; 188 189 uint32_t eflags_write( uint32_t e_flags ); 190 #pragma aux eflags_write = \ 191 ".386" \ 192 "shl edx, 16" \ 193 "mov dx, ax" \ 194 "push edx" \ 195 "popfd" \ 196 parm [dx ax] modify [dx ax]; 197 198 /* Warning cpuid destroys high bits of 32-bit registers (EAX, EBX, ECX, EDX). */ 199 void cpuid( uint32_t __far cpu_id[4], uint32_t leaf ); 200 #pragma aux cpuid = \ 201 ".586" \ 202 "shl edx, 16" \ 203 "mov dx, ax" \ 204 "mov eax, edx" \ 205 "cpuid" \ 206 "mov es:[di+0], eax" \ 207 "mov es:[di+4], ebx" \ 208 "mov es:[di+8], ecx" \ 209 "mov es:[di+12], edx" \ 210 parm [es di] [dx ax] modify [bx cx dx] 211 179 212 #endif -
trunk/src/VBox/Devices/PC/BIOS/post.c
r62509 r67112 4 4 5 5 /* 6 * Copyright (C) 2004-201 6Oracle Corporation6 * Copyright (C) 2004-2017 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 104 104 #if VBOX_BIOS_CPU >= 80386 105 105 106 /* NB: The CPUID detection is generic but currently not used elsewhere. */ 107 108 /* Check CPUID availability. */ 109 int is_cpuid_supported( void ) 110 { 111 uint32_t old_flags, new_flags; 112 113 old_flags = eflags_read(); 114 new_flags = old_flags ^ (1L << 21); /* Toggle CPUID bit. */ 115 eflags_write( new_flags ); 116 new_flags = eflags_read(); 117 return( old_flags != new_flags ); /* Supported if bit changed. */ 118 } 119 106 120 #define APICMODE_DISABLED 0 107 121 #define APICMODE_APIC 1 … … 121 135 * existing virtual wire setup. 122 136 * 123 * NB: This code assumes that there *is* a local APIC. 137 * NB: This code does not assume that there is a local APIC. It is necessary 138 * to check CPUID whether APIC is present; the CPUID instruction might not be 139 * available either. 124 140 * 125 141 * NB: Destroys high bits of 32-bit registers. … … 130 146 uint16_t mask; 131 147 uint8_t apic_mode; 148 uint32_t cpu_id[4]; 149 150 /* If there's no CPUID, there's certainly no APIC. */ 151 if (!is_cpuid_supported()) { 152 return; 153 } 154 155 /* Check EDX bit 9 */ 156 cpuid(&cpu_id, 1); 157 BX_DEBUG("CPUID EDX: 0x%lx\n", cpu_id[3]); 158 if ((cpu_id[3] & (1 << 9)) == 0) { 159 return; /* No local APIC, nothing to do. */ 160 } 132 161 133 162 /* APIC mode at offset 78h in CMOS NVRAM. */
Note:
See TracChangeset
for help on using the changeset viewer.