mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-21 15:45:02 +00:00
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 <fjwcash gmail com>
This commit is contained in:
parent
aa977fc70e
commit
57ac2e1286
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=220337
@ -31,6 +31,7 @@ CFLAGS= -Os \
|
|||||||
-fno-unit-at-a-time \
|
-fno-unit-at-a-time \
|
||||||
-mno-align-long-strings \
|
-mno-align-long-strings \
|
||||||
-mrtd \
|
-mrtd \
|
||||||
|
-mregparm=3 \
|
||||||
-D${BOOT2_UFS} \
|
-D${BOOT2_UFS} \
|
||||||
-DFLAGS=${BOOT_BOOT1_FLAGS} \
|
-DFLAGS=${BOOT_BOOT1_FLAGS} \
|
||||||
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void sio_init(int);
|
void sio_init(int) __attribute__((regparm (3)));
|
||||||
void sio_flush(void);
|
void sio_flush(void);
|
||||||
void sio_putc(int);
|
void sio_putc(int) __attribute__((regparm (3)));
|
||||||
int sio_getc(void);
|
int sio_getc(void);
|
||||||
int sio_ischar(void);
|
int sio_ischar(void);
|
||||||
|
@ -26,14 +26,14 @@
|
|||||||
|
|
||||||
/* void sio_init(int div) */
|
/* 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
|
movb $SIO_FMT|0x80,%al # Set format
|
||||||
outb %al,(%dx) # and DLAB
|
outb %al,(%dx) # and DLAB
|
||||||
pushl %edx # Save
|
|
||||||
subb $0x3,%dl # Divisor latch reg
|
subb $0x3,%dl # Divisor latch reg
|
||||||
movl 0x8(%esp),%eax # Set
|
popl %eax
|
||||||
outw %ax,(%dx) # BPS
|
outw %ax,(%dx) # BPS
|
||||||
popl %edx # Restore
|
movw $SIO_PRT+0x3,%dx # Data format reg
|
||||||
movb $SIO_FMT,%al # Clear
|
movb $SIO_FMT,%al # Clear
|
||||||
outb %al,(%dx) # DLAB
|
outb %al,(%dx) # DLAB
|
||||||
incl %edx # Modem control reg
|
incl %edx # Modem control reg
|
||||||
@ -41,7 +41,7 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
|
|||||||
outb %al,(%dx) # DTR
|
outb %al,(%dx) # DTR
|
||||||
incl %edx # Line status reg
|
incl %edx # Line status reg
|
||||||
call sio_flush
|
call sio_flush
|
||||||
ret $0x4
|
ret
|
||||||
|
|
||||||
/* void sio_flush(void) */
|
/* void sio_flush(void) */
|
||||||
|
|
||||||
@ -52,17 +52,18 @@ sio_flush: call sio_ischar # Check for character
|
|||||||
|
|
||||||
/* void sio_putc(int c) */
|
/* 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
|
xor %ecx,%ecx # Timeout
|
||||||
movb $0x40,%ch # counter
|
movb $0x40,%ch # counter
|
||||||
sio_putc.1: inb (%dx),%al # Transmitter
|
sio_putc.1: inb (%dx),%al # Transmitter
|
||||||
testb $0x20,%al # buffer empty?
|
testb $0x20,%al # buffer empty?
|
||||||
loopz sio_putc.1 # No
|
loopz sio_putc.1 # No
|
||||||
jz sio_putc.2 # If timeout
|
jz sio_putc.2 # If timeout
|
||||||
movb 0x4(%esp,1),%al # Get character
|
popl %eax # Get the character
|
||||||
subb $0x5,%dl # Transmitter hold reg
|
subb $0x5,%dl # Transmitter hold reg
|
||||||
outb %al,(%dx) # Write character
|
outb %al,(%dx) # Write character
|
||||||
sio_putc.2: ret $0x4 # To caller
|
sio_putc.2: ret # To caller
|
||||||
|
|
||||||
/* int sio_getc(void) */
|
/* int sio_getc(void) */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user