From nobody@FreeBSD.ORG  Sun Jan  2 08:03:25 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 6382E14FC3; Sun,  2 Jan 2000 08:03:24 -0800 (PST)
Message-Id: <20000102160324.6382E14FC3@hub.freebsd.org>
Date: Sun,  2 Jan 2000 08:03:24 -0800 (PST)
From: sepotvin@videotron.ca
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: [patch] Assembler syntax fixes for the boot programs.
X-Send-Pr-Version: www-1.0

>Number:         15841
>Category:       i386
>Synopsis:       [patch] Assembler syntax fixes for the boot programs.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan  2 08:10:01 PST 2000
>Closed-Date:    Wed May 24 04:56:44 PDT 2000
>Last-Modified:  Wed May 24 04:58:49 PDT 2000
>Originator:     Stephane E. Potvin
>Release:        4.0-CURRENT
>Organization:
InnoMediaLogic Inc.
>Environment:
FreeBSD leonard.videotron.ca 4.0-CURRENT FreeBSD 4.0-CURRENT #6: Sat Jan  1 12:52:14 GMT 2000     spotvin@leonard.videotron.ca:/mnt/.0/src/sys/compile/LEONARD  i386
>Description:
Various assembler fixes for the boot programs. These were discovered
by binutils-2.9.5
>How-To-Repeat:

>Fix:
Index: boot0/boot0.s
===================================================================
RCS file: /usr/FreeBSD/ncvs/src/sys/boot/i386/boot0/boot0.s,v
retrieving revision 1.14
diff -c -r1.14 boot0.s
*** boot0/boot0.s       1999/09/03 01:38:29     1.14
--- boot0/boot0.s       1999/12/31 14:33:53
***************
*** 333,345 ****
                tstbi1(0x80,_FLAGS,_bp_)        # Use packet interface?
                jz intx13.1                     # No
                o16                             # Set
!               pushb $0x0                      #  the
                o16                             #  LBA
                pushw1(0x8,_si_)                #  address
                pushl %es                       # Set the transfer
                pushl %ebx                      #  buffer address
!               pushb $0x1                      # Block count
!               pushb $0x10                     # Packet size
                movl %esp,%esi                  # Packet pointer
                decl %eax                       # Verify off
                orb $0x40,%ah                   # Use disk packet
--- 333,345 ----
                tstbi1(0x80,_FLAGS,_bp_)        # Use packet interface?
                jz intx13.1                     # No
                o16                             # Set
!               push $0x0                       #  the
                o16                             #  LBA
                pushw1(0x8,_si_)                #  address
                pushl %es                       # Set the transfer
                pushl %ebx                      #  buffer address
!               push $0x1                       # Block count
!               push $0x10                      # Packet size
                movl %esp,%esi                  # Packet pointer
                decl %eax                       # Verify off
                orb $0x40,%ah                   # Use disk packet
Index: boot2/boot1.s
===================================================================
RCS file: /usr/FreeBSD/ncvs/src/sys/boot/i386/boot2/boot1.s,v
retrieving revision 1.10
diff -c -r1.10 boot1.s
*** boot2/boot1.s       1999/08/28 00:40:01     1.10
--- boot2/boot1.s       2000/01/02 10:37:14
***************
*** 42,48 ****
  xread:                pushl %ss                       # Address
                popl %ds                        #  data
  xread.1:      o16                             # Starting
!               pushb $0x0                      #  absolute
                pushl %ecx                      #  block
                pushl %eax                      #  number
                pushl %es                       # Address of
--- 42,48 ----
  xread:                pushl %ss                       # Address
                popl %ds                        #  data
  xread.1:      o16                             # Starting
!               push $0x0                       #  absolute
                pushl %ecx                      #  block
                pushl %eax                      #  number
                pushl %es                       # Address of
***************
*** 50,56 ****
                xorl %eax,%eax                  # Number of
                movb %dh,%al                    #  blocks to
                pushl %eax                      #  transfer
!               pushb $0x10                     # Size of packet
                movl %esp,%ebp                  # Packet pointer
                callwi(read)                    # Read from disk
                leaw1r(0x10,_bp_,_sp)           # Clear stack
--- 50,56 ----
                xorl %eax,%eax                  # Number of
                movb %dh,%al                    #  blocks to
                pushl %eax                      #  transfer
!               push $0x10                      # Size of packet
                movl %esp,%ebp                  # Packet pointer
                callwi(read)                    # Read from disk
                leaw1r(0x10,_bp_,_sp)           # Clear stack
***************
*** 60,68 ****

  main:         cld                             # String ops inc
                xorl %ecx,%ecx                  # Zero
