Module Name: src Committed By: andvar Date: Wed Sep 11 20:15:37 UTC 2024
Modified Files: src/sys/arch/i386/stand/dosboot: Makefile main.c start_dos.S version src/sys/arch/i386/stand/lib: exec.c Log Message: dosboot(8): remove XMS-specific code. The boot process has been broken for over a decade, and its relevance has diminished due to the availability of other boot options. PR port-i386/58624 To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/stand/dosboot/Makefile cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/stand/dosboot/main.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/dosboot/start_dos.S cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/dosboot/version cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/stand/lib/exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/stand/dosboot/Makefile diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.38 src/sys/arch/i386/stand/dosboot/Makefile:1.39 --- src/sys/arch/i386/stand/dosboot/Makefile:1.38 Sat Jun 29 13:46:40 2024 +++ src/sys/arch/i386/stand/dosboot/Makefile Wed Sep 11 20:15:36 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.38 2024/06/29 13:46:40 rin Exp $ +# $NetBSD: Makefile,v 1.39 2024/09/11 20:15:36 andvar Exp $ S= ${.CURDIR}/../../../.. @@ -14,7 +14,6 @@ SRCS+= exec_multiboot1.c exec_multiboot2 #CPPFLAGS+= -DSLOW # for libz; no longer available CPPFLAGS+= -DCOMPAT_386BSD_MBRPART -CPPFLAGS+= -DXMS CPPFLAGS+= -DLIBSA_ENABLE_LS_OP CPPFLAGS+= -DNO_MULTIBOOT2 # keep the binary small #uncomment if there are problems with memory detection Index: src/sys/arch/i386/stand/dosboot/main.c diff -u src/sys/arch/i386/stand/dosboot/main.c:1.33 src/sys/arch/i386/stand/dosboot/main.c:1.34 --- src/sys/arch/i386/stand/dosboot/main.c:1.33 Mon May 13 17:50:30 2019 +++ src/sys/arch/i386/stand/dosboot/main.c Wed Sep 11 20:15:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.33 2019/05/13 17:50:30 maxv Exp $ */ +/* $NetBSD: main.c,v 1.34 2024/09/11 20:15:36 andvar Exp $ */ /* * Copyright (c) 1996, 1997 @@ -191,31 +191,14 @@ static void print_banner(void) { int extmem = getextmem(); - char *s = ""; clear_pc_screen(); -#ifdef XMS - u_long xmsmem; - if (getextmem1() == 0 && (xmsmem = checkxms()) != 0) { - /* - * With "CONSERVATIVE_MEMDETECT", extmem is 0 because - * getextmem() is getextmem1(). Without, the "smart" - * methods could fail to report all memory as well. - * xmsmem is a few kB less than the actual size, but - * better than nothing. - */ - if ((int)xmsmem > extmem) - extmem = xmsmem; - s = "(xms) "; - } -#endif - printf("\n" ">> %s, Revision %s (from NetBSD %s)\n" - ">> Memory: %d/%d %sk\n", + ">> Memory: %d/%d k\n", bootprog_name, bootprog_rev, bootprog_kernrev, - getbasemem(), extmem, s); + getbasemem(), extmem); } void Index: src/sys/arch/i386/stand/dosboot/start_dos.S diff -u src/sys/arch/i386/stand/dosboot/start_dos.S:1.1 src/sys/arch/i386/stand/dosboot/start_dos.S:1.2 --- src/sys/arch/i386/stand/dosboot/start_dos.S:1.1 Sat Jun 29 13:45:14 2024 +++ src/sys/arch/i386/stand/dosboot/start_dos.S Wed Sep 11 20:15:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: start_dos.S,v 1.1 2024/06/29 13:45:14 rin Exp $ */ +/* $NetBSD: start_dos.S,v 1.2 2024/09/11 20:15:36 andvar Exp $ */ /* * startup for DOS .COM programs @@ -6,7 +6,6 @@ * netbsd:sys/arch/i386/boot/start.S * Tor Egge's patches for NetBSD boot (pr port-i386/1002) * freebsd:sys/i386/boot/netboot/start2.S - * XMS support by Martin Husemann */ /* @@ -484,137 +483,3 @@ _C_LABEL(trace_str): .code32 popl %esi ret - -#ifdef XMS - -/* pointer to XMS driver, 0 if no XMS used */ - - .data -_C_LABEL(xmsdrv): - .long 0 - - .text -ENTRY(checkxms) - .code32 - pushl %ebp - movl %esp, %ebp - pushl %ebx - pushl %edx - pushl %es - pushl %esi - pushl %edi - - call _C_LABEL(prot_to_real) # enter real mode - .code16 - - movw $0x4300, %ax - int $0x2f /* check if XMS installed */ - cmpb $0x80, %al - jnz noxms - - movw $0x4310, %ax - int $0x2f /* get driver address */ - - movw %bx, _C_LABEL(xmsdrv) /* save es:bx to _xmsdrv */ - movw %es, _C_LABEL(xmsdrv) + 2 - - movb $0x08, %ah /* XMS: query free extended memory */ -#if 0 - movb $0x00, %bl -#endif - lcall *_C_LABEL(xmsdrv) - jmp xdone - -noxms: /* no XMS manager found */ - mov $0, %dx - -xdone: - calll _C_LABEL(real_to_prot) # back to protected mode - .code32 - - xorl %eax, %eax - movw %dx, %ax - - popl %edi - popl %esi - popl %es - popl %edx - popl %ebx - popl %ebp - ret - -/* - Allocate a block of XMS memory with the requested size - void *xmsalloc(long int kBytes); - - Depends on _xmsdrv being set by getextmem() before first call - to this function. - - Return value: a physical address. -*/ -ENTRY(xmsalloc) - .code32 - pushl %ebp - movl %esp, %ebp - pushl %ebx - pushl %edx - pushl %esi - pushl %edi - - movl 0x8(%ebp), %edx # Kbytes needed - - call _C_LABEL(prot_to_real) # enter real mode - .code16 - - movb $0x09, %ah # XMS allocate block - lcall *_C_LABEL(xmsdrv) # result: handle in %dx - movb $0x0c, %ah # XMS lock block - lcall *_C_LABEL(xmsdrv) # result: 32 bit physical addr in DX:BX - - calll _C_LABEL(real_to_prot) # back to protected mode - .code32 - - movl %edx, %eax - shl $16, %eax - movw %bx, %ax # result in %eax - - popl %edi - popl %esi - popl %edx - popl %ebx - popl %ebp - ret - -/* - * ppbcopy(src, dst, cnt) - * where src and dst are physical addresses - */ -ENTRY(ppbcopy) - .code32 - pushl %ebp - movl %esp, %ebp - pushl %es - pushl %esi - pushl %edi - - cld - - # set %es to point at the flat segment - movl $flatdataseg, %eax - mov %ax, %es - - movl 8(%ebp), %esi # source - movl 12(%ebp), %edi # destination - movl 16(%ebp), %ecx # count - - es - rep - movsb - - popl %edi - popl %esi - popl %es - popl %ebp - ret - -#endif Index: src/sys/arch/i386/stand/dosboot/version diff -u src/sys/arch/i386/stand/dosboot/version:1.11 src/sys/arch/i386/stand/dosboot/version:1.12 --- src/sys/arch/i386/stand/dosboot/version:1.11 Tue Jul 15 23:17:38 2008 +++ src/sys/arch/i386/stand/dosboot/version Wed Sep 11 20:15:36 2024 @@ -1,4 +1,4 @@ -$NetBSD: version,v 1.11 2008/07/15 23:17:38 perry Exp $ +$NetBSD: version,v 1.12 2024/09/11 20:15:36 andvar Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important - make sure the entries are appended on end, last item @@ -17,3 +17,4 @@ is taken as the current. 1.9: move stack 64k up memory to allow for larger code and data use .code16 and .code32 directives 5.1: Change boot messages to replace build date with kernel version. +5.2: Remove XMS (eXtended Memory Specification) specific code. Index: src/sys/arch/i386/stand/lib/exec.c diff -u src/sys/arch/i386/stand/lib/exec.c:1.80 src/sys/arch/i386/stand/lib/exec.c:1.81 --- src/sys/arch/i386/stand/lib/exec.c:1.80 Sat Jan 6 21:26:43 2024 +++ src/sys/arch/i386/stand/lib/exec.c Wed Sep 11 20:15:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.c,v 1.80 2024/01/06 21:26:43 mlelstv Exp $ */ +/* $NetBSD: exec.c,v 1.81 2024/09/11 20:15:36 andvar Exp $ */ /* * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -89,7 +89,6 @@ /* * Starts a NetBSD ELF kernel. The low level startup is done in startprog.S. - * This is a special version of exec.c to support use of XMS. */ #include <sys/param.h> @@ -353,7 +352,6 @@ common_load_prekern(const char *file, u_ /* * Gather some information for the kernel. Do this after the * "point of no return" to avoid memory leaks. - * (but before DOS might be trashed in the XMS case) */ #ifdef PASS_BIOSGEOM bi_getbiosgeom(); @@ -376,43 +374,10 @@ common_load_kernel(const char *file, u_l physaddr_t loadaddr, int floppy, u_long marks[MARK_MAX]) { int fd; -#ifdef XMS - u_long xmsmem; - physaddr_t origaddr = loadaddr; -#endif *extmem = getextmem(); *basemem = getbasemem(); -#ifdef XMS - if ((getextmem1() == 0) && (xmsmem = checkxms())) { - u_long kernsize; - - /* - * With "CONSERVATIVE_MEMDETECT", extmem is 0 because - * getextmem() is getextmem1(). Without, the "smart" - * methods could fail to report all memory as well. - * xmsmem is a few kB less than the actual size, but - * better than nothing. - */ - if (xmsmem > *extmem) - *extmem = xmsmem; - /* - * Get the size of the kernel - */ - marks[MARK_START] = loadaddr; - if ((fd = loadfile(file, marks, COUNT_KERNEL)) == -1) - return errno; - close(fd); - - kernsize = marks[MARK_END]; - kernsize = (kernsize + 1023) / 1024; - - loadaddr = xmsalloc(kernsize); - if (!loadaddr) - return ENOMEM; - } -#endif marks[MARK_START] = loadaddr; if ((fd = loadfile(file, marks, LOAD_KERNEL & ~(floppy ? LOAD_BACKWARDS : 0))) == -1) @@ -427,7 +392,6 @@ common_load_kernel(const char *file, u_l /* * Gather some information for the kernel. Do this after the * "point of no return" to avoid memory leaks. - * (but before DOS might be trashed in the XMS case) */ #ifdef PASS_BIOSGEOM bi_getbiosgeom(); @@ -436,20 +400,6 @@ common_load_kernel(const char *file, u_l bi_getmemmap(); #endif -#ifdef XMS - if (loadaddr != origaddr) { - /* - * We now have done our last DOS IO, so we may - * trash the OS. Copy the data from the temporary - * buffer to its real address. - */ - marks[MARK_START] -= loadaddr; - marks[MARK_END] -= loadaddr; - marks[MARK_SYM] -= loadaddr; - marks[MARK_END] -= loadaddr; - ppbcopy(loadaddr, origaddr, marks[MARK_END]); - } -#endif marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) & (-sizeof(int)); image_end = marks[MARK_END];