From owner-freebsd-hackers Thu Jan 9 14:01:36 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id OAA24111 for hackers-outgoing; Thu, 9 Jan 1997 14:01:36 -0800 (PST) Received: from inf.enst.fr (snZ9Ci7pu3VTFv5sywgcppVFdNBMmVlG@inf.enst.fr [137.194.2.81]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id OAA24105 for ; Thu, 9 Jan 1997 14:01:30 -0800 (PST) Received: from nikopol.enst.fr (nikopol.enst.fr [137.194.168.105]) by inf.enst.fr (8.8.4/8.8.4) with ESMTP id XAA16752; Thu, 9 Jan 1997 23:01:09 +0100 (MET) Received: (from fenyo@localhost) by nikopol.enst.fr (8.8.3/8.8.2) id XAA16757; Thu, 9 Jan 1997 23:01:05 +0100 (MET) Date: Thu, 9 Jan 1997 23:01:05 +0100 (MET) Message-Id: <199701092201.XAA16757@nikopol.enst.fr> From: "Alex Fenyo (eowyn)" To: freebsd-hackers@freebsd.org Subject: bug in code for booting over the net X-WWW: http://home.eowyn.fr.eu.org/~fenyo/documents/axel.html X-PGP-Key: finger alex@eowyn.fr.eu.org X-NIC-Handle: AF713 X-Whois: whois -h whois.internic.net fenyo X-Pager: 06-04-30-75-94 (for emergency only) Organization: Ecole Nationale Superieure des Telecommunications de Paris Reply-to: fenyo@inf.enst.fr Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hello, I was unable to boot over ethernet because of code in /src/sys/i386/boot/netboot/start2.S In this file, _get_diskinfo is a function used to get informations about drives. To do this, it makes call to BIOS INT 13h. The parameter (drive number) is put in %dl : ------------------------------------------------------------ movb 0x8(%ebp), %dl /* diskinfo(drive #) */ call _prot_to_real /* enter real mode */ movb $0x8, %ah /* ask for disk info */ sti int $0x13 cli ------------------------------------------------------------ But the call to INT 13h never returns, on my PC. I think it's because the function _prot_to_real modifies %dl. Indeed, when I invert the two first lines, the PC boots over the net; the following code works fine : ------------------------------------------------------------ call _prot_to_real /* enter real mode */ movb 0x8(%ebp), %dl /* diskinfo(drive #) */ movb $0x8, %ah /* ask for disk info */ sti int $0x13 cli ------------------------------------------------------------ BUT looking at _prot_to_real, I can't find any reason why %dl would be modified : ------------------------------------------------------------ /************************************************************************** PROT_TO_REAL - Go from Protected Mode to REAL Mode **************************************************************************/ .globl _prot_to_real _prot_to_real: pop %eax sub $RELOC,%eax /* Adjust return address */ push %eax sub $RELOC,%esp /* Adjust stack pointer */ ljmp $REAL_MODE_SEG, $1f /* jump to a 16 bit segment */ 1: /* clear the PE bit of CR0 */ mov %cr0, %eax opsize andl $0!CR0_PE, %eax mov %eax, %cr0 /* make intersegment jmp to flush the processor pipeline * and reload CS register */ opsize ljmp $(RELOC)>>4, $2f-RELOC 2: /* we are in real mode now * set up the real mode segment registers : DS, SS, ES */ mov %cs, %ax mov %ax, %ds mov %ax, %es mov %ax, %ss sti opsize ret ------------------------------------------------------------ Could anybody explain to me this strange behavior ? Alexandre Fenyo