Port-amd64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Bootxx diet patch for testing
Hi all,
I'm looking for review and testing of the attached patch. It frees
enough space to allow building bootxx with clang.
Joerg
Index: common/lib/libc/arch/i386/string/memcmp.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/memcmp.S,v
retrieving revision 1.2
diff -u -p -r1.2 memcmp.S
--- common/lib/libc/arch/i386/string/memcmp.S 12 Nov 2007 18:41:59 -0000
1.2
+++ common/lib/libc/arch/i386/string/memcmp.S 9 Jun 2011 19:36:04 -0000
@@ -9,6 +9,7 @@
RCSID("$NetBSD: memcmp.S,v 1.2 2007/11/12 18:41:59 ad Exp $")
#endif
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
ENTRY(memcmp)
pushl %edi
pushl %esi
@@ -45,3 +46,50 @@ L6: xorl %eax,%eax /* Perform unsigned
popl %esi
popl %edi
ret
+#else /* !!LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+ENTRY(memcmp)
+ pushl %esi
+ pushl %edi
+ movl 12(%esp), %edi
+ movl 16(%esp), %esi
+ movl 20(%esp), %ecx
+ xorl %eax, %eax
+ rep
+ cmpsb
+ popl %edi
+ popl %esi
+ ja 1f
+ setnz %al
+ ret
+1:
+ decl %eax
+ ret
+#endif /* !!LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
Index: common/lib/libc/arch/i386/string/memcpy.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/memcpy.S,v
retrieving revision 1.3
diff -u -p -r1.3 memcpy.S
--- common/lib/libc/arch/i386/string/memcpy.S 12 Nov 2007 18:41:59 -0000
1.3
+++ common/lib/libc/arch/i386/string/memcpy.S 9 Jun 2011 19:36:04 -0000
@@ -6,6 +6,7 @@
*
* This code is derived from locore.s.
* Optimised by David Laight 2003
+ * Space optimised version by Joerg Sonnenberger
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +44,7 @@
* ws%tools.de@localhost (Wolfgang Solfrank, TooLs GmbH)
+49-228-985800
*/
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
#ifdef BCOPY
ENTRY(bcopy)
#else
@@ -131,3 +133,44 @@ ENTRY(memcpy)
movb %al,(%edi)
jmp .Lback_aligned
#endif
+
+#else
+# ifdef BCOPY
+ENTRY(bcopy)
+ pushl %esi
+ pushl %edi
+ movl 12(%esp), %esi
+ movl 16(%esp), %edi
+ jmp __memmove_start
+# endif
+# if defined(MEMMOVE)
+ENTRY(memcpy)
+ENTRY(memmove)
+ pushl %esi
+ pushl %edi
+ movl 12(%esp), %edi
+ movl 16(%esp), %esi
+ .globl __memmove_start
+__memmove_start:
+ movl 20(%esp), %ecx
+ pushl %edi
+ testl %ecx, %ecx
+ jz 2f
+ cmpl %esi, %edi
+ jb 1f
+ addl %ecx, %esi
+ decl %esi
+ addl %ecx, %edi
+ decl %edi
+ std
+1:
+ rep
+ movsb
+2:
+ cld
+ popl %eax
+ popl %edi
+ popl %esi
+ ret
+# endif /* MEMMOVE */
+#endif /* !!LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
Index: common/lib/libc/arch/i386/string/memset.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/memset.S,v
retrieving revision 1.4
diff -u -p -r1.4 memset.S
--- common/lib/libc/arch/i386/string/memset.S 29 Apr 2008 06:53:01 -0000
1.4
+++ common/lib/libc/arch/i386/string/memset.S 9 Jun 2011 19:36:04 -0000
@@ -1,11 +1,11 @@
/* $NetBSD: memset.S,v 1.4 2008/04/29 06:53:01 martin Exp $ */
/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 2003, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by David Laight.
+ * by David Laight and Joerg Sonnenberger.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,6 +35,8 @@
RCSID("$NetBSD: memset.S,v 1.4 2008/04/29 06:53:01 martin Exp $")
#endif
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
+
#ifdef BZERO
ENTRY(bzero)
#else
@@ -104,3 +106,17 @@ ENTRY(memset)
#endif
popl %edi
ret
+
+#else /* !LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
+ENTRY(memset)
+ pushl %edi
+ movl 8(%esp), %edi
+ movl 12(%esp), %eax
+ movl 16(%esp), %ecx
+ pushl %edi
+ rep
+ stosb
+ popl %eax
+ popl %edi
+ ret
+#endif /* !LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
Index: common/lib/libc/arch/i386/string/strchr.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/strchr.S,v
retrieving revision 1.2
diff -u -p -r1.2 strchr.S
--- common/lib/libc/arch/i386/string/strchr.S 17 Jul 2009 19:37:57 -0000
1.2
+++ common/lib/libc/arch/i386/string/strchr.S 9 Jun 2011 20:14:43 -0000
@@ -9,6 +9,8 @@
RCSID("$NetBSD: strchr.S,v 1.2 2009/07/17 19:37:57 dsl Exp $")
#endif
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
+
ENTRY(strchr)
pushl %esi
pushl %ebx
@@ -101,3 +103,52 @@ ENTRY(strchr)
ret
STRONG_ALIAS(index,strchr)
+
+#else /* !LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+ENTRY(strchr)
+ popl %edx /* Return address */
+ popl %eax /* String pointer */
+ popl %ecx /* Character to find */
+ pushl %ecx
+ pushl %eax
+ pushl %edx
+1:
+ cmpb $0, 0(%eax)
+ je 2f
+ cmpb %cl, 0(%eax)
+ je 3f
+ incl %eax
+ jmp 1b
+2:
+ xorl %eax, %eax
+3:
+ ret
+#endif /* !LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
Index: common/lib/libc/arch/i386/string/strcmp.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/strcmp.S,v
retrieving revision 1.1
diff -u -p -r1.1 strcmp.S
--- common/lib/libc/arch/i386/string/strcmp.S 20 Dec 2005 19:28:49 -0000
1.1
+++ common/lib/libc/arch/i386/string/strcmp.S 8 Jun 2011 23:53:49 -0000
@@ -9,6 +9,8 @@
RCSID("$NetBSD: strcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
#endif
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
+
ENTRY(strcmp)
pushl %esi
pushl %ebx
@@ -75,3 +77,53 @@ ENTRY(strcmp)
popl %ebx
popl %esi
ret
+
+#else /* !LIBKERN_OPTIMISE_SPACE */
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ENTRY(strcmp)
+ pushl %esi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %esi
+ decl %ecx
+1:
+ incl %ecx
+ lodsb
+ cmpb 0(%ecx), %al
+ jne 2f
+ testb %al, %al
+ jne 1b
+2:
+ subb 0(%ecx), %al
+ movsbl %al, %eax
+ popl %esi
+ ret
+
+#endif /* !LIBKERN_OPTIMISE_SPACE */
Index: common/lib/libc/arch/i386/string/strcpy.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/strcpy.S,v
retrieving revision 1.1
diff -u -p -r1.1 strcpy.S
--- common/lib/libc/arch/i386/string/strcpy.S 20 Dec 2005 19:28:49 -0000
1.1
+++ common/lib/libc/arch/i386/string/strcpy.S 8 Jun 2011 23:53:49 -0000
@@ -22,6 +22,8 @@
* requirements.
*/
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
+
ENTRY(strcpy)
pushl %ebx
movl 8(%esp),%ecx
@@ -84,3 +86,52 @@ ENTRY(strcpy)
movl 8(%esp),%eax
popl %ebx
ret
+
+#else /* !LIBKERN_OPTIMISE_SPACE */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ENTRY(strcpy)
+ pushl %esi
+ pushl %edi
+ movl 12(%esp), %edi
+ movl 16(%esp), %esi
+ pushl %edi
+1:
+ lodsb
+ stosb
+ testb %al, %al
+ jne 1b
+ popl %eax
+ popl %edi
+ popl %esi
+ ret
+
+#endif /* !LIBKERN_OPTIMISE_SPACE */
Index: common/lib/libc/arch/i386/string/strlen.S
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/common/lib/libc/arch/i386/string/strlen.S,v
retrieving revision 1.1
diff -u -p -r1.1 strlen.S
--- common/lib/libc/arch/i386/string/strlen.S 20 Dec 2005 19:28:49 -0000
1.1
+++ common/lib/libc/arch/i386/string/strlen.S 8 Jun 2011 23:53:49 -0000
@@ -9,6 +9,8 @@
RCSID("$NetBSD: strlen.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
#endif
+#if !defined(LIBKERN_OPTIMISE_SPACE) && !defined(_STANDALONE)
+
ENTRY(strlen)
movl 4(%esp),%eax
@@ -139,3 +141,46 @@ ENTRY(strlen)
.Ldone:
subl 4(%esp),%eax
ret
+
+#else /* !LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David Laight.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ENTRY(strlen)
+ movl 8(%esp), %ecx
+ xorl %eax, %eax
+ dec %eax
+1:
+ incl %eax
+ cmpb $0, 0(%ecx,%eax,1)
+ jnz 1b
+ ret
+
+#endif /* !LIBKERN_OPTIMISE_SPACE && !_STANDALONE */
Index: sys/arch/i386/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/include/asm.h,v
retrieving revision 1.39
diff -u -p -r1.39 asm.h
--- sys/arch/i386/include/asm.h 20 Dec 2010 21:11:24 -0000 1.39
+++ sys/arch/i386/include/asm.h 8 Jun 2011 23:53:49 -0000
@@ -85,7 +85,7 @@
/* let kernels and others override entrypoint alignment */
#if !defined(_ALIGN_TEXT) && !defined(_KERNEL)
# ifdef _STANDALONE
-# define _ALIGN_TEXT .align 4
+# define _ALIGN_TEXT .align 1
# elif defined __ELF__
# define _ALIGN_TEXT .align 16
# else
Index: sys/arch/i386/include/cdefs.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/include/cdefs.h,v
retrieving revision 1.7
diff -u -p -r1.7 cdefs.h
--- sys/arch/i386/include/cdefs.h 26 Oct 2008 06:57:30 -0000 1.7
+++ sys/arch/i386/include/cdefs.h 8 Jun 2011 23:53:49 -0000
@@ -3,6 +3,8 @@
#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_ */
Index: sys/arch/i386/stand/Makefile.booters
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/Makefile.booters,v
retrieving revision 1.83
diff -u -p -r1.83 Makefile.booters
--- sys/arch/i386/stand/Makefile.booters 9 Apr 2011 00:26:52 -0000
1.83
+++ sys/arch/i386/stand/Makefile.booters 8 Jun 2011 23:53:49 -0000
@@ -23,7 +23,7 @@ CPUFLAGS= -march=i386 -mtune=i386
.endif
.endif
.endif
-COPTS= -Os -ffreestanding
+COPTS= ${OPT_SIZE.${ACTIVE_CC}}
I386_STAND_DIR?= $S/arch/i386/stand
Index: sys/arch/i386/stand/Makefile.inc
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/Makefile.inc,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.inc
--- sys/arch/i386/stand/Makefile.inc 29 Aug 2008 00:02:23 -0000 1.6
+++ sys/arch/i386/stand/Makefile.inc 9 Jun 2011 09:41:55 -0000
@@ -3,3 +3,9 @@
.include <bsd.own.mk>
BINDIR= /usr/mdec
+
+OPT_SIZE.gcc= -Os -ffreestanding -fomit-frame-pointer
+OPT_SIZE.clang= -Oz -ffreestanding -fomit-frame-pointer \
+ -fno-stack-protector -mno-sse \
+ -mllvm -stack-alignment=4 -mllvm -realign-stack=false \
+ -mllvm -inline-threshold=3 -mllvm -enable-load-pre=false
Index: sys/arch/i386/stand/bootxx/Makefile.bootxx
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/sys/arch/i386/stand/bootxx/Makefile.bootxx,v
retrieving revision 1.40
diff -u -p -r1.40 Makefile.bootxx
--- sys/arch/i386/stand/bootxx/Makefile.bootxx 20 May 2011 22:29:55 -0000
1.40
+++ sys/arch/i386/stand/bootxx/Makefile.bootxx 9 Jun 2011 20:20:06 -0000
@@ -2,8 +2,6 @@
S= ${.CURDIR}/../../../../..
-UNSUPPORTED_COMPILER.clang= # defined
-
AFLAGS.bootxx.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
AFLAGS.label.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
AFLAGS.pbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
@@ -55,7 +53,8 @@ CPPFLAGS+= -DFS=${FS}
# CPPFLAGS+= -DBOOT_MSG_COM0
# Make sure we override any optimization options specified by the user
-COPTS= -Os -momit-leaf-frame-pointer
+.include "${.PARSEDIR}/../Makefile.inc"
+COPTS= ${OPT_SIZE.${ACTIVE_CC}}
DBG=
CPPFLAGS+= -DNO_LBA_CHECK
@@ -77,7 +76,6 @@ CPUFLAGS= -march=i386 -mtune=i386
.endif
.endif
-COPTS+= -ffreestanding
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
CPPFLAGS+= -nostdinc -D_STANDALONE
CPPFLAGS+= -I$S
Index: sys/arch/i386/stand/lib/bios_disk.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/bios_disk.S,v
retrieving revision 1.20
diff -u -p -r1.20 bios_disk.S
--- sys/arch/i386/stand/lib/bios_disk.S 29 Dec 2010 22:40:46 -0000 1.20
+++ sys/arch/i386/stand/lib/bios_disk.S 9 Jun 2011 16:35:21 -0000
@@ -63,13 +63,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
* %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 @@ ENTRY(biosdisk_reset)
.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 @@ ENTRY(biosdisk_reset)
* 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 @@ ENTRY(biosdisk_read)
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 @@ ENTRY(biosdisk_read)
* 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 @@ ok:
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 @@ ok:
* 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 @@ ENTRY(biosdisk_int13ext)
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 @@ ENTRY(biosdisk_int13ext)
* %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 @@ ENTRY(biosdisk_extread)
.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 @@ ENTRY(biosdisk_getextinfo)
.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
Index: sys/arch/i386/stand/lib/biosgetrtc.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/biosgetrtc.S,v
retrieving revision 1.6
diff -u -p -r1.6 biosgetrtc.S
--- sys/arch/i386/stand/lib/biosgetrtc.S 11 Dec 2005 12:17:48 -0000
1.6
+++ sys/arch/i386/stand/lib/biosgetrtc.S 9 Jun 2011 17:32:31 -0000
@@ -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 @@ ok:
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)
+ movb $0, 3(%eax)
- movl %ebx, %eax
+ movl %ebx, 28(%esp)
- pop %edi
- pop %esi
- popl %edx
- popl %ecx
- popl %ebx
- popl %ebp
+ popa
ret
Index: sys/arch/i386/stand/lib/biosgetsystime.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/biosgetsystime.S,v
retrieving revision 1.2
diff -u -p -r1.2 biosgetsystime.S
--- sys/arch/i386/stand/lib/biosgetsystime.S 28 Apr 2008 20:23:25 -0000
1.2
+++ sys/arch/i386/stand/lib/biosgetsystime.S 8 Jun 2011 23:53:49 -0000
@@ -34,13 +34,7 @@
/* Return system time (~18.2Hz ticks since midnight) */
ENTRY(biosgetsystime)
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- pushl %ecx
- pushl %edx
- push %esi
- push %edi
+ pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
@@ -54,11 +48,7 @@ ENTRY(biosgetsystime)
mov %ecx, %eax
shl $16, %eax
movw %dx, %ax
+ movl %eax, 28(%esp)
- pop %edi
- pop %esi
- popl %edx
- popl %ecx
- popl %ebx
- popl %ebp
+ popa
ret
Index: sys/arch/i386/stand/lib/biosmem.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/biosmem.S,v
retrieving revision 1.8
diff -u -p -r1.8 biosmem.S
--- sys/arch/i386/stand/lib/biosmem.S 11 Dec 2005 12:17:48 -0000 1.8
+++ sys/arch/i386/stand/lib/biosmem.S 9 Jun 2011 13:31:38 -0000
@@ -39,39 +39,26 @@
/* get mem below 1M, in kByte */
ENTRY(getbasemem)
- pushl %ebp
- movl %esp,%ebp
- pushl %ebx
- push %esi
- push %edi
+ pusha
call _C_LABEL(prot_to_real)
.code16
int $0x12
# zero-extend 16-bit result to 32 bits.
- movl $0, %ebx
- mov %ax,%bx
+ movzwl %ax, %eax
calll _C_LABEL(real_to_prot)
.code32
- movl %ebx, %eax
-
- pop %edi
- pop %esi
- popl %ebx
- popl %ebp
+ movl %eax, 28(%esp)
+ popa
ret
/* get mem above 1M, in kByte */
ENTRY(getextmem1)
- pushl %ebp
- movl %esp,%ebp
- pushl %ebx
- push %esi
- push %edi
+ pusha
call _C_LABEL(prot_to_real)
.code16
@@ -80,17 +67,12 @@ ENTRY(getextmem1)
int $0x15
# zero-extend 16-bit result to 32 bits.
- movl $0, %ebx
- mov %ax,%bx
+ movzwl %ax, %eax
calll _C_LABEL(real_to_prot)
.code32
- movl %ebx, %eax
-
- pop %edi
- pop %esi
- popl %ebx
- popl %ebp
+ movl %eax, 28(%esp)
+ popa
ret
Index: sys/arch/i386/stand/lib/biosmemps2.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/biosmemps2.S,v
retrieving revision 1.5
diff -u -p -r1.5 biosmemps2.S
--- sys/arch/i386/stand/lib/biosmemps2.S 20 Feb 2011 05:45:48 -0000
1.5
+++ sys/arch/i386/stand/lib/biosmemps2.S 9 Jun 2011 14:59:43 -0000
@@ -40,15 +40,9 @@
*/
ENTRY(getextmemps2)
.code32
- pushl %ebp
- movl %esp,%ebp
- pushl %ebx
- pushl %ecx
- pushl %edx
- push %esi
- push %edi
-
- movl 8(%ebp), %edx # parameter
+ movl %eax, %edx
+ xorl %eax, %eax
+ pusha
call _C_LABEL(prot_to_real)
.code16
@@ -88,12 +82,6 @@ out:
calll _C_LABEL(real_to_prot)
.code32
- movzbl %cl, %eax # return value in %eax
-
- pop %edi
- pop %esi
- popl %edx
- popl %ecx
- popl %ebx
- popl %ebp
+ movb %cl, 28(%esp)
+ popa
ret
Index: sys/arch/i386/stand/lib/biosreboot.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/biosreboot.S,v
retrieving revision 1.4
diff -u -p -r1.4 biosreboot.S
--- sys/arch/i386/stand/lib/biosreboot.S 11 Dec 2005 12:17:48 -0000
1.4
+++ sys/arch/i386/stand/lib/biosreboot.S 9 Jun 2011 13:47:50 -0000
@@ -40,11 +40,7 @@
/* Call INT 19 to do the equivalent of CTL-ALT-DEL */
ENTRY(reboot)
- pushl %ebp
- movl %esp,%ebp
- pushl %ebx
- push %esi
- push %edi
+ pusha
call _C_LABEL(prot_to_real)
.code16
@@ -56,10 +52,6 @@ ENTRY(reboot)
calll _C_LABEL(real_to_prot)
.code32
- movl %ebx, %eax
-
- pop %edi
- pop %esi
- popl %ebx
- popl %ebp
+ movl %ebx, 28(%esp)
+ popa
ret
Index: sys/arch/i386/stand/lib/conio.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/conio.S,v
retrieving revision 1.6
diff -u -p -r1.6 conio.S
--- sys/arch/i386/stand/lib/conio.S 21 May 2008 01:51:34 -0000 1.6
+++ sys/arch/i386/stand/lib/conio.S 9 Jun 2011 15:39:47 -0000
@@ -12,14 +12,7 @@
CLR - Clear screen
**************************************************************************/
ENTRY(conclr)
- push %ebp
- mov %esp,%ebp
- push %ecx
- push %ebx
- push %esi
- push %edi
-
- movb 8(%ebp),%cl
+ pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
@@ -40,53 +33,35 @@ ENTRY(conclr)
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
- pop %edi
- pop %esi
- pop %ebx
- pop %ecx
- pop %ebp
+ popa
ret
/**************************************************************************
PUTC - Print a character
**************************************************************************/
ENTRY(conputc)
- push %ebp
- mov %esp,%ebp
- push %ecx
- push %ebx
- push %esi
- push %edi
-
- movb 8(%ebp),%cl
+ pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
- movb %cl,%al
movw $1,%bx
movb $0x0e,%ah
+ movb %al, %cl
int $0x10
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
- pop %edi
- pop %esi
- pop %ebx
- pop %ecx
- pop %ebp
+ popa
ret
/**************************************************************************
GETC - Get a character
**************************************************************************/
ENTRY(congetc)
- push %ebp
- mov %esp,%ebp
- push %ebx
- push %esi
- push %edi
+ xorl %eax, %eax
+ pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
@@ -98,24 +73,17 @@ ENTRY(congetc)
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
- xor %eax,%eax
- movb %bl,%al
+ movb %bl, 28(%esp)
- pop %edi
- pop %esi
- pop %ebx
- pop %ebp
+ popa
ret
/**************************************************************************
ISSHIFT - Check for keyboard interrupt; via shift key
**************************************************************************/
ENTRY(conisshift)
- push %ebp
- mov %esp,%ebp
- push %ebx
- push %esi
- push %edi
+ xorl %eax, %eax
+ pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
@@ -129,24 +97,17 @@ ENTRY(conisshift)
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
- xor %eax,%eax
- movb %bl,%al
+ movb %bl, 28(%esp)
- pop %edi
- pop %esi
- pop %ebx
- pop %ebp
+ popa
ret
/**************************************************************************
ISKEY - Check for keyboard input
**************************************************************************/
ENTRY(coniskey)
- push %ebp
- mov %esp,%ebp
- push %ebx
- push %esi
- push %edi
+ xorl %eax, %eax
+ pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
@@ -159,11 +120,7 @@ ENTRY(coniskey)
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
- xor %eax,%eax
- movb %bl,%al
+ movb %bl, 28(%esp)
- pop %edi
- pop %esi
- pop %ebx
- pop %ebp
+ popa
ret
Index: sys/arch/i386/stand/lib/dosfile.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/dosfile.c,v
retrieving revision 1.14
diff -u -p -r1.14 dosfile.c
--- sys/arch/i386/stand/lib/dosfile.c 14 Dec 2008 17:03:43 -0000 1.14
+++ sys/arch/i386/stand/lib/dosfile.c 9 Jun 2011 09:46:49 -0000
@@ -72,7 +72,7 @@ dos2errno(void)
return err;
}
-int
+__compactcall int
dos_open(const char *path, struct open_file *f)
{
struct dosfile *df;
@@ -94,7 +94,7 @@ dos_open(const char *path, struct open_f
return 0;
}
-int
+__compactcall int
dos_read(struct open_file *f, void *addr, size_t size, size_t *resid)
{
struct dosfile *df;
@@ -156,7 +156,7 @@ dos_read(struct open_file *f, void *addr
return 0;
}
-int
+__compactcall int
dos_close(struct open_file *f)
{
struct dosfile *df;
@@ -169,13 +169,13 @@ dos_close(struct open_file *f)
return 0;
}
-int
+__compactcall int
dos_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
return EROFS;
}
-int
+__compactcall int
dos_stat(struct open_file *f, struct stat *sb)
{
struct dosfile *df;
@@ -189,7 +189,7 @@ dos_stat(struct open_file *f, struct sta
return 0;
}
-off_t
+__compactcall off_t
dos_seek(struct open_file *f, off_t offset, int where)
{
struct dosfile *df;
Index: sys/arch/i386/stand/lib/getextmemx.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/getextmemx.c,v
retrieving revision 1.9
diff -u -p -r1.9 getextmemx.c
--- sys/arch/i386/stand/lib/getextmemx.c 14 Dec 2008 17:03:43 -0000
1.9
+++ sys/arch/i386/stand/lib/getextmemx.c 9 Jun 2011 14:59:15 -0000
@@ -35,10 +35,6 @@
#include <lib/libsa/stand.h>
#include "libi386.h"
-extern int getextmem2(int *);
-extern int getmementry(int *, int *);
-extern int getextmemps2(void *);
-
int
getextmemx(void)
{
Index: sys/arch/i386/stand/lib/libi386.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/lib/libi386.h,v
retrieving revision 1.36
diff -u -p -r1.36 libi386.h
--- sys/arch/i386/stand/lib/libi386.h 26 May 2011 04:25:27 -0000 1.36
+++ sys/arch/i386/stand/lib/libi386.h 9 Jun 2011 15:53:37 -0000
@@ -98,30 +98,30 @@ void command_help(char *);
extern const struct bootblk_command commands[];
/* asm bios/dos calls */
-int biosdisk_extread(int, void *);
+__compactcall int biosdisk_extread(int, void *);
int biosdisk_read(int, int, int, int, int, void *);
-int biosdisk_reset(int);
+__compactcall int biosdisk_reset(int);
-int biosgetrtc(u_long *);
+__compactcall int biosgetrtc(u_long *);
int biosgetsystime(void);
int comgetc(int);
void cominit(int);
-int computc(int, int);
+__compactcall int computc(int, int);
int comstatus(int);
int congetc(void);
int conisshift(void);
int coniskey(void);
-void conputc(int);
+__compactcall void conputc(int);
void conclr(void);
int getextmem2(int *);
-int getextmemps2(void *);
+__compactcall int getextmemps2(void *);
int getmementry(int *, int *);
-int biosdisk_int13ext(int);
-int biosdisk_getinfo(int);
+__compactcall int biosdisk_int13ext(int);
+__compactcall int biosdisk_getinfo(int);
struct biosdisk_extinfo;
-int biosdisk_getextinfo(int, struct biosdisk_extinfo *);
+__compactcall int biosdisk_getextinfo(int, struct biosdisk_extinfo *);
int get_harddrives(void);
void biosdisk_probe(void);
Index: sys/arch/i386/stand/libsa/nfs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/stand/libsa/nfs.c,v
retrieving revision 1.17
diff -u -p -r1.17 nfs.c
--- sys/arch/i386/stand/libsa/nfs.c 14 Mar 2009 21:04:10 -0000 1.17
+++ sys/arch/i386/stand/libsa/nfs.c 9 Jun 2011 09:52:36 -0000
@@ -333,7 +333,7 @@ nfs_readdata(struct nfs_iodesc *d, off_t
* Open a file.
* return zero or error number
*/
-int
+__compactcall int
nfs_open(const char *path, struct open_file *f)
{
static struct nfs_iodesc nfs_root_node;
@@ -510,7 +510,7 @@ out:
return (error);
}
-int
+__compactcall int
nfs_close(struct open_file *f)
{
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
@@ -530,7 +530,7 @@ nfs_close(struct open_file *f)
/*
* read a portion of a file
*/
-int
+__compactcall int
nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
/* resid: out */
{
@@ -577,7 +577,7 @@ ret:
/*
* Not implemented.
*/
-int
+__compactcall int
nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
/* resid: out */
{
@@ -585,7 +585,7 @@ nfs_write(struct open_file *f, void *buf
return (EROFS);
}
-off_t
+__compactcall off_t
nfs_seek(struct open_file *f, off_t offset, int where)
{
struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
@@ -612,7 +612,7 @@ nfs_seek(struct open_file *f, off_t offs
const int nfs_stat_types[8] = {
0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, 0 };
-int
+__compactcall int
nfs_stat(struct open_file *f, struct stat *sb)
{
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
Index: sys/lib/libsa/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/Makefile,v
retrieving revision 1.72
diff -u -p -r1.72 Makefile
--- sys/lib/libsa/Makefile 11 May 2011 16:23:40 -0000 1.72
+++ sys/lib/libsa/Makefile 9 Jun 2011 19:06:04 -0000
@@ -33,7 +33,9 @@ SRCS+= exec.c
.endif
# string routines
+.if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "x86_64"
SRCS+= memcmp.c memcpy.c memmove.c memset.c strchr.c
+.endif
SRCS+= bcopy.c bzero.c # Remove me eventually.
# io routines
Index: sys/lib/libsa/alloc.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/alloc.c,v
retrieving revision 1.24
diff -u -p -r1.24 alloc.c
--- sys/lib/libsa/alloc.c 25 Dec 2010 01:08:44 -0000 1.24
+++ sys/lib/libsa/alloc.c 8 Jun 2011 23:53:49 -0000
@@ -162,7 +162,7 @@ extern char end[];
static char *top = (char *)HEAP_START;
#endif /* HEAP_VARIABLE */
-void *
+__compactcall void *
alloc(size_t size)
{
struct fl **f = &freelist, **bestf = NULL;
@@ -239,7 +239,7 @@ found:
return help + ALIGN(sizeof(unsigned int));
}
-void
+__compactcall void
/*ARGSUSED*/
dealloc(void *ptr, size_t size)
{
Index: sys/lib/libsa/cd9660.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/cd9660.c,v
retrieving revision 1.26
diff -u -p -r1.26 cd9660.c
--- sys/lib/libsa/cd9660.c 18 Oct 2010 11:08:26 -0000 1.26
+++ sys/lib/libsa/cd9660.c 8 Jun 2011 23:53:49 -0000
@@ -129,7 +129,7 @@ dirmatch(const char *path, struct iso_di
return 1;
}
-int
+__compactcall int
cd9660_open(const char *path, struct open_file *f)
{
struct file *fp = 0;
@@ -291,7 +291,7 @@ out:
}
#if !defined(LIBSA_NO_FS_CLOSE)
-int
+__compactcall int
cd9660_close(struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -303,7 +303,7 @@ cd9660_close(struct open_file *f)
}
#endif /* !defined(LIBSA_NO_FS_CLOSE) */
-int
+__compactcall int
cd9660_read(struct open_file *f, void *start, size_t size, size_t *resid)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -354,7 +354,7 @@ cd9660_read(struct open_file *f, void *s
}
#if !defined(LIBSA_NO_FS_WRITE)
-int
+__compactcall int
cd9660_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
@@ -363,7 +363,7 @@ cd9660_write(struct open_file *f, void *
#endif /* !defined(LIBSA_NO_FS_WRITE) */
#if !defined(LIBSA_NO_FS_SEEK)
-off_t
+__compactcall off_t
cd9660_seek(struct open_file *f, off_t offset, int where)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -385,7 +385,7 @@ cd9660_seek(struct open_file *f, off_t o
}
#endif /* !defined(LIBSA_NO_FS_SEEK) */
-int
+__compactcall int
cd9660_stat(struct open_file *f, struct stat *sb)
{
struct file *fp = (struct file *)f->f_fsdata;
Index: sys/lib/libsa/dosfs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/dosfs.c,v
retrieving revision 1.16
diff -u -p -r1.16 dosfs.c
--- sys/lib/libsa/dosfs.c 24 Nov 2008 11:27:20 -0000 1.16
+++ sys/lib/libsa/dosfs.c 8 Jun 2011 23:53:49 -0000
@@ -218,7 +218,7 @@ dosunmount(DOS_FS *fs)
/*
* Open DOS file
*/
-int
+__compactcall int
dosfs_open(const char *path, struct open_file *fd)
{
const struct direntry *de;
@@ -270,7 +270,7 @@ out:
/*
* Read from file
*/
-int
+__compactcall int
dosfs_read(struct open_file *fd, void *vbuf, size_t nbyte, size_t *resid)
{
off_t size;
@@ -327,7 +327,7 @@ out:
/*
* Not implemented.
*/
-int
+__compactcall int
dosfs_write(struct open_file *fd, void *start, size_t size, size_t *resid)
{
@@ -339,7 +339,7 @@ dosfs_write(struct open_file *fd, void *
/*
* Reposition within file
*/
-off_t
+__compactcall off_t
dosfs_seek(struct open_file *fd, off_t offset, int whence)
{
off_t off;
@@ -373,7 +373,7 @@ dosfs_seek(struct open_file *fd, off_t o
/*
* Close open file
*/
-int
+__compactcall int
dosfs_close(struct open_file *fd)
{
DOS_FILE *f = (DOS_FILE *)fd->f_fsdata;
@@ -389,7 +389,7 @@ dosfs_close(struct open_file *fd)
/*
* Return some stat information on a file.
*/
-int
+__compactcall int
dosfs_stat(struct open_file *fd, struct stat *sb)
{
DOS_FILE *f = (DOS_FILE *)fd->f_fsdata;
Index: sys/lib/libsa/ext2fs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/ext2fs.c,v
retrieving revision 1.9
diff -u -p -r1.9 ext2fs.c
--- sys/lib/libsa/ext2fs.c 2 Jan 2011 21:37:01 -0000 1.9
+++ sys/lib/libsa/ext2fs.c 8 Jun 2011 23:53:49 -0000
@@ -485,7 +485,7 @@ read_gdblock(struct open_file *f, struct
/*
* Open a file.
*/
-int
+__compactcall int
ext2fs_open(const char *path, struct open_file *f)
{
#ifndef LIBSA_FS_SINGLECOMPONENT
@@ -695,7 +695,7 @@ out:
return rc;
}
-int
+__compactcall int
ext2fs_close(struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -718,7 +718,7 @@ ext2fs_close(struct open_file *f)
* Copy a portion of a file into kernel memory.
* Cross block boundaries when necessary.
*/
-int
+__compactcall int
ext2fs_read(struct open_file *f, void *start, size_t size, size_t *resid)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -756,7 +756,7 @@ ext2fs_read(struct open_file *f, void *s
* Not implemented.
*/
#ifndef LIBSA_NO_FS_WRITE
-int
+__compactcall int
ext2fs_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
@@ -765,7 +765,7 @@ ext2fs_write(struct open_file *f, void *
#endif /* !LIBSA_NO_FS_WRITE */
#ifndef LIBSA_NO_FS_SEEK
-off_t
+__compactcall off_t
ext2fs_seek(struct open_file *f, off_t offset, int where)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -788,7 +788,7 @@ ext2fs_seek(struct open_file *f, off_t o
}
#endif /* !LIBSA_NO_FS_SEEK */
-int
+__compactcall int
ext2fs_stat(struct open_file *f, struct stat *sb)
{
struct file *fp = (struct file *)f->f_fsdata;
Index: sys/lib/libsa/nfs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/nfs.c,v
retrieving revision 1.45
diff -u -p -r1.45 nfs.c
--- sys/lib/libsa/nfs.c 17 Jan 2009 14:00:36 -0000 1.45
+++ sys/lib/libsa/nfs.c 8 Jun 2011 23:53:49 -0000
@@ -382,7 +382,7 @@ nfs_mount(int sock, struct in_addr ip, c
* Open a file.
* return zero or error number
*/
-int
+__compactcall int
nfs_open(const char *path, struct open_file *f)
{
struct nfs_iodesc *newfd, *currfd;
@@ -537,7 +537,7 @@ out:
return error;
}
-int
+__compactcall int
nfs_close(struct open_file *f)
{
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
@@ -557,7 +557,7 @@ nfs_close(struct open_file *f)
/*
* read a portion of a file
*/
-int
+__compactcall int
nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
{
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
@@ -604,13 +604,13 @@ ret:
/*
* Not implemented.
*/
-int
+__compactcall int
nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
{
return EROFS;
}
-off_t
+__compactcall off_t
nfs_seek(struct open_file *f, off_t offset, int where)
{
struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
@@ -637,7 +637,7 @@ nfs_seek(struct open_file *f, off_t offs
const int nfs_stat_types[8] = {
0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, 0 };
-int
+__compactcall int
nfs_stat(struct open_file *f, struct stat *sb)
{
struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
Index: sys/lib/libsa/nullfs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/nullfs.c,v
retrieving revision 1.9
diff -u -p -r1.9 nullfs.c
--- sys/lib/libsa/nullfs.c 11 Dec 2005 12:24:46 -0000 1.9
+++ sys/lib/libsa/nullfs.c 8 Jun 2011 23:53:49 -0000
@@ -66,7 +66,7 @@
* Null filesystem
*/
-int
+__compactcall int
null_open(const char *path, struct open_file *f)
{
@@ -74,7 +74,7 @@ null_open(const char *path, struct open_
}
#ifndef LIBSA_NO_FS_CLOSE
-int
+__compactcall int
null_close(struct open_file *f)
{
@@ -82,7 +82,7 @@ null_close(struct open_file *f)
}
#endif
-int
+__compactcall int
null_read(struct open_file *f, void *buf, size_t size, size_t *resid)
{
@@ -90,7 +90,7 @@ null_read(struct open_file *f, void *buf
}
#ifndef LIBSA_NO_FS_WRITE
-int
+__compactcall int
null_write(struct open_file *f, void *buf, size_t size, size_t *resid)
{
@@ -99,7 +99,7 @@ null_write(struct open_file *f, void *bu
#endif
#ifndef LIBSA_NO_FS_SEEK
-off_t
+__compactcall off_t
null_seek(struct open_file *f, off_t offset, int where)
{
@@ -107,7 +107,7 @@ null_seek(struct open_file *f, off_t off
}
#endif
-int
+__compactcall int
null_stat(struct open_file *f, struct stat *sb)
{
Index: sys/lib/libsa/stand.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/stand.h,v
retrieving revision 1.71
diff -u -p -r1.71 stand.h
--- sys/lib/libsa/stand.h 25 Feb 2011 00:17:36 -0000 1.71
+++ sys/lib/libsa/stand.h 8 Jun 2011 23:53:49 -0000
@@ -87,14 +87,14 @@
struct open_file;
#define FS_DEF(fs) \
- extern int __CONCAT(fs,_open)(const char *, struct open_file *); \
- extern int __CONCAT(fs,_close)(struct open_file *); \
- extern int __CONCAT(fs,_read)(struct open_file *, void *, \
+ extern __compactcall int __CONCAT(fs,_open)(const char *, struct
open_file *); \
+ extern __compactcall int __CONCAT(fs,_close)(struct open_file
*); \
+ extern __compactcall int __CONCAT(fs,_read)(struct open_file *,
void *, \
size_t, size_t *); \
- extern int __CONCAT(fs,_write)(struct open_file *, void *, \
+ extern __compactcall int __CONCAT(fs,_write)(struct open_file *,
void *, \
size_t, size_t *); \
- extern off_t __CONCAT(fs,_seek)(struct open_file *, off_t, int); \
- extern int __CONCAT(fs,_stat)(struct open_file *, struct stat *)
+ extern __compactcall off_t __CONCAT(fs,_seek)(struct open_file *,
off_t, int); \
+ extern __compactcall int __CONCAT(fs,_stat)(struct open_file *,
struct stat *)
/*
* This structure is used to define file system operations in a file system
@@ -105,12 +105,12 @@ extern char *fsmod2;
#if !defined(LIBSA_SINGLE_FILESYSTEM)
struct fs_ops {
- int (*open)(const char *, struct open_file *);
- int (*close)(struct open_file *);
- int (*read)(struct open_file *, void *, size_t, size_t *);
- int (*write)(struct open_file *, void *, size_t size, size_t *);
- off_t (*seek)(struct open_file *, off_t, int);
- int (*stat)(struct open_file *, struct stat *);
+ __compactcall int (*open)(const char *, struct open_file *);
+ __compactcall int (*close)(struct open_file *);
+ __compactcall int (*read)(struct open_file *, void *, size_t,
size_t *);
+ __compactcall int (*write)(struct open_file *, void *, size_t
size, size_t *);
+ __compactcall off_t (*seek)(struct open_file *, off_t, int);
+ __compactcall int (*stat)(struct open_file *, struct stat *);
};
extern struct fs_ops file_system[];
@@ -215,8 +215,8 @@ int (devopen)(struct open_file *, const
#ifdef HEAP_VARIABLE
void setheap(void *, void *);
#endif
-void *alloc(size_t);
-void dealloc(void *, size_t);
+void *alloc(size_t) __compactcall;
+void dealloc(void *, size_t) __compactcall;
struct disklabel;
char *getdisklabel(const char *, struct disklabel *);
int dkcksum(const struct disklabel *);
Index: sys/lib/libsa/tftp.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/tftp.c,v
retrieving revision 1.31
diff -u -p -r1.31 tftp.c
--- sys/lib/libsa/tftp.c 11 May 2011 16:23:40 -0000 1.31
+++ sys/lib/libsa/tftp.c 8 Jun 2011 23:53:49 -0000
@@ -248,7 +248,7 @@ tftp_terminate(struct tftp_handle *h)
}
#endif
-int
+__compactcall int
tftp_open(const char *path, struct open_file *f)
{
struct tftp_handle *tftpfile;
@@ -275,7 +275,7 @@ tftp_open(const char *path, struct open_
return 0;
}
-int
+__compactcall int
tftp_read(struct open_file *f, void *addr, size_t size, size_t *resid)
{
struct tftp_handle *tftpfile;
@@ -356,7 +356,7 @@ tftp_read(struct open_file *f, void *add
return 0;
}
-int
+__compactcall int
tftp_close(struct open_file *f)
{
struct tftp_handle *tftpfile;
@@ -372,7 +372,7 @@ tftp_close(struct open_file *f)
return 0;
}
-int
+__compactcall int
tftp_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
@@ -415,7 +415,7 @@ tftp_size_of_file(struct tftp_handle *tf
return filesize;
}
-int
+__compactcall int
tftp_stat(struct open_file *f, struct stat *sb)
{
struct tftp_handle *tftpfile;
@@ -429,7 +429,7 @@ tftp_stat(struct open_file *f, struct st
return 0;
}
-off_t
+__compactcall off_t
tftp_seek(struct open_file *f, off_t offset, int where)
{
struct tftp_handle *tftpfile;
Index: sys/lib/libsa/ufs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/ufs.c,v
retrieving revision 1.54
diff -u -p -r1.54 ufs.c
--- sys/lib/libsa/ufs.c 19 Nov 2008 12:36:41 -0000 1.54
+++ sys/lib/libsa/ufs.c 8 Jun 2011 23:53:49 -0000
@@ -513,7 +513,7 @@ ffs_find_superblock(struct open_file *f,
/*
* Open a file.
*/
-int
+__compactcall int
ufs_open(const char *path, struct open_file *f)
{
#ifndef LIBSA_FS_SINGLECOMPONENT
@@ -750,7 +750,7 @@ out:
return rc;
}
-int
+__compactcall int
ufs_close(struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -770,7 +770,7 @@ ufs_close(struct open_file *f)
* Copy a portion of a file into kernel memory.
* Cross block boundaries when necessary.
*/
-int
+__compactcall int
ufs_read(struct open_file *f, void *start, size_t size, size_t *resid)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -807,7 +807,7 @@ ufs_read(struct open_file *f, void *star
* Not implemented.
*/
#ifndef LIBSA_NO_FS_WRITE
-int
+__compactcall int
ufs_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
@@ -816,7 +816,7 @@ ufs_write(struct open_file *f, void *sta
#endif /* !LIBSA_NO_FS_WRITE */
#ifndef LIBSA_NO_FS_SEEK
-off_t
+__compactcall off_t
ufs_seek(struct open_file *f, off_t offset, int where)
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -838,7 +838,7 @@ ufs_seek(struct open_file *f, off_t offs
}
#endif /* !LIBSA_NO_FS_SEEK */
-int
+__compactcall int
ufs_stat(struct open_file *f, struct stat *sb)
{
struct file *fp = (struct file *)f->f_fsdata;
Index: sys/lib/libsa/ustarfs.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/lib/libsa/ustarfs.c,v
retrieving revision 1.32
diff -u -p -r1.32 ustarfs.c
--- sys/lib/libsa/ustarfs.c 17 Jan 2009 14:00:36 -0000 1.32
+++ sys/lib/libsa/ustarfs.c 8 Jun 2011 23:53:49 -0000
@@ -381,7 +381,7 @@ init_volzero_sig(struct open_file *f)
return 0;
}
-int
+__compactcall int
ustarfs_open(const char *path, struct open_file *f)
{
ust_active_t *ustf;
@@ -442,7 +442,7 @@ ustarfs_open(const char *path, struct op
}
#ifndef LIBSA_NO_FS_WRITE
-int
+__compactcall int
ustarfs_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
@@ -451,7 +451,7 @@ ustarfs_write(struct open_file *f, void
#endif /* !LIBSA_NO_FS_WRITE */
#ifndef LIBSA_NO_FS_SEEK
-off_t
+__compactcall off_t
ustarfs_seek(struct open_file *f, off_t offs, int whence)
{
ust_active_t *ustf;
@@ -474,7 +474,7 @@ ustarfs_seek(struct open_file *f, off_t
}
#endif /* !LIBSA_NO_FS_SEEK */
-int
+__compactcall int
ustarfs_read(struct open_file *f, void *start, size_t size, size_t *resid)
{
ust_active_t *ustf;
@@ -517,7 +517,7 @@ ustarfs_read(struct open_file *f, void *
return e;
}
-int
+__compactcall int
ustarfs_stat(struct open_file *f, struct stat *sb)
{
int mode, uid, gid;
@@ -538,7 +538,7 @@ ustarfs_stat(struct open_file *f, struct
}
#ifndef LIBSA_NO_FS_CLOSE
-int
+__compactcall int
ustarfs_close(struct open_file *f)
{
if (f == NULL || f->f_fsdata == NULL)
Index: sys/sys/cdefs.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/sys/cdefs.h,v
retrieving revision 1.84
diff -u -p -r1.84 cdefs.h
--- sys/sys/cdefs.h 19 Feb 2011 02:21:21 -0000 1.84
+++ sys/sys/cdefs.h 8 Jun 2011 23:53:49 -0000
@@ -64,6 +64,13 @@
#endif
/*
+ * Optional marker for size-optimised MD calling convention.
+ */
+#ifndef __compactcall
+#define __compactcall
+#endif
+
+/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
Home |
Main Index |
Thread Index |
Old Index