Add comments with MSR and CPUID flag names
Reorganize the MSR struct
This commit is contained in:
@@ -128,9 +128,9 @@ uint32_t addr64a_2[8];
|
||||
static pc_timer_t *cpu_fast_off_timer = NULL;
|
||||
static double cpu_fast_off_period = 0.0;
|
||||
|
||||
#define AMD_SYSCALL_EIP (msr.star & 0xFFFFFFFF)
|
||||
#define AMD_SYSCALL_SB ((msr.star >> 32) & 0xFFFF)
|
||||
#define AMD_SYSRET_SB ((msr.star >> 48) & 0xFFFF)
|
||||
#define AMD_SYSCALL_EIP (msr.amd_star & 0xFFFFFFFF)
|
||||
#define AMD_SYSCALL_SB ((msr.amd_star >> 32) & 0xFFFF)
|
||||
#define AMD_SYSRET_SB ((msr.amd_star >> 48) & 0xFFFF)
|
||||
|
||||
/* These #define's and enum have been borrowed from Bochs. */
|
||||
/* SMM feature masks */
|
||||
|
377
src/cpu/cpu.c
377
src/cpu/cpu.c
File diff suppressed because it is too large
Load Diff
120
src/cpu/cpu.h
120
src/cpu/cpu.h
@@ -226,35 +226,41 @@ typedef union {
|
||||
} MMX_REG;
|
||||
|
||||
typedef struct {
|
||||
/* IDT WinChip and WinChip 2 MSR's */
|
||||
uint32_t tr1; /* 0x00000002, 0x0000000e */
|
||||
uint32_t tr12; /* 0x00000002, 0x0000000e */
|
||||
uint32_t cesr; /* 0x00000011 */
|
||||
/* IBM 386SLC/486SLC/486BL MSRs */
|
||||
uint64_t ibm_por; /* 0x00001000 - 386SLC and later */
|
||||
uint64_t ibm_crcr; /* 0x00001001 - 386SLC and later */
|
||||
uint64_t ibm_por2; /* 0x00001002 - 486SLC and later */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t apic_base; /* 0x0000001b - Should the Pentium not also have this? */
|
||||
|
||||
/* Weird long MSR's used by the Hyper-V BIOS. */
|
||||
uint64_t ecx20; /* 0x00000020, really 0x40000020, but we filter out the top 18 bits
|
||||
like a real Deschutes does. */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t bios_updt; /* 0x00000079 */
|
||||
|
||||
/* AMD K5, 5k86, K6, K6-2, K6-2C, K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t amd_hwcr; /* 0x00000083 - AMD K5 and K6 MSR's. */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t bbl_cr_dx[4]; /* 0x00000088 - 0x0000008b */
|
||||
uint64_t ia32_pmc[8]; /* 0x000000c1 - 0x000000c8 */
|
||||
uint64_t mtrr_cap; /* 0x000000fe */
|
||||
|
||||
/* IDT WinChip and WinChip 2 MSR's that are also on the VIA Cyrix III */
|
||||
/* IDT WinChip C6/2/VIA Cyrix III MSRs */
|
||||
uint32_t fcr; /* 0x00000107 (IDT), 0x00001107 (VIA) */
|
||||
uint64_t fcr2; /* 0x00000108 (IDT), 0x00001108 (VIA) */
|
||||
uint64_t fcr3; /* 0x00000108 (IDT), 0x00001108 (VIA) */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
/* AMD K5/K6 MSRs */
|
||||
uint64_t amd_hwcr; /* 0x00000083 - all K5 and K6 */
|
||||
|
||||
uint64_t amd_efer; /* 0xc0000080 - all K5 and K6 */
|
||||
uint64_t amd_star; /* 0xc0000081 - K6-2 and later */
|
||||
uint64_t amd_whcr; /* 0xc0000082 - all K5 and K6 */
|
||||
uint64_t amd_uwccr; /* 0xc0000085 - K6-2C and later */
|
||||
uint64_t amd_epmr; /* 0xc0000086 - K6-III+/2+ only */
|
||||
uint64_t amd_psor; /* 0xc0000087 - K6-2C and later */
|
||||
uint64_t amd_pfir; /* 0xc0000088 - K6-2C and later */
|
||||
uint64_t amd_l2aar; /* 0xc0000089 - K6-III and later */
|
||||
|
||||
/* Pentium/Pentium MMX MSRs */
|
||||
uint32_t tr1; /* 0x00000002 - also on WinChip C6/2 */
|
||||
uint32_t tr12; /* 0x0000000e - also on WinChip C6/2 */
|
||||
uint32_t cesr; /* 0x00000011 - also on WinChip C6/2 */
|
||||
|
||||
/* Pentium Pro/II MSRs */
|
||||
uint64_t apic_base; /* 0x0000001b */
|
||||
uint64_t bios_updt; /* 0x00000079 */
|
||||
|
||||
uint64_t bbl_cr_dx[4]; /* 0x00000088 - 0x0000008b */
|
||||
uint64_t ia32_pmc[8]; /* 0x000000c1 - 0x000000c8 */
|
||||
uint64_t mtrr_cap; /* 0x000000fe */
|
||||
|
||||
uint64_t bbl_cr_addr; /* 0x00000116 */
|
||||
uint64_t bbl_cr_decc; /* 0x00000118 */
|
||||
uint64_t bbl_cr_ctl; /* 0x00000119 */
|
||||
@@ -262,68 +268,32 @@ typedef struct {
|
||||
uint64_t bbl_cr_busy; /* 0x0000011b */
|
||||
uint64_t bbl_cr_ctl3; /* 0x0000011e */
|
||||
|
||||
/* Pentium II Klamath and Pentium II Deschutes MSR's */
|
||||
uint16_t sysenter_cs; /* 0x00000174 - SYSENTER/SYSEXIT MSR's */
|
||||
uint32_t sysenter_esp; /* 0x00000175 - SYSENTER/SYSEXIT MSR's */
|
||||
uint32_t sysenter_eip; /* 0x00000176 - SYSENTER/SYSEXIT MSR's */
|
||||
uint16_t sysenter_cs; /* 0x00000174 - Pentium II and later */
|
||||
uint32_t sysenter_esp; /* 0x00000175 - Pentium II and later */
|
||||
uint32_t sysenter_eip; /* 0x00000176 - Pentium II and later */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t mcg_ctl; /* 0x0000017b - Machine Check Architecture */
|
||||
uint64_t evntsel0; /* 0x00000186 */
|
||||
uint64_t evntsel1; /* 0x00000187 */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t debug_ctl; /* 0x000001d9 - Debug Registers Control */
|
||||
uint64_t mcg_ctl; /* 0x0000017b */
|
||||
uint64_t evntsel0; /* 0x00000186 */
|
||||
uint64_t evntsel1; /* 0x00000187 */
|
||||
uint64_t debug_ctl; /* 0x000001d9 */
|
||||
uint64_t rob_cr_bkuptmpdr6; /* 0x000001e0 */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's that are also
|
||||
on the VIA Cyrix III */
|
||||
uint64_t mtrr_physbase[8]; /* 0x00000200 - 0x0000020f */
|
||||
/* MTTR-related MSRs also present on the VIA Cyrix III */
|
||||
uint64_t mtrr_physbase[8]; /* 0x00000200 - 0x0000020f (ECX & 0) */
|
||||
uint64_t mtrr_physmask[8]; /* 0x00000200 - 0x0000020f (ECX & 1) */
|
||||
uint64_t mtrr_fix64k_8000; /* 0x00000250 */
|
||||
uint64_t mtrr_fix16k_8000; /* 0x00000258 */
|
||||
uint64_t mtrr_fix16k_a000; /* 0x00000259 */
|
||||
uint64_t mtrr_fix4k[8]; /* 0x00000268 - 0x0000026f */
|
||||
uint64_t mtrr_deftype; /* 0x000002ff */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t pat; /* 0x00000277 */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's that are also
|
||||
on the VIA Cyrix III */
|
||||
uint64_t mtrr_deftype; /* 0x000002ff */
|
||||
|
||||
/* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */
|
||||
uint64_t mca_ctl[5]; /* 0x00000400, 0x00000404, 0x00000408, 0x0000040c, 0x00000410 - Machine Check Architecture */
|
||||
uint64_t pat; /* 0x00000277 - Pentium II Deschutes and later */
|
||||
uint64_t mca_ctl[5]; /* 0x00000400, 0x00000404, 0x00000408, 0x0000040c, 0x00000410 */
|
||||
uint64_t ecx570; /* 0x00000570 */
|
||||
|
||||
/* IBM 386SLC, 486SLC, and 486BL MSR's */
|
||||
uint64_t ibm_por; /* 0x00001000 - Processor Operation Register */
|
||||
uint64_t ibm_crcr; /* 0x00001001 - Cache Region Control Register */
|
||||
|
||||
/* IBM 486SLC and 486BL MSR's */
|
||||
uint64_t ibm_por2; /* 0x00001002 - Processor Operation Register */
|
||||
|
||||
/* AMD K5, 5k86, K6, K6-2, K6-2C, K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t amd_efer; /* 0xc0000080 */
|
||||
|
||||
/* AMD K6-2, K6-2C, K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t star; /* 0xc0000081 */
|
||||
|
||||
/* AMD K5, 5k86, K6, K6-2, K6-2C, K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t amd_whcr; /* 0xc0000082 */
|
||||
|
||||
/* AMD K6-2C, K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t amd_uwccr; /* 0xc0000085 */
|
||||
|
||||
/* AMD K6-2P and K6-3P MSR's */
|
||||
uint64_t amd_epmr; /* 0xc0000086 */
|
||||
|
||||
/* AMD K6-2C, K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t amd_psor; /* 0xc0000087, 0xc0000088 */
|
||||
uint64_t amd_pfir; /* 0xc0000087, 0xc0000088 */
|
||||
|
||||
/* K6-3, K6-2P, and K6-3P MSR's */
|
||||
uint64_t amd_l2aar; /* 0xc0000089 */
|
||||
/* Other/Unclassified MSRs */
|
||||
uint64_t ecx20; /* 0x00000020, really 0x40000020, but we filter out the top 18 bits
|
||||
like a real Deschutes does. */
|
||||
} msr_t;
|
||||
|
||||
typedef struct {
|
||||
|
Reference in New Issue
Block a user