Introduce an array of supported CPU types by a given arch for Mach-O
This commit is contained in:
parent
4ffdd69467
commit
9b4f3b0464
sys
@ -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
|
||||
|
@ -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 @@ struct exec_macho_i386_saved_state {
|
||||
unsigned int argv[MACHO_I386_SAVED_ARGV_COUNT];
|
||||
};
|
||||
|
||||
#define MACHO_MACHDEP_CASES \
|
||||
case MACHO_CPU_TYPE_I386: \
|
||||
goto done;
|
||||
|
||||
#endif /* !_I386_MACHO_MACHDEP_H_ */
|
||||
|
@ -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 @@ exec_macho_load_vnode(struct proc *p, struct exec_package *epp,
|
||||
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 @@ exec_macho_load_vnode(struct proc *p, struct exec_package *epp,
|
||||
#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:
|
||||
|
@ -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.
|
||||
@ -42,6 +42,11 @@
|
||||
#include <machine/int_types.h>
|
||||
#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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user