Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Introduce an array of supported CPU types by a given arc...
details: https://anonhg.NetBSD.org/src/rev/335fd4c0871b
branches: trunk
changeset: 538784:335fd4c0871b
user: manu <manu%NetBSD.org@localhost>
date: Tue Oct 29 22:22:30 2002 +0000
description:
Introduce an array of supported CPU types by a given arch for Mach-O
diffstat:
sys/arch/i386/i386/macho_machdep.c | 6 ++++--
sys/arch/i386/include/macho_machdep.h | 6 +-----
sys/kern/exec_macho.c | 17 +++++++++--------
sys/sys/exec_macho.h | 7 ++++++-
4 files changed, 20 insertions(+), 16 deletions(-)
diffs (110 lines):
diff -r 60315724a3f8 -r 335fd4c0871b sys/arch/i386/i386/macho_machdep.c
--- a/sys/arch/i386/i386/macho_machdep.c Tue Oct 29 21:02:45 2002 +0000
+++ b/sys/arch/i386/i386/macho_machdep.c Tue Oct 29 22:22:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: macho_machdep.c,v 1.2 2001/11/15 07:03:30 lukem Exp $ */
+/* $NetBSD: macho_machdep.c,v 1.3 2002/10/29 22:22:31 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,11 +37,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: macho_machdep.c,v 1.2 2001/11/15 07:03:30 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: macho_machdep.c,v 1.3 2002/10/29 22:22:31 manu Exp $");
#include <sys/systm.h>
+#include <sys/types.h>
#include <sys/exec_macho.h>
+u_int32_t exec_macho_supported_cpu[] = { MACHO_CPU_TYPE_I386, 0 };
#ifdef DEBUG_MACHO
#define DPRINTF(a) printf a
diff -r 60315724a3f8 -r 335fd4c0871b sys/arch/i386/include/macho_machdep.h
--- a/sys/arch/i386/include/macho_machdep.h Tue Oct 29 21:02:45 2002 +0000
+++ b/sys/arch/i386/include/macho_machdep.h Tue Oct 29 22:22:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: macho_machdep.h,v 1.2 2001/07/14 03:05:51 christos Exp $ */
+/* $NetBSD: macho_machdep.h,v 1.3 2002/10/29 22:22:31 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -91,8 +91,4 @@
unsigned int argv[MACHO_I386_SAVED_ARGV_COUNT];
};
-#define MACHO_MACHDEP_CASES \
- case MACHO_CPU_TYPE_I386: \
- goto done;
-
#endif /* !_I386_MACHO_MACHDEP_H_ */
diff -r 60315724a3f8 -r 335fd4c0871b sys/kern/exec_macho.c
--- a/sys/kern/exec_macho.c Tue Oct 29 21:02:45 2002 +0000
+++ b/sys/kern/exec_macho.c Tue Oct 29 22:22:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_macho.c,v 1.9 2002/10/29 19:28:19 manu Exp $ */
+/* $NetBSD: exec_macho.c,v 1.10 2002/10/29 22:22:31 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_macho.c,v 1.9 2002/10/29 19:28:19 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_macho.c,v 1.10 2002/10/29 22:22:31 manu Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -351,6 +351,7 @@
int error = ENOEXEC, i;
size_t size;
void *buf = &lc;
+ u_int32_t *sc;
#ifdef DEBUG_MACHO
exec_macho_print_fat_header(fat);
@@ -365,14 +366,14 @@
#ifdef DEBUG_MACHO
exec_macho_print_fat_arch(&arch);
#endif
- switch (be32toh(arch.cputype)) {
- MACHO_MACHDEP_CASES
+ for (sc = exec_macho_supported_cpu; *sc; sc++)
+ if (*sc == be32toh(arch.cputype))
+ break;
+ if (*sc == NULL) {
+ DPRINTF(("CPU not supported by this binary"));
+ goto bad;
}
}
-
- DPRINTF(("This MACH-O binary does not support your cpu"));
- goto bad;
-done:
break;
case MACHO_MOH_MAGIC:
diff -r 60315724a3f8 -r 335fd4c0871b sys/sys/exec_macho.h
--- a/sys/sys/exec_macho.h Tue Oct 29 21:02:45 2002 +0000
+++ b/sys/sys/exec_macho.h Tue Oct 29 22:22:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_macho.h,v 1.3 2002/08/26 21:09:03 christos Exp $ */
+/* $NetBSD: exec_macho.h,v 1.4 2002/10/29 22:22:30 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -43,6 +43,11 @@
#include <machine/macho_machdep.h>
/*
+ * CPU supported by a given arch, in sys/arch/<arch>/<arch>/macho_machdep.c
+ */
+extern u_int32_t exec_macho_supported_cpu[];
+
+/*
* the `fat' binary description
*/
struct exec_macho_fat_header {
Home |
Main Index |
Thread Index |
Old Index