mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Remove unused VMXAssist test code.
Signed-off-by: Xin Li <xin.b.li@intel.com>
This commit is contained in:
1 parent
caa6c26fb3
commit
883a5de1d2
4 files changed
+1
-159
No files matched your search
@@ -25,81 +25,13 @@
|
||||
* switch happens to the environment below. The magic indicates
|
||||
* that this is a valid context.
|
||||
*/
|
||||
#ifdef TEST
|
||||
.byte 0x55, 0xaa
|
||||
.byte 0x80
|
||||
.code16
|
||||
jmp _start16
|
||||
#else
|
||||
jmp _start
|
||||
#endif
|
||||
|
||||
.align 8
|
||||
.long VMXASSIST_MAGIC
|
||||
.long newctx /* new context */
|
||||
.long oldctx /* old context */
|
||||
|
||||
#ifdef TEST
|
||||
/*
|
||||
* We are running in 16-bit. Get into the protected mode as soon as
|
||||
* possible. We use our own (minimal) GDT to get started.
|
||||
*
|
||||
* ROM is a misnomer as this code isn't really rommable (although it
|
||||
* only requires a few changes) but it does live in a BIOS ROM segment.
|
||||
* This code allows me to debug vmxassists under (a modified version of)
|
||||
* Bochs and load it as a "optromimage1".
|
||||
*/
|
||||
.code16
|
||||
.globl _start16
|
||||
_start16:
|
||||
cli
|
||||
|
||||
/* load our own global descriptor table */
|
||||
data32 addr32 lgdt %cs:(rom_gdtr - TEXTADDR)
|
||||
|
||||
/* go to protected mode */
|
||||
movl %cr0, %eax
|
||||
orl $(CR0_PE), %eax
|
||||
movl %eax, %cr0
|
||||
data32 ljmp $0x08, $1f
|
||||
|
||||
.align 32
|
||||
.globl rom_gdt
|
||||
rom_gdt:
|
||||
.word 0, 0 /* 0x00: reserved */
|
||||
.byte 0, 0, 0, 0
|
||||
|
||||
.word 0xFFFF, 0 /* 0x08: CS 32-bit */
|
||||
.byte 0, 0x9A, 0xCF, 0
|
||||
|
||||
.word 0xFFFF, 0 /* 0x10: CS 32-bit */
|
||||
.byte 0, 0x92, 0xCF, 0
|
||||
rom_gdt_end:
|
||||
|
||||
.align 4
|
||||
.globl rom_gdtr
|
||||
rom_gdtr:
|
||||
.word rom_gdt_end - rom_gdt - 1
|
||||
.long rom_gdt
|
||||
|
||||
.code32
|
||||
1:
|
||||
/* welcome to the 32-bit world */
|
||||
movw $0x10, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %es
|
||||
movw %ax, %ss
|
||||
movw %ax, %fs
|
||||
movw %ax, %gs
|
||||
|
||||
/* enable Bochs debug facilities */
|
||||
movw $0x8A00, %dx
|
||||
movw $0x8A00, %ax
|
||||
outw %ax, (%dx)
|
||||
|
||||
jmp _start
|
||||
#endif /* TEST */
|
||||
|
||||
/*
|
||||
* This is the real start. Control was transfered to this point
|
||||
* with CR0_PE set and executing in some 32-bit segment. We call
|
||||
@@ -111,9 +43,6 @@ _start:
|
||||
cli
|
||||
|
||||
/* save register parameters to C land */
|
||||
#ifdef TEST
|
||||
xorl %edx, %edx
|
||||
#endif
|
||||
|
||||
/* clear bss */
|
||||
cld
|
||||
@@ -145,11 +74,6 @@ _start:
|
||||
halt:
|
||||
push $halt_msg
|
||||
call printf
|
||||
#ifdef TEST
|
||||
movw $0x8A00, %dx
|
||||
movw $0x8AE0, %ax
|
||||
outw %ax, (%dx)
|
||||
#endif
|
||||
cli
|
||||
jmp .
|
||||
|
||||
|
||||
@@ -56,13 +56,6 @@
|
||||
#define LPGSIZE (1 << LOG_PDSIZE) /* large page size */
|
||||
#define LPGMASK (~(LPGSIZE - 1)) /* large page mask */
|
||||
|
||||
#ifdef TEST
|
||||
#define PTE_P (1 << 0) /* Present */
|
||||
#define PTE_RW (1 << 1) /* Read/Write */
|
||||
#define PTE_US (1 << 2) /* User/Supervisor */
|
||||
#define PTE_PS (1 << 7) /* Page Size */
|
||||
#endif
|
||||
|
||||
/* Programmable Interrupt Contoller (PIC) defines */
|
||||
#define PIC_MASTER 0x20
|
||||
#define PIC_SLAVE 0xA0
|
||||
@@ -195,14 +188,6 @@ set_cr4(unsigned value)
|
||||
__asm__ __volatile__("movl %0, %%cr4" : /* no outputs */ : "r"(value));
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
static inline void
|
||||
breakpoint(void)
|
||||
{
|
||||
outw(0x8A00, 0x8AE0);
|
||||
}
|
||||
#endif /* TEST */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __MACHINE_H__ */
|
||||
|
||||
@@ -47,19 +47,6 @@ unsigned long long idt[NR_TRAPS] __attribute__ ((aligned(32)));
|
||||
|
||||
struct dtr idtr = { sizeof(idt)-1, (unsigned long) &idt };
|
||||
|
||||
#ifdef TEST
|
||||
unsigned pgd[NR_PGD] __attribute__ ((aligned(PGSIZE))) = { 0 };
|
||||
|
||||
struct e820entry e820map[] = {
|
||||
{ 0x0000000000000000ULL, 0x000000000009F800ULL, E820_RAM },
|
||||
{ 0x000000000009F800ULL, 0x0000000000000800ULL, E820_RESERVED },
|
||||
{ 0x00000000000C0000ULL, 0x0000000000040000ULL, E820_RESERVED },
|
||||
{ 0x0000000000100000ULL, 0x0000000000000000ULL, E820_RAM },
|
||||
{ 0x0000000000000000ULL, 0x0000000000003000ULL, E820_NVS },
|
||||
{ 0x0000000000003000ULL, 0x000000000000A000ULL, E820_ACPI },
|
||||
};
|
||||
#endif /* TEST */
|
||||
|
||||
struct vmx_assist_context oldctx;
|
||||
struct vmx_assist_context newctx;
|
||||
|
||||
@@ -84,39 +71,12 @@ banner(void)
|
||||
(((get_cmos(0x31) << 8) | get_cmos(0x30)) + 0x400) << 10;
|
||||
memory_size += 0x400 << 10; /* + 1MB */
|
||||
|
||||
#ifdef TEST
|
||||
/* Create an SMAP for our debug environment */
|
||||
e820map[4].size = memory_size - e820map[4].addr - PGSIZE;
|
||||
e820map[5].addr = memory_size - PGSIZE;
|
||||
e820map[6].addr = memory_size;
|
||||
e820map[7].addr += memory_size;
|
||||
|
||||
*HVM_E820_NR = sizeof(e820map)/sizeof(e820map[0]);
|
||||
memcpy(HVM_E820, e820map, sizeof(e820map));
|
||||
#endif
|
||||
|
||||
printf("Memory size %ld MB\n", memory_size >> 20);
|
||||
printf("E820 map:\n");
|
||||
print_e820_map(HVM_E820, *HVM_E820_NR);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
void
|
||||
setup_paging(void)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
if (((unsigned)pgd & ~PGMASK) != 0)
|
||||
panic("PGD not page aligned");
|
||||
set_cr4(get_cr4() | CR4_PSE);
|
||||
for (i = 0; i < NR_PGD; i++)
|
||||
pgd[i] = (i * LPGSIZE)| PTE_PS | PTE_US | PTE_RW | PTE_P;
|
||||
set_cr3((unsigned) pgd);
|
||||
set_cr0(get_cr0() | (CR0_PE|CR0_PG));
|
||||
}
|
||||
#endif /* TEST */
|
||||
|
||||
void
|
||||
setup_gdt(void)
|
||||
{
|
||||
@@ -211,11 +171,7 @@ enter_real_mode(struct regs *regs)
|
||||
regs->ves = regs->vds = regs->vfs = regs->vgs = 0xF000;
|
||||
if (booting_cpu == 0) {
|
||||
regs->cs = 0xF000; /* ROM BIOS POST entry point */
|
||||
#ifdef TEST
|
||||
regs->eip = 0xFFE0;
|
||||
#else
|
||||
regs->eip = 0xFFF0;
|
||||
#endif
|
||||
} else {
|
||||
regs->cs = booting_vector << 8; /* AP entry point */
|
||||
regs->eip = 0;
|
||||
@@ -269,13 +225,8 @@ setup_ctx(void)
|
||||
* more natural to enable CR0.PE to cause a world switch to
|
||||
* protected mode rather than disabling it.
|
||||
*/
|
||||
#ifdef TEST
|
||||
c->cr0 = (get_cr0() | CR0_NE | CR0_PG) & ~CR0_PE;
|
||||
c->cr3 = (unsigned long) pgd;
|
||||
#else
|
||||
c->cr0 = (get_cr0() | CR0_NE) & ~CR0_PE;
|
||||
c->cr3 = 0;
|
||||
#endif
|
||||
c->cr4 = get_cr4();
|
||||
|
||||
c->idtr_limit = sizeof(idt)-1;
|
||||
@@ -369,16 +320,10 @@ main(void)
|
||||
if (booting_cpu == 0)
|
||||
banner();
|
||||
|
||||
#ifdef TEST
|
||||
setup_paging();
|
||||
#endif
|
||||
|
||||
setup_gdt();
|
||||
setup_idt();
|
||||
|
||||
#ifndef TEST
|
||||
set_cr4(get_cr4() | CR4_VME);
|
||||
#endif
|
||||
|
||||
setup_ctx();
|
||||
|
||||
|
||||
@@ -561,11 +561,7 @@ lmsw(struct regs *regs, unsigned prefix, unsigned modrm)
|
||||
unsigned cr0 = (oldctx.cr0 & 0xFFFFFFF0) | ax;
|
||||
|
||||
TRACE((regs, regs->eip - eip, "lmsw 0x%x", ax));
|
||||
#ifndef TEST
|
||||
oldctx.cr0 = cr0 | CR0_PE | CR0_NE;
|
||||
#else
|
||||
oldctx.cr0 = cr0 | CR0_PE | CR0_NE | CR0_PG;
|
||||
#endif
|
||||
if (cr0 & CR0_PE)
|
||||
set_mode(regs, VM86_REAL_TO_PROTECTED);
|
||||
|
||||
@@ -656,13 +652,8 @@ movcr(struct regs *regs, unsigned prefix, unsigned opc)
|
||||
TRACE((regs, regs->eip - eip, "movl %%cr%d, %%eax", cr));
|
||||
switch (cr) {
|
||||
case 0:
|
||||
#ifndef TEST
|
||||
setreg32(regs, modrm,
|
||||
oldctx.cr0 & ~(CR0_PE | CR0_NE));
|
||||
#else
|
||||
setreg32(regs, modrm,
|
||||
oldctx.cr0 & ~(CR0_PE | CR0_NE | CR0_PG));
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
setreg32(regs, modrm, get_cr2());
|
||||
@@ -680,9 +671,6 @@ movcr(struct regs *regs, unsigned prefix, unsigned opc)
|
||||
switch (cr) {
|
||||
case 0:
|
||||
oldctx.cr0 = getreg32(regs, modrm) | (CR0_PE | CR0_NE);
|
||||
#ifdef TEST
|
||||
oldctx.cr0 |= CR0_PG;
|
||||
#endif
|
||||
if (getreg32(regs, modrm) & CR0_PE)
|
||||
set_mode(regs, VM86_REAL_TO_PROTECTED);
|
||||
else
|
||||
@@ -1086,7 +1074,7 @@ jmpl(struct regs *regs, int prefix)
|
||||
|
||||
if (mode == VM86_REAL_TO_PROTECTED) /* jump to protected mode */
|
||||
set_mode(regs, VM86_PROTECTED);
|
||||
else if (mode == VM86_PROTECTED_TO_REAL)/* jump to real mode */
|
||||
else if (mode == VM86_PROTECTED_TO_REAL) /* jump to real mode */
|
||||
set_mode(regs, VM86_REAL);
|
||||
else
|
||||
panic("jmpl");
|
||||
|
||||