From owner-freebsd-current Mon Apr 24 09:15:11 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id JAA08849 for current-outgoing; Mon, 24 Apr 1995 09:15:11 -0700 Received: from devnull.mpd.tandem.com (devnull.mpd.tandem.com [131.124.4.29]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id JAA08843 for ; Mon, 24 Apr 1995 09:15:08 -0700 Received: from muzak by devnull.mpd.tandem.com (8.6.8/8.6.6) id LAA17950; Mon, 24 Apr 1995 11:14:53 -0500 Received: by muzak (4.1/TSS2.1) id AA09465; Mon, 24 Apr 95 11:15:05 CDT From: chain@mpd.tandem.com (Chain Lee) Message-Id: <9504241615.AA09465@muzak> Subject: Re: 950412-SNAP To: current@FreeBSD.org Date: Mon, 24 Apr 1995 11:15:04 -0500 (CDT) Cc: chain%muzak.mpd.tandem.com@mpd.tandem.com (Chain Lee) In-Reply-To: <9504201906.AA08080@muzak> from "Chain Lee" at Apr 20, 95 02:06:34 pm X-Mailer: ELM [version 2.4 PL17] Content-Type: text Content-Length: 10094 Sender: current-owner@FreeBSD.org Precedence: bulk I said, > 2) My 'diskless' station has only a DOS partition and no FreeBSD > partition in a wd0 (ST506). It panics during diskless boot. I traced > down the panic to wdopen which was getting an integer division fault. > The trace is as follows: > configure() > swapconf() > wdsize() > wdopen() > ---idiv fault > Is this a known problem? I got around the problem by bypassing wdopen() > but wasn't able to trace further down because no symbols were loaded > into the kernel, and ddb trace shows no names. I modified netboot to > load symbol table over the net but it seems to have no effect. What > other things do I need to do to get the symbol table loaded into ddb? I've made a few small modifications to netboot to do the following: 1) Get wd0 disk geometry from bios and load bootinfo that includes disk geometry, so wd* driver can make use of it when fails to read from disk, rather than panic. 2) Load symbol tabel across the net so ddb works on diskless configuarion. 3) Build a mini netboot kernel that can be loaded by bios-boot, and then starts a 'diskless' boot. I am really hoping these features (mostly from biosboot) be included in the standard netboot so I don't have to change it later myself. I attached patched at the end. Also wd0 may need to be fixed so wdattach will fail if disk geometry cannot be obtained, rather than succeeds and later panics in wdopen when invalid geometry is used in calculation. Regards, -chain *** 1.1 1995/04/19 00:48:12 --- main.c 1995/04/23 15:04:03 *************** *** 33,39 **** **************************************************************************/ main() { ! int c; char *p; extern char edata[], end[]; for (p=edata; p 0) { + read_size = head.a_syms > NFS_READ_SIZE ? + NFS_READ_SIZE : head.a_syms; + if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, + &kernel_handle, offset, read_size, loadpoint)) != + read_size) { + if (err < 0) { + printf("Unable to read symble table: "); + nfs_err(err); + } + longjmp(jmp_bootmenu, 1); + } + loadpoint += err; + head.a_syms -= err; + offset += err; + } + + /********************************************************/ + /* Load the string table size */ + /********************************************************/ + if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, &kernel_handle, + offset, sizeof(int), &i)) < 0) { + printf("Unable to read %s: ",kernel); + nfs_err(err); + longjmp(jmp_bootmenu,1); + } + offset += err; + *((int *)loadpoint) = i; + i -= sizeof(int); + loadpoint += sizeof(int); + + /********************************************************/ + /* Load the string table */ + /********************************************************/ + printf("+0x%x+0x%x] ", sizeof(int), i); + while (i > 0) { + read_size = i > NFS_READ_SIZE ? + NFS_READ_SIZE : i; + if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, + &kernel_handle, offset, read_size, loadpoint)) != + read_size) { + if (err < 0) { + printf("Unable to read string table: "); + nfs_err(err); + } + longjmp(jmp_bootmenu, 1); + } + loadpoint += err; + i -= err; + offset += err; + } + + bootinfo.bi_esymtab = (unsigned long)loadpoint; + printf("entry=0x%X.\n\r",head.a_entry); /* Jump to kernel */ bootinfo.bi_version = BOOTINFO_VERSION; bootinfo.bi_kernelname = kernel; bootinfo.bi_nfs_diskless = &nfsdiskless; + bootinfo.bi_size = sizeof(bootinfo); kernelentry = (void *)(head.a_entry & 0x00FFFFFF); ! (*kernelentry)(RB_BOOTINFO,NODEV,0,0,0,&bootinfo,0,0,0); printf("*** %s execute failure ***\n",kernel); } *** 1.1 1995/04/19 01:22:02 --- start2.S 1995/04/24 11:02:25 *************** *** 54,59 **** --- 54,64 ---- START - Where all the fun begins.... **************************************************************************/ .globl _start + #ifdef BOOTNET + _start: + lgdt gdtarg + call _prot_to_real + #else _start: cli cld *************** *** 74,79 **** --- 79,85 ---- movsb opsize ljmp $(RELOC>>4),$1f-RELOC /* Jmp to RELOC:1f */ + #endif 1: nop mov %cs,%ax *************** *** 330,332 **** --- 336,407 ---- gdtarg: .word 0x1f /* limit */ .long gdt /* addr */ + + /* + * + * get_diskinfo(): return a word that represents the + * max number of sectors and heads and drives for this device + * + */ + + .globl _get_diskinfo + _get_diskinfo: + push %ebp + mov %esp, %ebp + push %es + push %ebx + push %ecx + push %edx + + movb 0x8(%ebp), %dl /* diskinfo(drive #) */ + call _prot_to_real /* enter real mode */ + + movb $0x8, %ah /* ask for disk info */ + + sti + int $0x13 + cli + + jnc ok + /* + * Urk. Call failed. It is not supported for floppies by old BIOS's. + * Guess it's a 15-sector floppy. + */ + subb %ah, %ah /* %ax = 0 */ + movb %al, %al + movb %ah, %bh /* %bh = 0 */ + movb $2, %bl /* %bl bits 0-3 = drive type, + bit 2 = 1.2M */ + movb $79, %ch /* max track */ + movb $15, %cl /* max sector */ + movb $1, %dh /* max head */ + movb $1, %dl /* # floppy drives installed */ + /* es:di = parameter table */ + /* carry = 0 */ + ok: + opsize + call _real_to_prot /* back to protected mode */ + + /* + * form a longword representing all this gunk: + * 6 bit zero + * 10 bit cylinder + * 8 bit head + * 8 bit sector + */ + movb %cl, %al /* Upper two bits of cylinder count */ + andl $192,%eax + leal 0(,%eax,4),%eax /* << 2 */ + movb %ch, %al /* Lower 8 bits */ + sall $16,%eax /* << 16 */ + movb %dh, %ah /* max head */ + andb $0x3f, %cl /* mask of cylinder gunk */ + movb %cl, %al /* max sector (and # sectors) */ + + pop %edx + pop %ecx + pop %ebx + pop %es + pop %ebp + ret + *** 1.1 1995/04/21 23:33:26 --- Makefile 1995/04/23 15:12:43 *************** *** 19,31 **** # changing an option. # ! PROG= nb8390.com nb3c509.com nb8390.rom nb3c509.rom # Order is very important on the SRCS line for this prog SRCS= start2.S main.c misc.c bootmenu.c rpc.c BINDIR= /usr/mdec BINMODE= 555 ! CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} -DASK_BOOT #NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000 NS8390+= -DINCLUDE_NE -DNE_BASE=0x340 #NS8390+= -DINCLUDE_3COM -D_3COM_BASE=0x300 --- 19,32 ---- # changing an option. # ! PROG= nb8390.com nb3c509.com nb8390.rom nb3c509.rom \ ! nb8390.kernel nb3c509.kernel # Order is very important on the SRCS line for this prog SRCS= start2.S main.c misc.c bootmenu.c rpc.c BINDIR= /usr/mdec BINMODE= 555 ! CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} # -DASK_BOOT #NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000 NS8390+= -DINCLUDE_NE -DNE_BASE=0x340 #NS8390+= -DINCLUDE_3COM -D_3COM_BASE=0x300 *************** *** 39,49 **** ROMSIZE=16384 RELOCADDR=0x90000 ! .SUFFIXES: .ro .S.ro: ${CC} ${CFLAGS} -DBOOTROM -o ${.TARGET} -c ${.IMPSRC} ns8390.o: ns8390.c ${CC} $(CFLAGS) $(NS8390) -o ${.TARGET} -c $< --- 40,53 ---- ROMSIZE=16384 RELOCADDR=0x90000 ! .SUFFIXES: .ro .no .S.ro: ${CC} ${CFLAGS} -DBOOTROM -o ${.TARGET} -c ${.IMPSRC} + .S.no: + ${CC} ${CFLAGS} -DBOOTNET -o ${.TARGET} -c ${.IMPSRC} + ns8390.o: ns8390.c ${CC} $(CFLAGS) $(NS8390) -o ${.TARGET} -c $< *************** *** 74,78 **** --- 78,87 ---- size netboot.com dd ibs=32 skip=1 if=netboot.com of=${.TARGET} + nb8390.kernel: start2.no ${SRCS:N*.h:R:S/$/.o/g} ns8390.o + $(LD) -Bstatic -Z -T ${RELOCADDR} -o $@ -X ${OBJS:S/start2.o/start2.no/} ns8390.o + + nb3c509.kernel: start2.no ${SRCS:N*.h:R:S/$/.o/g} 3c509.o + $(LD) -Bstatic -Z -T ${RELOCADDR} -o $@ -X ${OBJS:S/start2.o/start2.no/} 3c509.o .include -- Chain Lee Tandem Computers, Inc. Voice: (512) 432-8969 14231 Tandem Boulevard Email: chain@isd.tandem.com Austin, TX 78728-6699 Office: 2359