!               movl %cx,%es                    # Address
!               movl %cx,%ds                    #  data
!               movl %cx,%ss                    # Set up
                movwir(start,_sp)               #  stack
                movl %esp,%esi                  # Source
                movwir(MEM_REL,_di)             # Destination
--- 60,68 ----

  main:         cld                             # String ops inc
                xorl %ecx,%ecx                  # Zero
!               movl %ecx,%es                   # Address
!               movl %ecx,%ds                   #  data
!               movl %ecx,%ss                   # Set up
                movwir(start,_sp)               #  stack
                movl %esp,%esi                  # Source
                movwir(MEM_REL,_di)             # Destination
Index: btx/btx/btx.s
===================================================================
RCS file: /usr/FreeBSD/ncvs/src/sys/boot/i386/btx/btx/btx.s,v
retrieving revision 1.13
diff -c -r1.13 btx.s
*** btx/btx/btx.s       1999/10/27 02:22:52     1.13
--- btx/btx/btx.s       2000/01/02 10:39:10
***************
*** 110,119 ****
  #
  init:         cli                             # Disable interrupts
                xorl %eax,%eax                  # Zero/segment
!               movl %ax,%ss                    # Set up
                movwir(MEM_ESP0,_sp)            #  stack
!               movl %ax,%es                    # Address
!               movl %ax,%ds                    #  data
                pushw $0x2                      # Clear
                popfw                           #  flags
  #
--- 110,119 ----
  #
  init:         cli                             # Disable interrupts
                xorl %eax,%eax                  # Zero/segment
!               movl %eax,%ss                   # Set up
                movwir(MEM_ESP0,_sp)            #  stack
!               movl %eax,%es                   # Address
!               movl %eax,%ds                   #  data
                pushw $0x2                      # Clear
                popfw                           #  flags
  #
***************
*** 213,224 ****
                jmpfwi(SEL_SCODE,init.8)        # To 32-bit code
  init.8:       xorl %ecx,%ecx                  # Zero
                movb $SEL_SDATA,%cl             # To 32-bit
!               movl %cx,%ss                    #  stack
  #
  # Launch user task.
  #
                movb $SEL_TSS,%cl               # Set task
!               ltrl %ecx                       #  register
                movl $MEM_USR,%edx              # User base address
                movzwl %ss:BDA_MEM,%eax         # Get free memory
                shll $0xa,%eax                  # To bytes
--- 213,224 ----
                jmpfwi(SEL_SCODE,init.8)        # To 32-bit code
  init.8:       xorl %ecx,%ecx                  # Zero
                movb $SEL_SDATA,%cl             # To 32-bit
!               movl %ecx,%ss                   #  stack
  #
  # Launch user task.
  #
                movb $SEL_TSS,%cl               # Set task
!               ltr  %cx                        #  register
                movl $MEM_USR,%edx              # User base address
                movzwl %ss:BDA_MEM,%eax         # Get free memory
                shll $0xa,%eax                  # To bytes
***************
*** 236,242 ****
                pushl %ecx                      # Set ES
                pushl %edx                      # Set EAX
                movb $0x7,%cl                   # Set remaining
! init.9:               pushb $0x0                      #  general
                loop init.9                     #  registers
                popa                            #  and initialize
                popl %es                        # Initialize
--- 236,242 ----
                pushl %ecx                      # Set ES
                pushl %edx                      # Set EAX
                movb $0x7,%cl                   # Set remaining
! init.9:               push $0x0                       #  general
                loop init.9                     #  registers
                popa                            #  and initialize
                popl %es                        # Initialize
***************
*** 267,277 ****
                o16                             # Reload
                jmpfwi(SEL_RCODE,exit.1)        #  CS
  exit.1:       movb $SEL_RDATA,%cl             # 16-bit selector
!               movl %cx,%ss                    # Reload SS
!               movl %cx,%ds                    # Load
!               movl %cx,%es                    #  remaining
!               movl %cx,%fs                    #  segment
!               movl %cx,%gs                    #  registers
  #
  # To real-address mode.
  #
--- 267,277 ----
                o16                             # Reload
                jmpfwi(SEL_RCODE,exit.1)        #  CS
  exit.1:       movb $SEL_RDATA,%cl             # 16-bit selector
!               movl %ecx,%ss                   # Reload SS
!               movl %ecx,%ds                   # Load
!               movl %ecx,%es                   #  remaining
!               movl %ecx,%fs                   #  segment
!               movl %ecx,%gs                   #  registers
  #
  # To real-address mode.
  #
***************
*** 279,286 ****
                movl %eax,%cr0                  #  real mode
                jmpfwi(0x0,exit.2)              # Reload CS
  exit.2:       xorl %eax,%eax                  # Real mode segment
