Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Sep 2002 14:17:25 -0400 (EDT)
From:      "Andrew R. Reiter" <arr@watson.org>
To:        Peter Wemm <peter@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 17811 for review
Message-ID:  <Pine.NEB.3.96L.1020921141717.95930A-100000@fledge.watson.org>
In-Reply-To: <200209210250.g8L2oO8L094711@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 20 Sep 2002, Peter Wemm wrote:

:http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17811
:
:Change 17811 by peter@peter_daintree on 2002/09/20 19:49:25
:
:	vm86 all gone

sweeet :))

:
:Affected files ...
:
:.. //depot/projects/hammer/sys/x86_64/include/sysarch.h#3 edit
:.. //depot/projects/hammer/sys/x86_64/x86_64/exception.s#3 edit
:.. //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#2 edit
:.. //depot/projects/hammer/sys/x86_64/x86_64/locore.s#4 edit
:.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#5 edit
:
:Differences ...
:
:==== //depot/projects/hammer/sys/x86_64/include/sysarch.h#3 (text+ko) ====
:
:@@ -69,7 +69,6 @@
: int i386_set_ldt(int, union descriptor *, int);
: int i386_get_ioperm(unsigned int, unsigned int *, int *);
: int i386_set_ioperm(unsigned int, unsigned int, int);
:-int i386_vm86(int, void *);
: int i386_set_watch(int, unsigned int, int, int, struct dbreg *);
: int i386_clr_watch(int, struct dbreg *);
: __END_DECLS
:
:==== //depot/projects/hammer/sys/x86_64/x86_64/exception.s#3 (text+ko) ====
:
:@@ -250,11 +250,6 @@
: 
: 
: /*
:- * Include vm86 call routines, which want to call doreti.
:- */
:-#include "i386/i386/vm86bios.s"
:-
:-/*
:  * Include what was once config+isa-dependent code.
:  * XXX it should be in a stand-alone file.  It's still icu-dependent and
:  * belongs in i386/isa.
:
:==== //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#2 (text+ko) ====
:
:@@ -72,7 +72,6 @@
: #endif
: #include <machine/cpu.h>
: #include <machine/sigframe.h>
:-#include <machine/vm86.h>
: #include <machine/proc.h>
: 
: ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
:@@ -204,7 +203,6 @@
: 
: ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL));
: ASSYM(GPROC0_SEL, GPROC0_SEL);
:-ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame));
: 
: ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));
: ASSYM(MTX_RECURSECNT, offsetof(struct mtx, mtx_recurse));
:
:==== //depot/projects/hammer/sys/x86_64/x86_64/locore.s#4 (text+ko) ====
:
:@@ -149,12 +149,6 @@
: p0upa:		.long	0		/* phys addr of proc0's UAREA */
: p0kpa:		.long	0		/* phys addr of proc0's STACK */
: 
:-vm86phystk:	.long	0		/* PA of vm86/bios stack */
:-
:-	.globl	vm86paddr, vm86pa
:-vm86paddr:	.long	0		/* address of vm86 region */
:-vm86pa:		.long	0		/* phys addr of vm86 region */
:-
: #ifdef BDE_DEBUGGER
: 	.globl	_bdb_exists		/* flag to indicate BDE debugger is present */
: _bdb_exists:	.long	0
:@@ -745,14 +739,6 @@
: 	addl	$KERNBASE, %esi
: 	movl	%esi, R(proc0kstack)
: 
:-	ALLOCPAGES(1)			/* vm86/bios stack */
:-	movl	%esi,R(vm86phystk)
:-
:-	ALLOCPAGES(3)			/* pgtable + ext + IOPAGES */
:-	movl	%esi,R(vm86pa)
:-	addl	$KERNBASE, %esi
:-	movl	%esi, R(vm86paddr)
:-
: #ifdef SMP
: /* Allocate cpu0's private data page */
: 	ALLOCPAGES(1)
:@@ -811,23 +797,6 @@
: 	movl	$ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx
: 	fillkptphys($PG_RW)
: 
:-/* Map space for the vm86 region */
:-	movl	R(vm86phystk), %eax
:-	movl	$4, %ecx
:-	fillkptphys($PG_RW)
:-
:-/* Map page 0 into the vm86 page table */
:-	movl	$0, %eax
:-	movl	$0, %ebx
:-	movl	$1, %ecx
:-	fillkpt(R(vm86pa), $PG_RW|PG_U)
:-
:-/* ...likewise for the ISA hole */
:-	movl	$ISA_HOLE_START, %eax
:-	movl	$ISA_HOLE_START>>PAGE_SHIFT, %ebx
:-	movl	$ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx
:-	fillkpt(R(vm86pa), $PG_RW|PG_U)
:-
: #ifdef SMP
: /* Map cpu0's private page into global kmem (4K @ cpu0prvpage) */
: 	movl	R(cpu0pp), %eax
:
:==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#5 (text+ko) ====
:
:@@ -114,7 +114,6 @@
: #include <i386/isa/icu.h>
: #include <i386/isa/intr_machdep.h>
: #include <isa/rtc.h>
:-#include <machine/vm86.h>
: #include <sys/ptrace.h>
: #include <machine/sigframe.h>
: 
:@@ -954,21 +953,17 @@
: {
: 	int i, physmap_idx, pa_indx;
: 	u_int basemem, extmem;
:-	struct vm86frame vmf;
:-	struct vm86context vmc;
: 	vm_offset_t pa, physmap[PHYSMAP_SIZE];
: 	pt_entry_t *pte;
: 	char *cp;
: 	struct bios_smap *smap;
: 
:-	bzero(&vmf, sizeof(struct vm86frame));
: 	bzero(physmap, sizeof(physmap));
: 
: 	/*
: 	 * Perform "base memory" related probes & setup
: 	 */
:-	vm86_intcall(0x12, &vmf);
:-	basemem = vmf.vmf_ax;
:+#error "basemem = fetch from loader metadata"
: 	if (basemem > 640) {
: 		printf("Preposterous BIOS basemem of %uK, truncating to 640K\n",
: 			basemem);
:@@ -976,59 +971,12 @@
: 	}
: 
: 	/*
:-	 * XXX if biosbasemem is now < 640, there is a `hole'
:-	 * between the end of base memory and the start of
:-	 * ISA memory.  The hole may be empty or it may
:-	 * contain BIOS code or data.  Map it read/write so
:-	 * that the BIOS can write to it.  (Memory from 0 to
:-	 * the physical end of the kernel is mapped read-only
:-	 * to begin with and then parts of it are remapped.
:-	 * The parts that aren't remapped form holes that
:-	 * remain read-only and are unused by the kernel.
:-	 * The base memory area is below the physical end of
:-	 * the kernel and right now forms a read-only hole.
:-	 * The part of it from PAGE_SIZE to
:-	 * (trunc_page(biosbasemem * 1024) - 1) will be
:-	 * remapped and used by the kernel later.)
:-	 *
:-	 * This code is similar to the code used in
:-	 * pmap_mapdev, but since no memory needs to be
:-	 * allocated we simply change the mapping.
:-	 */
:-	for (pa = trunc_page(basemem * 1024);
:-	     pa < ISA_HOLE_START; pa += PAGE_SIZE)
:-		pmap_kenter(KERNBASE + pa, pa);
:-
:-	/*
:-	 * if basemem != 640, map pages r/w into vm86 page table so 
:-	 * that the bios can scribble on it.
:-	 */
:-	pte = (pt_entry_t *)vm86paddr;
:-	for (i = basemem / 4; i < 160; i++)
:-		pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U;
:-
:-	/*
:-	 * map page 1 R/W into the kernel page table so we can use it
:-	 * as a buffer.  The kernel will unmap this page later.
:-	 */
:-	pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1);
:-
:-	/*
: 	 * get memory map with INT 15:E820
: 	 */
:-	vmc.npages = 0;
:-	smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT));
:-	vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di);
:+#error "smap = fetch from loader metadata"
: 
: 	physmap_idx = 0;
:-	vmf.vmf_ebx = 0;
: 	do {
:-		vmf.vmf_eax = 0xE820;
:-		vmf.vmf_edx = SMAP_SIG;
:-		vmf.vmf_ecx = sizeof(struct bios_smap);
:-		i = vm86_datacall(0x15, &vmf, &vmc);
:-		if (i || vmf.vmf_eax != SMAP_SIG)
:-			break;
: 		if (boothowto & RB_VERBOSE)
: 			printf("SMAP type=%02x base=%08x %08x len=%08x %08x\n",
: 				smap->type,
:@@ -1072,51 +1020,9 @@
: 		physmap[physmap_idx] = smap->base;
: 		physmap[physmap_idx + 1] = smap->base + smap->length;
: next_run: ;
:-	} while (vmf.vmf_ebx != 0);
:-
:-	if (physmap[1] != 0)
:-		goto physmap_done;
:-
:-	/*
:-	 * If we failed above, try memory map with INT 15:E801
:-	 */
:-	vmf.vmf_ax = 0xE801;
:-	if (vm86_intcall(0x15, &vmf) == 0) {
:-		extmem = vmf.vmf_cx + vmf.vmf_dx * 64;
:-	} else {
:-#if 0
:-		vmf.vmf_ah = 0x88;
:-		vm86_intcall(0x15, &vmf);
:-		extmem = vmf.vmf_ax;
:-#else
:-		/*
:-		 * Prefer the RTC value for extended memory.
:-		 */
:-		extmem = rtcin(RTC_EXTLO) + (rtcin(RTC_EXTHI) << 8);
:-#endif
:-	}
:+	} #error "while not end of smap table from loader"
: 
: 	/*
:-	 * Special hack for chipsets that still remap the 384k hole when
:-	 * there's 16MB of memory - this really confuses people that
:-	 * are trying to use bus mastering ISA controllers with the
:-	 * "16MB limit"; they only have 16MB, but the remapping puts
:-	 * them beyond the limit.
:-	 *
:-	 * If extended memory is between 15-16MB (16-17MB phys address range),
:-	 *	chop it to 15MB.
:-	 */
:-	if ((extmem > 15 * 1024) && (extmem < 16 * 1024))
:-		extmem = 15 * 1024;
:-
:-	physmap[0] = 0;
:-	physmap[1] = basemem * 1024;
:-	physmap_idx = 2;
:-	physmap[physmap_idx] = 0x100000;
:-	physmap[physmap_idx + 1] = physmap[physmap_idx] + extmem * 1024;
:-
:-physmap_done:
:-	/*
: 	 * Now, physmap contains a map of physical memory.
: 	 */
: 
:@@ -1520,7 +1426,6 @@
: 	dblfault_tss.tss_cs = GSEL(GCODE_SEL, SEL_KPL);
: 	dblfault_tss.tss_ldt = GSEL(GLDT_SEL, SEL_KPL);
: 
:-	vm86_initialize();
: 	getmemsize(first);
: 	init_param2(physmem);
: 
:

--
Andrew R. Reiter
arr@watson.org
arr@FreeBSD.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1020921141717.95930A-100000>