Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Add an optional MD calling convention flag for use in li...



details:   https://anonhg.NetBSD.org/src/rev/106e061a8298
branches:  trunk
changeset: 766128:106e061a8298
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Jun 16 13:27:58 2011 +0000

description:
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.

diffstat:

 sys/arch/i386/include/cdefs.h            |    6 +-
 sys/arch/i386/stand/lib/bios_disk.S      |  121 ++++++++----------------------
 sys/arch/i386/stand/lib/biosgetrtc.S     |   26 ++----
 sys/arch/i386/stand/lib/biosgetsystime.S |   18 +---
 sys/arch/i386/stand/lib/biosmem.S        |   36 ++------
 sys/arch/i386/stand/lib/biosmemps2.S     |   24 +----
 sys/arch/i386/stand/lib/biosreboot.S     |   16 +---
 sys/arch/i386/stand/lib/conio.S          |   79 ++++---------------
 sys/arch/i386/stand/lib/dosfile.c        |   14 +-
 sys/arch/i386/stand/lib/getextmemx.c     |    6 +-
 sys/arch/i386/stand/lib/libi386.h        |   20 ++--
 sys/arch/i386/stand/libsa/nfs.c          |   14 +-
 sys/lib/libsa/alloc.c                    |    6 +-
 sys/lib/libsa/cd9660.c                   |   14 +-
 sys/lib/libsa/dosfs.c                    |   14 +-
 sys/lib/libsa/ext2fs.c                   |   14 +-
 sys/lib/libsa/nfs.c                      |   14 +-
 sys/lib/libsa/nullfs.c                   |   14 +-
 sys/lib/libsa/tftp.c                     |   14 +-
 sys/lib/libsa/ufs.c                      |   14 +-
 sys/lib/libsa/ustarfs.c                  |   14 +-
 21 files changed, 169 insertions(+), 329 deletions(-)

diffs (truncated from 1359 to 300 lines):

diff -r 9b96158c6035 -r 106e061a8298 sys/arch/i386/include/cdefs.h
--- a/sys/arch/i386/include/cdefs.h     Thu Jun 16 13:16:20 2011 +0000
+++ b/sys/arch/i386/include/cdefs.h     Thu Jun 16 13:27:58 2011 +0000
@@ -1,8 +1,10 @@
-/*     $NetBSD: cdefs.h,v 1.7 2008/10/26 06:57:30 mrg Exp $    */
+/*     $NetBSD: cdefs.h,v 1.8 2011/06/16 13:27:59 joerg Exp $  */
 
 #ifndef        _I386_CDEFS_H_
 #define        _I386_CDEFS_H_
 
-/* No arch-specific cdefs. */
+#if defined(_STANDALONE)
+#define        __compactcall   __attribute__((__regparm__(3)))
+#endif
 
 #endif /* !_I386_CDEFS_H_ */
diff -r 9b96158c6035 -r 106e061a8298 sys/arch/i386/stand/lib/bios_disk.S
--- a/sys/arch/i386/stand/lib/bios_disk.S       Thu Jun 16 13:16:20 2011 +0000
+++ b/sys/arch/i386/stand/lib/bios_disk.S       Thu Jun 16 13:27:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bios_disk.S,v 1.20 2010/12/29 22:40:46 jakllsch Exp $  */
+/*     $NetBSD: bios_disk.S,v 1.21 2011/06/16 13:27:59 joerg Exp $     */
 
 /*
  * Ported to boot 386BSD by Julian Elischer (julian%tfs.com@localhost) Sept 1992
@@ -63,13 +63,9 @@
  *                     %al = 0x0 on success; err code on failure
  */
 ENTRY(biosdisk_reset)
-       pushl   %ebp
-       movl    %esp, %ebp
-       pushl   %ebx
-       push    %edx
-       push    %edi
+       pusha
 
-       movb    8(%ebp), %dl    # device
+       movb    %al, %dl        # device
 
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
@@ -83,11 +79,9 @@
        .code32
 
        movzwl  %bx, %eax       # return value in %eax
+       movl    %eax, 28(%esp)
 
-       pop     %edi
-       pop     %edx
-       popl    %ebx
-       popl    %ebp
+       popa
        ret
 
 /*
@@ -108,24 +102,18 @@
  *        sending another command.
  */
 ENTRY(biosdisk_read)
-       pushl   %ebp
-       movl    %esp, %ebp
-       pushl   %ebx
-       push    %ecx
-       push    %edx
-       push    %esi
-       push    %edi
+       pusha
 
-       movb    16(%ebp), %dh
-       movw    12(%ebp), %cx
+       movb    44(%esp), %dh
+       movw    40(%esp), %cx
        xchgb   %ch, %cl        # cylinder; the highest 2 bits of cyl is in %cl
        rorb    $2, %cl
-       movb    20(%ebp), %al
+       movb    48(%esp), %al
        orb     %al, %cl
        incb    %cl             # sector; sec starts from 1, not 0
-       movb    8(%ebp), %dl    # device
-       movl    28(%ebp), %ebx  # buffer address (may be >64k)
-       movb    24(%ebp), %al   # number of sectors
+       movb    36(%esp), %dl   # device
+       movl    56(%esp), %ebx  # buffer address (may be >64k)
+       movb    52(%esp), %al   # number of sectors
 
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
@@ -145,14 +133,9 @@
        calll   _C_LABEL(real_to_prot) # back to protected mode
        .code32
 
-       movzwl  %ax, %eax       # return value in %eax
+       movl    %eax, 28(%esp)
 
-       pop     %edi
-       pop     %esi
-       pop     %edx
-       pop     %ecx
-       popl    %ebx
-       popl    %ebp
+       popa
        ret
 
 /*
@@ -160,16 +143,10 @@
  *     max number of sectors, heads and cylinders for this device
  */
 ENTRY(biosdisk_getinfo)