!               movl %ax,%ss                    # Reload SS
!               movl %ax,%ds                    # Address data
                movwir(0x7008,_bx)              # Set real mode
                callwi(setpic)                  #  IRQ offsets
                lidtwm(ivtdesc)                 # Set IVT
--- 279,286 ----
                movl %eax,%cr0                  #  real mode
                jmpfwi(0x0,exit.2)              # Reload CS
  exit.2:       xorl %eax,%eax                  # Real mode segment
!               movl %eax,%ss                   # Reload SS
!               movl %eax,%ds                   # Address data
                movwir(0x7008,_bx)              # Set real mode
                callwi(setpic)                  #  IRQ offsets
                lidtwm(ivtdesc)                 # Set IVT
***************
*** 324,356 ****
  #
  # Exception jump table.
  #
! intx00:       pushb $0x0                      # Int 0x0: #DE
                jmp ex_noc                      # Divide error
!               pushb $0x1                      # Int 0x1: #DB
                jmp ex_noc                      # Debug
!               pushb $0x3                      # Int 0x3: #BP
                jmp ex_noc                      # Breakpoint
!               pushb $0x4                      # Int 0x4: #OF
                jmp ex_noc                      # Overflow
!               pushb $0x5                      # Int 0x5: #BR
                jmp ex_noc                      # BOUND range exceeded
!               pushb $0x6                      # Int 0x6: #UD
                jmp ex_noc                      # Invalid opcode
!               pushb $0x7                      # Int 0x7: #NM
                jmp ex_noc                      # Device not available
!               pushb $0x8                      # Int 0x8: #DF
                jmp except                      # Double fault
!               pushb $0xa                      # Int 0xa: #TS
                jmp except                      # Invalid TSS
!               pushb $0xb                      # Int 0xb: #NP
                jmp except                      # Segment not present
!               pushb $0xc                      # Int 0xc: #SS
                jmp except                      # Stack segment fault
!               pushb $0xd                      # Int 0xd: #GP
                jmp ex_v86                      # General protection
!               pushb $0xe                      # Int 0xe: #PF
                jmp except                      # Page fault
! intx10:       pushb $0x10                     # Int 0x10: #MF
                jmp ex_noc                      # Floating-point error
  #
  # Handle #GP exception.
--- 324,356 ----
  #
  # Exception jump table.
  #
! intx00:       push $0x0                       # Int 0x0: #DE
                jmp ex_noc                      # Divide error
!               push $0x1                       # Int 0x1: #DB
                jmp ex_noc                      # Debug
!               push $0x3                       # Int 0x3: #BP
                jmp ex_noc                      # Breakpoint
!               push $0x4                       # Int 0x4: #OF
                jmp ex_noc                      # Overflow
!               push $0x5                       # Int 0x5: #BR
                jmp ex_noc                      # BOUND range exceeded
!               push $0x6                       # Int 0x6: #UD
                jmp ex_noc                      # Invalid opcode
!               push $0x7                       # Int 0x7: #NM
                jmp ex_noc                      # Device not available
!               push $0x8                       # Int 0x8: #DF
                jmp except                      # Double fault
!               push $0xa                       # Int 0xa: #TS
                jmp except                      # Invalid TSS
!               push $0xb                       # Int 0xb: #NP
                jmp except                      # Segment not present
!               push $0xc                       # Int 0xc: #SS
                jmp except                      # Stack segment fault
!               push $0xd                       # Int 0xd: #GP
                jmp ex_v86                      # General protection
!               push $0xe                       # Int 0xe: #PF
                jmp except                      # Page fault
! intx10:       push $0x10                      # Int 0x10: #MF
                jmp ex_noc                      # Floating-point error
  #
  # Handle #GP exception.
***************
*** 631,667 ****
  #
  # Hardware interrupt jump table.
  #
! intx20:       pushb $0x8                      # Int 0x20: IRQ0
                jmp int_hw                      # V86 int 0x8
!               pushb $0x9                      # Int 0x21: IRQ1
                jmp int_hw                      # V86 int 0x9
!               pushb $0xa                      # Int 0x22: IRQ2
                jmp int_hw                      # V86 int 0xa
!               pushb $0xb                      # Int 0x23: IRQ3
                jmp int_hw                      # V86 int 0xb
!               pushb $0xc                      # Int 0x24: IRQ4
                jmp int_hw                      # V86 int 0xc
!               pushb $0xd                      # Int 0x25: IRQ5
                jmp int_hw                      # V86 int 0xd
