Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jan 1997 23:01:05 +0100 (MET)
From:      "Alex Fenyo (eowyn)" <fenyo@inf.enst.fr>
To:        freebsd-hackers@freebsd.org
Subject:   bug in code for booting over the net
Message-ID:  <199701092201.XAA16757@nikopol.enst.fr>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701092201.XAA16757>