Subject: Re: .code16 changes for .S files
To: None <port-i386@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 12/20/2002 21:22:37
> The attached patches apply the (relatively) mechanical change
> to most of the relevant files.
A bug crept into the woodwork...
> Index: lib/biosmca.S
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/arch/i386/stand/lib/biosmca.S,v
> retrieving revision 1.2
> diff -u -r1.2 biosmca.S
> --- lib/biosmca.S 2001/05/14 22:14:47 1.2
> +++ lib/biosmca.S 2002/12/12 15:41:41
> @@ -55,9 +55,6 @@
>
> #include <machine/asm.h>
>
> -#define addr32 .byte 0x67
> -#define data32 .byte 0x66
> -
> .data
> .globl _C_LABEL(biosmca_ps2model)
> _C_LABEL(biosmca_ps2model): .long 0
> @@ -72,6 +69,7 @@
> # instead of ISA).
> */
> ENTRY(biosmca)
> + .code32
> pushl %ebp
> movl %esp, %ebp
> pushl %ebx
> @@ -82,33 +80,29 @@
> push %eax
>
> call _C_LABEL(prot_to_real) # enter real mode
> + .code16
>
> # zero %cx
> - data32
> - xorl %cx, %cx
> + xor %cx, %cx
>
> - data32
> - xorl %ax, %ax
> - movb $0xc0, %ah # subfunction
> + xor %ax, %ax
> + movb $0xc0, %ah # subfunction
> int $0x15
> jc back
>
> # check feature byte 1 if MCA bus present and replaces ISA
> - addr32
> - movb %es:5(%ebx), %ax
> - andw $0x02, %ax # bit 1 set means MCA instead of ISA
> - cmpw $0x02, %ax # see also arch/i386/mca/mca_machdep.c
> + movw %es:5(%bx), %ax
> + andw $0x02, %ax # bit 1 set means MCA instead of ISA
> + cmpw $0x02, %ax # see also arch/i386/mca/mca_machdep.c
> jne back
>
> # save model and submodel bytes to %cx
> - addr32
> - movb %es:2(%ebx), %ch # model (1 byte)
> - addr32
> - movb %es:3(%ebx), %cl # submodel (1 byte)
> + movb %es:2(%bx), %ch # model (1 byte)
> + movb %es:3(%bx), %cl # submodel (1 byte)
>
> back:
> - data32
> - call _C_LABEL(real_to_prot) # back to protected mode
> + calll _C_LABEL(real_to_prot) # back to protected mode
> + .code16
should be .code32
> # save model
> movl %ecx, _C_LABEL(biosmca_ps2model)
David
--
David Laight: david@l8s.co.uk