direct-io.hg

changeset 15439:a3a0202af8a4

Remove unused VMXAssist test code.
Signed-off-by: Xin Li <xin.b.li@intel.com>
author Keir Fraser <keir@xensource.com>
date Sun Jul 01 22:18:04 2007 +0100 (2007-07-01)
parents 27e55a7358e2
children ccf240f99263
files tools/firmware/vmxassist/head.S tools/firmware/vmxassist/machine.h tools/firmware/vmxassist/setup.c tools/firmware/vmxassist/vm86.c
line diff
     1.1 --- a/tools/firmware/vmxassist/head.S	Sun Jul 01 22:16:41 2007 +0100
     1.2 +++ b/tools/firmware/vmxassist/head.S	Sun Jul 01 22:18:04 2007 +0100
     1.3 @@ -25,81 +25,13 @@
     1.4   * switch happens to the environment below. The magic indicates
     1.5   * that this is a valid context.
     1.6   */
     1.7 -#ifdef TEST
     1.8 -	.byte 0x55, 0xaa
     1.9 -	.byte 0x80
    1.10 -	.code16
    1.11 -	jmp	_start16
    1.12 -#else
    1.13  	jmp	_start
    1.14 -#endif
    1.15  
    1.16  	.align	8
    1.17  	.long	VMXASSIST_MAGIC
    1.18  	.long	newctx			/* new context */
    1.19  	.long	oldctx			/* old context */
    1.20  
    1.21 -#ifdef TEST
    1.22 -/*
    1.23 - * We are running in 16-bit. Get into the protected mode as soon as
    1.24 - * possible. We use our own (minimal) GDT to get started.
    1.25 - *
    1.26 - * ROM is a misnomer as this code isn't really rommable (although it
    1.27 - * only requires a few changes) but it does live in a BIOS ROM segment.
    1.28 - * This code allows me to debug vmxassists under (a modified version of)
    1.29 - * Bochs and load it as a "optromimage1".
    1.30 - */
    1.31 -	.code16
    1.32 -	.globl	_start16
    1.33 -_start16:
    1.34 -        cli
    1.35 -
    1.36 -        /* load our own global descriptor table */
    1.37 -        data32 addr32 lgdt %cs:(rom_gdtr - TEXTADDR)
    1.38 -
    1.39 -        /* go to protected mode */
    1.40 -        movl    %cr0, %eax
    1.41 -        orl     $(CR0_PE), %eax
    1.42 -        movl    %eax, %cr0
    1.43 -        data32  ljmp $0x08, $1f
    1.44 -
    1.45 -        .align  32
    1.46 -        .globl  rom_gdt
    1.47 -rom_gdt:
    1.48 -        .word   0, 0            /* 0x00: reserved */
    1.49 -        .byte   0, 0, 0, 0
    1.50 -
    1.51 -        .word   0xFFFF, 0       /* 0x08: CS 32-bit */
    1.52 -        .byte   0, 0x9A, 0xCF, 0
    1.53 -
    1.54 -        .word   0xFFFF, 0       /* 0x10: CS 32-bit */
    1.55 -        .byte   0, 0x92, 0xCF, 0
    1.56 -rom_gdt_end:
    1.57 -
    1.58 -        .align  4
    1.59 -        .globl  rom_gdtr
    1.60 -rom_gdtr:
    1.61 -        .word   rom_gdt_end - rom_gdt - 1
    1.62 -        .long   rom_gdt
    1.63 -
    1.64 -        .code32
    1.65 -1:
    1.66 -        /* welcome to the 32-bit world */
    1.67 -        movw    $0x10, %ax
    1.68 -        movw    %ax, %ds
    1.69 -        movw    %ax, %es
    1.70 -        movw    %ax, %ss
    1.71 -        movw    %ax, %fs
    1.72 -        movw    %ax, %gs
    1.73 -
    1.74 -        /* enable Bochs debug facilities */
    1.75 -        movw    $0x8A00, %dx
    1.76 -        movw    $0x8A00, %ax
    1.77 -        outw    %ax, (%dx)
    1.78 -
    1.79 -	jmp	_start
    1.80 -#endif /* TEST */
    1.81 -
    1.82  /*
    1.83   * This is the real start. Control was transfered to this point
    1.84   * with CR0_PE set and executing in some 32-bit segment. We call
    1.85 @@ -111,9 +43,6 @@ 1:
    1.86  	cli
    1.87  
    1.88  	/* save register parameters to C land */
    1.89 -#ifdef TEST
    1.90 -	xorl	%edx, %edx
    1.91 -#endif
    1.92  
    1.93  	/* clear bss */
    1.94  	cld
    1.95 @@ -145,11 +74,6 @@ 1:
    1.96  halt:
    1.97  	push	$halt_msg
    1.98  	call	printf
    1.99 -#ifdef TEST
   1.100 -        movw    $0x8A00, %dx
   1.101 -        movw    $0x8AE0, %ax
   1.102 -        outw    %ax, (%dx)
   1.103 -#endif
   1.104  	cli
   1.105  	jmp	.
   1.106  
     2.1 --- a/tools/firmware/vmxassist/machine.h	Sun Jul 01 22:16:41 2007 +0100
     2.2 +++ b/tools/firmware/vmxassist/machine.h	Sun Jul 01 22:18:04 2007 +0100
     2.3 @@ -56,13 +56,6 @@
     2.4  #define	LPGSIZE		(1 << LOG_PDSIZE)	/* large page size */
     2.5  #define	LPGMASK		(~(LPGSIZE - 1))	/* large page mask */
     2.6  
     2.7 -#ifdef TEST
     2.8 -#define	PTE_P		(1 << 0)	/* Present */
     2.9 -#define	PTE_RW		(1 << 1)	/* Read/Write */
    2.10 -#define	PTE_US		(1 << 2)	/* User/Supervisor */
    2.11 -#define	PTE_PS		(1 << 7)	/* Page Size */
    2.12 -#endif
    2.13 -
    2.14  /* Programmable Interrupt Contoller (PIC) defines */
    2.15  #define	PIC_MASTER	0x20
    2.16  #define	PIC_SLAVE	0xA0
    2.17 @@ -195,14 +188,6 @@ set_cr4(unsigned value)
    2.18  	__asm__ __volatile__("movl %0, %%cr4" : /* no outputs */ : "r"(value));
    2.19  }
    2.20  
    2.21 -#ifdef TEST
    2.22 -static inline void
    2.23 -breakpoint(void)
    2.24 -{
    2.25 -	outw(0x8A00, 0x8AE0);
    2.26 -}
    2.27 -#endif /* TEST */
    2.28 -
    2.29  #endif /* __ASSEMBLY__ */
    2.30  
    2.31  #endif /* __MACHINE_H__ */
     3.1 --- a/tools/firmware/vmxassist/setup.c	Sun Jul 01 22:16:41 2007 +0100
     3.2 +++ b/tools/firmware/vmxassist/setup.c	Sun Jul 01 22:18:04 2007 +0100
     3.3 @@ -47,19 +47,6 @@ unsigned long long idt[NR_TRAPS] __attri
     3.4  
     3.5  struct dtr idtr = { sizeof(idt)-1, (unsigned long) &idt };
     3.6  
     3.7 -#ifdef TEST
     3.8 -unsigned pgd[NR_PGD] __attribute__ ((aligned(PGSIZE))) = { 0 };
     3.9 -
    3.10 -struct e820entry e820map[] = {
    3.11 -	{ 0x0000000000000000ULL, 0x000000000009F800ULL, E820_RAM },
    3.12 -	{ 0x000000000009F800ULL, 0x0000000000000800ULL, E820_RESERVED },
    3.13 -	{ 0x00000000000C0000ULL, 0x0000000000040000ULL, E820_RESERVED },
    3.14 -	{ 0x0000000000100000ULL, 0x0000000000000000ULL, E820_RAM },
    3.15 -	{ 0x0000000000000000ULL, 0x0000000000003000ULL, E820_NVS },
    3.16 -	{ 0x0000000000003000ULL, 0x000000000000A000ULL, E820_ACPI },
    3.17 -};
    3.18 -#endif /* TEST */
    3.19 -
    3.20  struct vmx_assist_context oldctx;
    3.21  struct vmx_assist_context newctx;
    3.22  
    3.23 @@ -84,39 +71,12 @@ banner(void)
    3.24  		    (((get_cmos(0x31) << 8) | get_cmos(0x30)) + 0x400) << 10;
    3.25  	memory_size += 0x400 << 10; /* + 1MB */
    3.26  
    3.27 -#ifdef TEST
    3.28 -	/* Create an SMAP for our debug environment */
    3.29 -	e820map[4].size = memory_size - e820map[4].addr - PGSIZE;
    3.30 -	e820map[5].addr = memory_size - PGSIZE;
    3.31 -	e820map[6].addr = memory_size;
    3.32 -	e820map[7].addr += memory_size;
    3.33 -
    3.34 -	*HVM_E820_NR = sizeof(e820map)/sizeof(e820map[0]);
    3.35 -	memcpy(HVM_E820, e820map, sizeof(e820map));
    3.36 -#endif
    3.37 -
    3.38  	printf("Memory size %ld MB\n", memory_size >> 20);
    3.39  	printf("E820 map:\n");
    3.40  	print_e820_map(HVM_E820, *HVM_E820_NR);
    3.41  	printf("\n");
    3.42  }
    3.43  
    3.44 -#ifdef TEST
    3.45 -void
    3.46 -setup_paging(void)
    3.47 -{
    3.48 -	unsigned long i;
    3.49 -
    3.50 -	if (((unsigned)pgd & ~PGMASK) != 0)
    3.51 -		panic("PGD not page aligned");
    3.52 -	set_cr4(get_cr4() | CR4_PSE);
    3.53 -	for (i = 0; i < NR_PGD; i++)
    3.54 -		pgd[i] = (i * LPGSIZE)| PTE_PS | PTE_US | PTE_RW | PTE_P;
    3.55 -	set_cr3((unsigned) pgd);
    3.56 -	set_cr0(get_cr0() | (CR0_PE|CR0_PG));
    3.57 -}
    3.58 -#endif /* TEST */
    3.59 -
    3.60  void
    3.61  setup_gdt(void)
    3.62  {
    3.63 @@ -211,11 +171,7 @@ enter_real_mode(struct regs *regs)
    3.64  		regs->ves = regs->vds = regs->vfs = regs->vgs = 0xF000;
    3.65  		if (booting_cpu == 0) {
    3.66  			regs->cs = 0xF000; /* ROM BIOS POST entry point */
    3.67 -#ifdef TEST
    3.68 -			regs->eip = 0xFFE0;
    3.69 -#else
    3.70  			regs->eip = 0xFFF0;
    3.71 -#endif
    3.72  		} else {
    3.73  			regs->cs = booting_vector << 8; /* AP entry point */
    3.74  			regs->eip = 0;
    3.75 @@ -269,13 +225,8 @@ setup_ctx(void)
    3.76  	 * more natural to enable CR0.PE to cause a world switch to
    3.77  	 * protected mode rather than disabling it.
    3.78  	 */
    3.79 -#ifdef TEST
    3.80 -	c->cr0 = (get_cr0() | CR0_NE | CR0_PG) & ~CR0_PE;
    3.81 -	c->cr3 = (unsigned long) pgd;
    3.82 -#else
    3.83  	c->cr0 = (get_cr0() | CR0_NE) & ~CR0_PE;
    3.84  	c->cr3 = 0;
    3.85 -#endif
    3.86  	c->cr4 = get_cr4();
    3.87  
    3.88  	c->idtr_limit = sizeof(idt)-1;
    3.89 @@ -369,16 +320,10 @@ main(void)
    3.90  	if (booting_cpu == 0)
    3.91  		banner();
    3.92  
    3.93 -#ifdef TEST
    3.94 -	setup_paging();
    3.95 -#endif
    3.96 -
    3.97  	setup_gdt();
    3.98  	setup_idt();
    3.99  
   3.100 -#ifndef	TEST
   3.101  	set_cr4(get_cr4() | CR4_VME);
   3.102 -#endif
   3.103  
   3.104  	setup_ctx();
   3.105  
     4.1 --- a/tools/firmware/vmxassist/vm86.c	Sun Jul 01 22:16:41 2007 +0100
     4.2 +++ b/tools/firmware/vmxassist/vm86.c	Sun Jul 01 22:18:04 2007 +0100
     4.3 @@ -561,11 +561,7 @@ lmsw(struct regs *regs, unsigned prefix,
     4.4  	unsigned cr0 = (oldctx.cr0 & 0xFFFFFFF0) | ax;
     4.5  
     4.6  	TRACE((regs, regs->eip - eip, "lmsw 0x%x", ax));
     4.7 -#ifndef TEST
     4.8  	oldctx.cr0 = cr0 | CR0_PE | CR0_NE;
     4.9 -#else
    4.10 -	oldctx.cr0 = cr0 | CR0_PE | CR0_NE | CR0_PG;
    4.11 -#endif
    4.12  	if (cr0 & CR0_PE)
    4.13  		set_mode(regs, VM86_REAL_TO_PROTECTED);
    4.14  
    4.15 @@ -656,13 +652,8 @@ movcr(struct regs *regs, unsigned prefix
    4.16  		TRACE((regs, regs->eip - eip, "movl %%cr%d, %%eax", cr));
    4.17  		switch (cr) {
    4.18  		case 0:
    4.19 -#ifndef TEST
    4.20  			setreg32(regs, modrm,
    4.21  				oldctx.cr0 & ~(CR0_PE | CR0_NE));
    4.22 -#else
    4.23 -			setreg32(regs, modrm,
    4.24 -				oldctx.cr0 & ~(CR0_PE | CR0_NE | CR0_PG));
    4.25 -#endif
    4.26  			break;
    4.27  		case 2:
    4.28  			setreg32(regs, modrm, get_cr2());
    4.29 @@ -680,9 +671,6 @@ movcr(struct regs *regs, unsigned prefix
    4.30  		switch (cr) {
    4.31  		case 0:
    4.32  			oldctx.cr0 = getreg32(regs, modrm) | (CR0_PE | CR0_NE);
    4.33 -#ifdef TEST
    4.34 -			oldctx.cr0 |= CR0_PG;
    4.35 -#endif
    4.36  			if (getreg32(regs, modrm) & CR0_PE)
    4.37  				set_mode(regs, VM86_REAL_TO_PROTECTED);
    4.38  			else
    4.39 @@ -1086,7 +1074,7 @@ jmpl(struct regs *regs, int prefix)
    4.40  
    4.41  	if (mode == VM86_REAL_TO_PROTECTED)		/* jump to protected mode */
    4.42  		set_mode(regs, VM86_PROTECTED);
    4.43 -	else if (mode == VM86_PROTECTED_TO_REAL)/* jump to real mode */
    4.44 +	else if (mode == VM86_PROTECTED_TO_REAL)	/* jump to real mode */
    4.45  		set_mode(regs, VM86_REAL);
    4.46  	else
    4.47  		panic("jmpl");