-       pushl   %ebp
-       movl    %esp, %ebp
        push    %es
-       pushl   %ebx
-       push    %ecx
-       push    %edx
-       push    %esi
-       push    %edi
+       pusha
 
-       movb    8(%ebp), %dl            # diskinfo(drive #)
+       movb    %al, %dl                # diskinfo(drive #)
 
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
@@ -209,14 +186,10 @@
        shrl    $8, %ecx
        movb    %dh, %cl                # max head
        orl     %ecx, %eax              # return value in %eax
+       movl    %eax, 28(%esp)
 
-       pop     %edi
-       pop     %esi
-       pop     %edx
-       pop     %ecx
-       popl    %ebx
+       popa
        pop     %es
-       popl    %ebp
        ret
 
 /*
@@ -224,15 +197,9 @@
  *     check for availibility of int13 extensions.
  */
 ENTRY(biosdisk_int13ext)
-       pushl   %ebp
-       movl    %esp, %ebp
-       pushl   %ebx
-       pushl   %ecx
-       pushl   %edx
-       pushl   %esi
-       pushl   %edi
+       pusha
 
-       movb    8(%ebp), %dl            # drive #
+       movb    %al, %dl                # drive #
        movw    $0x55aa, %bx
 
        call    _C_LABEL(prot_to_real)  # enter real mode
@@ -252,13 +219,9 @@
        andb    %dl, %al
 
        andb    %cl, %al
+       movl    %eax, 28(%esp)
 
-       popl    %edi
-       popl    %esi
-       popl    %edx
-       popl    %ecx
-       popl    %ebx
-       popl    %ebp
+       popa
        ret
 
 /*
@@ -271,16 +234,10 @@
  *                     %al = 0x0 on success; err code on failure
  */
 ENTRY(biosdisk_extread)
-       pushl   %ebp
-       movl    %esp, %ebp
-       pushl   %ebx
-       push    %ecx
-       push    %edx
-       push    %esi
-       push    %edi
+       pusha
 
-       movb    8(%ebp), %dl    # device
-       movl    12(%ebp), %esi  # parameter block
+       movl    %edx, %esi      # parameter block
+       movb    %al, %dl        # device
 
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
@@ -303,26 +260,16 @@
        .code32
 
        movzwl  %bx, %eax       # return value in %eax
+       movl    %eax, 28(%esp)
 
-       pop     %edi
-       pop     %esi
-       pop     %edx
-       pop     %ecx
-       popl    %ebx
-       popl    %ebp
+       popa
        ret
 
 ENTRY(biosdisk_getextinfo)
-       pushl   %ebp
-       movl    %esp, %ebp
-       pushl   %ebx
-       push    %ecx
-       push    %edx
-       push    %esi
-       push    %edi
+       pusha
 
-       movb    8(%ebp), %dl    # device
-       movl    12(%ebp), %esi  # parameter block
+       movl    %edx, %esi      # parameter block
+       movb    %al, %dl        # device
 
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
@@ -344,11 +291,7 @@
        .code32
 
        movzbl  %bl, %eax       # return value in %eax
+       movl    %eax, 28(%esp)
 
-       pop     %edi
-       pop     %esi
-       pop     %edx
-       pop     %ecx
-       popl    %ebx
-       popl    %ebp
+       popa
        ret
diff -r 9b96158c6035 -r 106e061a8298 sys/arch/i386/stand/lib/biosgetrtc.S
--- a/sys/arch/i386/stand/lib/biosgetrtc.S      Thu Jun 16 13:16:20 2011 +0000
+++ b/sys/arch/i386/stand/lib/biosgetrtc.S      Thu Jun 16 13:27:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: biosgetrtc.S,v 1.6 2005/12/11 12:17:48 christos Exp $  */
+/*     $NetBSD: biosgetrtc.S,v 1.7 2011/06/16 13:27:59 joerg Exp $     */
 
 /*
  * Copyright (c) 1996
@@ -29,13 +29,8 @@
 #include <machine/asm.h>
 
 ENTRY(biosgetrtc)
-       pushl   %ebp
-       movl    %esp, %ebp
-       pushl   %ebx
-       pushl   %ecx
-       pushl   %edx
-       push    %esi
-       push    %edi
+       pusha
+       pushl   %eax
 
        xorl    %ebx, %ebx
 
@@ -51,18 +46,13 @@
        calll   _C_LABEL(real_to_prot) # back to protected mode
        .code32
 
-       movl    8(%ebp), %eax
-       movl    $0, (%eax)
+       popl    %eax
        movb    %ch, (%eax)
        movb    %cl, 1(%eax)
        movb    %dh, 2(%eax)
-
-       movl    %ebx, %eax
+       movb    $0,  3(%eax)
 
-       pop     %edi
-       pop     %esi
-       popl    %edx
-       popl    %ecx
-       popl    %ebx
-       popl    %ebp
+       movl    %ebx, 28(%esp)
+
+       popa
        ret
diff -r 9b96158c6035 -r 106e061a8298 sys/arch/i386/stand/lib/biosgetsystime.S
--- a/sys/arch/i386/stand/lib/biosgetsystime.S  Thu Jun 16 13:16:20 2011 +0000
+++ b/sys/arch/i386/stand/lib/biosgetsystime.S  Thu Jun 16 13:27:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: biosgetsystime.S,v 1.2 2008/04/28 20:23:25 martin Exp $        */
+/*     $NetBSD: biosgetsystime.S,v 1.3 2011/06/16 13:27:59 joerg Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -34,13 +34,7 @@
 /* Return system time (~18.2Hz ticks since midnight) */



Home | Main Index | Thread Index | Old Index