From owner-svn-src-all@FreeBSD.ORG Mon Apr 4 18:23:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63497106566B; Mon, 4 Apr 2011 18:23:56 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 497A18FC14; Mon, 4 Apr 2011 18:23:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p34INuFF091843; Mon, 4 Apr 2011 18:23:56 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p34INubM091839; Mon, 4 Apr 2011 18:23:56 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <201104041823.p34INubM091839@svn.freebsd.org> From: Roman Divacky Date: Mon, 4 Apr 2011 18:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220337 - head/sys/boot/i386/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2011 18:23:56 -0000 Author: rdivacky Date: Mon Apr 4 18:23:55 2011 New Revision: 220337 URL: http://svn.freebsd.org/changeset/base/220337 Log: Build boot2 with -mregparm=3, ie. pass upto 3 arguments via registers. This modifies CFLAGS and tweaks sio.S to use the new calling convention. The sio_init() and sio_putc() prototypes are modified so that other users of this code know the correct calling convention. This makes the code smaller when compiled with clang. Reviewed by: jhb Tested by: me and Freddie Cash Modified: head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/boot2/lib.h head/sys/boot/i386/boot2/sio.S Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Mon Apr 4 17:44:26 2011 (r220336) +++ head/sys/boot/i386/boot2/Makefile Mon Apr 4 18:23:55 2011 (r220337) @@ -31,6 +31,7 @@ CFLAGS= -Os \ -fno-unit-at-a-time \ -mno-align-long-strings \ -mrtd \ + -mregparm=3 \ -D${BOOT2_UFS} \ -DFLAGS=${BOOT_BOOT1_FLAGS} \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ Modified: head/sys/boot/i386/boot2/lib.h ============================================================================== --- head/sys/boot/i386/boot2/lib.h Mon Apr 4 17:44:26 2011 (r220336) +++ head/sys/boot/i386/boot2/lib.h Mon Apr 4 18:23:55 2011 (r220337) @@ -17,8 +17,8 @@ * $FreeBSD$ */ -void sio_init(int); +void sio_init(int) __attribute__((regparm (3))); void sio_flush(void); -void sio_putc(int); +void sio_putc(int) __attribute__((regparm (3))); int sio_getc(void); int sio_ischar(void); Modified: head/sys/boot/i386/boot2/sio.S ============================================================================== --- head/sys/boot/i386/boot2/sio.S Mon Apr 4 17:44:26 2011 (r220336) +++ head/sys/boot/i386/boot2/sio.S Mon Apr 4 18:23:55 2011 (r220337) @@ -26,14 +26,14 @@ /* void sio_init(int div) */ -sio_init: movw $SIO_PRT+0x3,%dx # Data format reg +sio_init: pushl %eax + movw $SIO_PRT+0x3,%dx # Data format reg movb $SIO_FMT|0x80,%al # Set format outb %al,(%dx) # and DLAB - pushl %edx # Save subb $0x3,%dl # Divisor latch reg - movl 0x8(%esp),%eax # Set + popl %eax outw %ax,(%dx) # BPS - popl %edx # Restore + movw $SIO_PRT+0x3,%dx # Data format reg movb $SIO_FMT,%al # Clear outb %al,(%dx) # DLAB incl %edx # Modem control reg @@ -41,7 +41,7 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data outb %al,(%dx) # DTR incl %edx # Line status reg call sio_flush - ret $0x4 + ret /* void sio_flush(void) */ @@ -52,17 +52,18 @@ sio_flush: call sio_ischar # Check for /* void sio_putc(int c) */ -sio_putc: movw $SIO_PRT+0x5,%dx # Line status reg +sio_putc: pushl %eax + movw $SIO_PRT+0x5,%dx # Line status reg xor %ecx,%ecx # Timeout movb $0x40,%ch # counter sio_putc.1: inb (%dx),%al # Transmitter testb $0x20,%al # buffer empty? loopz sio_putc.1 # No jz sio_putc.2 # If timeout - movb 0x4(%esp,1),%al # Get character + popl %eax # Get the character subb $0x5,%dl # Transmitter hold reg outb %al,(%dx) # Write character -sio_putc.2: ret $0x4 # To caller +sio_putc.2: ret # To caller /* int sio_getc(void) */