!               pushb $0xe                      # Int 0x26: IRQ6
                jmp int_hw                      # V86 int 0xe
!               pushb $0xf                      # Int 0x27: IRQ7
                jmp int_hw                      # V86 int 0xf
!               pushb $0x70                     # Int 0x28: IRQ8
                jmp int_hw                      # V86 int 0x70
!               pushb $0x71                     # Int 0x29: IRQ9
                jmp int_hw                      # V86 int 0x71
!               pushb $0x72                     # Int 0x2a: IRQ10
                jmp int_hw                      # V86 int 0x72
!               pushb $0x73                     # Int 0x2b: IRQ11
                jmp int_hw                      # V86 int 0x73
!               pushb $0x74                     # Int 0x2c: IRQ12
                jmp int_hw                      # V86 int 0x74
!               pushb $0x75                     # Int 0x2d: IRQ13
                jmp int_hw                      # V86 int 0x75
!               pushb $0x76                     # Int 0x2e: IRQ14
                jmp int_hw                      # V86 int 0x76
!               pushb $0x77                     # Int 0x2f: IRQ15
                jmp int_hw                      # V86 int 0x77
  #
  # Reflect hardware interrupts.
--- 631,667 ----
  #
  # Hardware interrupt jump table.
  #
! intx20:       push $0x8                       # Int 0x20: IRQ0
                jmp int_hw                      # V86 int 0x8
!               push $0x9                       # Int 0x21: IRQ1
                jmp int_hw                      # V86 int 0x9
!               push $0xa                       # Int 0x22: IRQ2
                jmp int_hw                      # V86 int 0xa
!               push $0xb                       # Int 0x23: IRQ3
                jmp int_hw                      # V86 int 0xb
!               push $0xc                       # Int 0x24: IRQ4
                jmp int_hw                      # V86 int 0xc
!               push $0xd                       # Int 0x25: IRQ5
                jmp int_hw                      # V86 int 0xd
!               push $0xe                       # Int 0x26: IRQ6
                jmp int_hw                      # V86 int 0xe
!               push $0xf                       # Int 0x27: IRQ7
                jmp int_hw                      # V86 int 0xf
!               push $0x70                      # Int 0x28: IRQ8
                jmp int_hw                      # V86 int 0x70
!               push $0x71                      # Int 0x29: IRQ9
                jmp int_hw                      # V86 int 0x71
!               push $0x72                      # Int 0x2a: IRQ10
                jmp int_hw                      # V86 int 0x72
!               push $0x73                      # Int 0x2b: IRQ11
                jmp int_hw                      # V86 int 0x73
!               push $0x74                      # Int 0x2c: IRQ12
                jmp int_hw                      # V86 int 0x74
!               push $0x75                      # Int 0x2d: IRQ13
                jmp int_hw                      # V86 int 0x75
!               push $0x76                      # Int 0x2e: IRQ14
                jmp int_hw                      # V86 int 0x76
!               push $0x77                      # Int 0x2f: IRQ15
                jmp int_hw                      # V86 int 0x77
  #
  # Reflect hardware interrupts.
***************
*** 710,716 ****
                pushl %fs                       #  and
                pushl %ds                       #  point
                pushl %es                       #  to them
!               pushb $SEL_SDATA                # Set up
                popl %ds                        #  to
                pushl %ds                       #  address
                popl %es                        #  data
--- 710,716 ----
                pushl %fs                       #  and
                pushl %ds                       #  point
                pushl %es                       #  to them
!               push $SEL_SDATA                 # Set up
                popl %ds                        #  to
                pushl %ds                       #  address
                popl %es                        #  data
***************
*** 838,844 ****
                pushl %ds                       # Save
                testb $0x2,0x52(%ebx)           # V86 mode?
                jnz dump.3                      # Yes
!               verrl 0x4(%esi)                 # Readable selector?
                jnz dump.3                      # No
                ldsl (%esi),%esi                # Load pointer
                jmp dump.4                      # Join common code
--- 838,844 ----
                pushl %ds                       # Save
                testb $0x2,0x52(%ebx)           # V86 mode?
                jnz dump.3                      # Yes
!               verr 0x4(%esi)                  # Readable selector?
                jnz dump.3                      # No
                ldsl (%esi),%esi                # Load pointer
                jmp dump.4                      # Join common code


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jhb 
State-Changed-When: Wed May 24 04:56:44 PDT 2000 
State-Changed-Why:  
Wish I had seen this earlier.  Not all of these changes were applicable 
to binutils 2.9.1 as gas(1) was badly broken in that version.  However, 
with the import of the new 2.10 version of gas(1), patches containing 
these changes and many others have been applied.  Thanks. 
>Unformatted:
