Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arc Fix build by splitting large amount of inline a...
details: https://anonhg.NetBSD.org/src/rev/cb0c8e95cacf
branches: trunk
changeset: 937286:cb0c8e95cacf
user: skrll <skrll%NetBSD.org@localhost>
date: Fri Aug 14 16:53:06 2020 +0000
description:
Fix build by splitting large amount of inline assembling into a seperate
.S file. Same stub (/trampoline) code before and after this change.
diffstat:
sys/arch/arc/arc/arcbios.c | 96 +------------------------------
sys/arch/arc/arc/arcbios_stubs.S | 122 +++++++++++++++++++++++++++++++++++++++
sys/arch/arc/conf/files.arc | 3 +-
3 files changed, 126 insertions(+), 95 deletions(-)
diffs (267 lines):
diff -r 18a64cfdf8c2 -r cb0c8e95cacf sys/arch/arc/arc/arcbios.c
--- a/sys/arch/arc/arc/arcbios.c Fri Aug 14 16:18:36 2020 +0000
+++ b/sys/arch/arc/arc/arcbios.c Fri Aug 14 16:53:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arcbios.c,v 1.18 2020/05/29 23:02:51 tsutsui Exp $ */
+/* $NetBSD: arcbios.c,v 1.19 2020/08/14 16:53:06 skrll Exp $ */
/* $OpenBSD: arcbios.c,v 1.3 1998/06/06 06:33:33 mickey Exp $ */
/*-
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcbios.c,v 1.18 2020/05/29 23:02:51 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcbios.c,v 1.19 2020/08/14 16:53:06 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -39,7 +39,6 @@
#include <sys/kcore.h>
#include <uvm/uvm_extern.h>
#include <dev/cons.h>
-#include <machine/asm.h>
#include <machine/cpu.h>
#include <machine/regdef.h>
#include <arc/arc/arcbios.h>
@@ -69,97 +68,6 @@
int arc_cpu_l2cache_size = 0;
/*
- * ARC Bios trampoline code.
- * Note we have to save/restore reserved MIPS_CURLWP register.
- */
-#define ARC_Call(Name,Offset) \
-__asm("\n" \
-" .text\n" \
-" .ent " #Name "\n" \
-" .align 3\n" \
-" .set noreorder\n" \
-" .globl " #Name "\n" \
-#Name":\n" \
-" subu $29, " ___STRING(CALLFRAME_SIZ) "\n" \
-" sw $31, " ___STRING(CALLFRAME_RA) "($29)\n" \
-" sw $16, " ___STRING(CALLFRAME_SP) "($29)\n" \
-" lw $2, 0x80001020\n" \
-" lw $2," #Offset "($2)\n" \
-" jalr $2\n" \
-" move $16, " ___STRING(MIPS_CURLWP) "\n" \
-" move " ___STRING(MIPS_CURLWP) ", $16\n" \
-" lw $31, " ___STRING(CALLFRAME_RA) "($29)\n" \
-" lw $16, " ___STRING(CALLFRAME_SP) "($29)\n" \
-" j $31\n" \
-" addu $29, " ___STRING(CALLFRAME_SIZ) "\n" \
-" .end " #Name "\n" );
-
-#define ARC_Call5(Name,Offset) \
-__asm("\n" \
-" .text\n" \
-" .ent " #Name "\n" \
-" .align 3\n" \
-" .set noreorder\n" \
-" .globl " #Name "\n" \
-#Name":\n" \
-" subu $29, " ___STRING(CALLFRAME_SIZ + 4) "\n" \
-" sw $31, " ___STRING(CALLFRAME_RA + 4) "($29)\n" \
-" sw $16, " ___STRING(CALLFRAME_SP + 4) "($29)\n" \
-" lw $12, " ___STRING(CALLFRAME_SIZ + 4 + 16) "($29)\n" \
-" sw $12, 16($29)\n" \
-" lw $2, 0x80001020\n" \
-" lw $2," #Offset "($2)\n" \
-" jalr $2\n" \
-" move $16, " ___STRING(MIPS_CURLWP) "\n" \
-" move " ___STRING(MIPS_CURLWP) ", $16\n" \
-" lw $31, " ___STRING(CALLFRAME_RA + 4) "($29)\n" \
-" lw $16, " ___STRING(CALLFRAME_SP + 4) "($29)\n" \
-" j $31\n" \
-" addu $29, " ___STRING(CALLFRAME_SIZ + 4) "\n" \
-" .end " #Name "\n" );
-
-ARC_Call(Bios_Load, 0x00);
-ARC_Call5(Bios_Invoke, 0x04);
-ARC_Call(Bios_Execute, 0x08);
-ARC_Call(Bios_Halt, 0x0c);
-ARC_Call(Bios_PowerDown, 0x10);
-ARC_Call(Bios_Restart, 0x14);
-ARC_Call(Bios_Reboot, 0x18);
-ARC_Call(Bios_EnterInteractiveMode, 0x1c);
-ARC_Call(Bios_Unused1, 0x20); /* return_from_main? */
-ARC_Call(Bios_GetPeer, 0x24);
-ARC_Call(Bios_GetChild, 0x28);
-ARC_Call(Bios_GetParent, 0x2c);
-ARC_Call(Bios_GetConfigurationData, 0x30);
-ARC_Call(Bios_AddChild, 0x34);
-ARC_Call(Bios_DeleteComponent, 0x38);
-ARC_Call(Bios_GetComponent, 0x3c);
-ARC_Call(Bios_SaveConfiguration, 0x40);
-ARC_Call(Bios_GetSystemId, 0x44);
-ARC_Call(Bios_GetMemoryDescriptor, 0x48);
-ARC_Call(Bios_Unused2, 0x4c); /* signal??? */
-ARC_Call(Bios_GetTime, 0x50);
-ARC_Call(Bios_GetRelativeTime, 0x54);
-ARC_Call(Bios_GetDirectoryEntry, 0x58);
-ARC_Call(Bios_Open, 0x5c);
-ARC_Call(Bios_Close, 0x60);
-ARC_Call(Bios_Read, 0x64);
-ARC_Call(Bios_GetReadStatus, 0x68);
-ARC_Call(Bios_Write, 0x6c);
-ARC_Call(Bios_Seek, 0x70);
-ARC_Call(Bios_Mount, 0x74);
-ARC_Call(Bios_GetEnvironmentVariable, 0x78);
-ARC_Call(Bios_SetEnvironmentVariable, 0x7c);
-ARC_Call(Bios_GetFileInformation, 0x80);
-ARC_Call(Bios_SetFileInformation, 0x84);
-ARC_Call(Bios_FlushAllCaches, 0x88);
-/* note: the followings don't exist on SGI */
-#ifdef arc
-ARC_Call(Bios_TestUnicodeCharacter, 0x8c);
-ARC_Call(Bios_GetDisplayStatus, 0x90);
-#endif
-
-/*
* BIOS based console, for early stage.
*/
diff -r 18a64cfdf8c2 -r cb0c8e95cacf sys/arch/arc/arc/arcbios_stubs.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arc/arc/arcbios_stubs.S Fri Aug 14 16:53:06 2020 +0000
@@ -0,0 +1,122 @@
+/* $NetBSD: arcbios_stubs.S,v 1.1 2020/08/14 16:53:06 skrll Exp $ */
+
+/*-
+ * Copyright (c) 1996 M. Warner Losh. All rights reserved.
+ * Copyright (c) 1996, 1997, 1998 Per Fogelstrom. All rights reserved.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#include <machine/asm.h>
+
+/*
+ * ARC Bios trampoline code.
+ * Note we have to save/restore reserved MIPS_CURLWP register.
+ */
+#define ARC_Call(Name,Offset) \
+ .text ;\
+ .ent Name ;\
+ .align 3 ;\
+ .set noreorder ;\
+ .globl Name ;\
+Name: ;\
+ subu $29, CALLFRAME_SIZ ;\
+ sw $31, CALLFRAME_RA($29) ;\
+ sw $16, CALLFRAME_SP($29) ;\
+ lw $2, 0x80001020 ;\
+ lw $2, Offset($2) ;\
+ jalr $2 ;\
+ move $16, MIPS_CURLWP ;\
+ move MIPS_CURLWP, $16 ;\
+ lw $31, CALLFRAME_RA($29) ;\
+ lw $16, CALLFRAME_SP($29) ;\
+ j $31 ;\
+ addu $29, CALLFRAME_SIZ ;\
+ .end Name
+
+#define ARC_Call5(Name,Offset) \
+ .text ;\
+ .ent #Name ;\
+ .align 3 ;\
+ .set noreorder ;\
+ .globl Name ;\
+Name: ;\
+ subu $29, CALLFRAME_SIZ + 4 ;\
+ sw $31, CALLFRAME_RA + 4($29) ;\
+ sw $16, CALLFRAME_SP + 4($29) ;\
+ lw $12, CALLFRAME_SIZ + 4 + 16($29) ;\
+ sw $12, 16($29) ;\
+ lw $2, 0x80001020 ;\
+ lw $2, Offset($2) ;\
+ jalr $2 ;\
+ move $16, MIPS_CURLWP ;\
+ move MIPS_CURLWP, $16 ;\
+ lw $31, CALLFRAME_RA + 4($29) ;\
+ lw $16, CALLFRAME_SP + 4($29) ;\
+ j $31 ;\
+ addu $29, CALLFRAME_SIZ + 4 ;\
+ .end Name
+
+ARC_Call(Bios_Load, 0x00);
+ARC_Call5(Bios_Invoke, 0x04);
+ARC_Call(Bios_Execute, 0x08);
+ARC_Call(Bios_Halt, 0x0c);
+ARC_Call(Bios_PowerDown, 0x10);
+ARC_Call(Bios_Restart, 0x14);
+ARC_Call(Bios_Reboot, 0x18);
+ARC_Call(Bios_EnterInteractiveMode, 0x1c);
+ARC_Call(Bios_Unused1, 0x20); /* return_from_main? */
+ARC_Call(Bios_GetPeer, 0x24);
+ARC_Call(Bios_GetChild, 0x28);
+ARC_Call(Bios_GetParent, 0x2c);
+ARC_Call(Bios_GetConfigurationData, 0x30);
+ARC_Call(Bios_AddChild, 0x34);
+ARC_Call(Bios_DeleteComponent, 0x38);
+ARC_Call(Bios_GetComponent, 0x3c);
+ARC_Call(Bios_SaveConfiguration, 0x40);
+ARC_Call(Bios_GetSystemId, 0x44);
+ARC_Call(Bios_GetMemoryDescriptor, 0x48);
+ARC_Call(Bios_Unused2, 0x4c); /* signal??? */
+ARC_Call(Bios_GetTime, 0x50);
+ARC_Call(Bios_GetRelativeTime, 0x54);
+ARC_Call(Bios_GetDirectoryEntry, 0x58);
+ARC_Call(Bios_Open, 0x5c);
+ARC_Call(Bios_Close, 0x60);
+ARC_Call(Bios_Read, 0x64);
+ARC_Call(Bios_GetReadStatus, 0x68);
+ARC_Call(Bios_Write, 0x6c);
+ARC_Call(Bios_Seek, 0x70);
+ARC_Call(Bios_Mount, 0x74);
+ARC_Call(Bios_GetEnvironmentVariable, 0x78);
+ARC_Call(Bios_SetEnvironmentVariable, 0x7c);
+ARC_Call(Bios_GetFileInformation, 0x80);
+ARC_Call(Bios_SetFileInformation, 0x84);
+ARC_Call(Bios_FlushAllCaches, 0x88);
+/* note: the followings don't exist on SGI */
+#ifdef arc
+ARC_Call(Bios_TestUnicodeCharacter, 0x8c);
+ARC_Call(Bios_GetDisplayStatus, 0x90);
+#endif
+
diff -r 18a64cfdf8c2 -r cb0c8e95cacf sys/arch/arc/conf/files.arc
--- a/sys/arch/arc/conf/files.arc Fri Aug 14 16:18:36 2020 +0000
+++ b/sys/arch/arc/conf/files.arc Fri Aug 14 16:53:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.arc,v 1.66 2020/06/15 22:03:39 tsutsui Exp $
+# $NetBSD: files.arc,v 1.67 2020/08/14 16:53:06 skrll Exp $
# $OpenBSD: files.arc,v 1.21 1999/09/11 10:20:20 niklas Exp $
#
# maxpartitions must be first item in files.${ARCH}
@@ -77,6 +77,7 @@
file arch/arc/arc/wired_map_machdep.c
file arch/arc/arc/arcbios.c
+file arch/arc/arc/arcbios_stubs.S
file arch/mips/mips/mips3_clock.c
Home |
Main Index |
Thread Index |
Old Index