summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1998-07-20 18:14:58 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1998-07-20 18:14:58 +0000
commitfdc38214f1c40ce26e6e25981327826a7ea66eb5 (patch)
treeae9c7e77ecb34ab5cef60b5c8b9394610fd73b47
parent23e22f5ad7ff8815b741e5de54c0b98982f70ccc (diff)
new exec framework
-rw-r--r--sys/arch/i386/stand/boot/conf.c14
-rw-r--r--sys/arch/i386/stand/libsa/Makefile8
-rw-r--r--sys/arch/i386/stand/libsa/exec_i386.c34
-rw-r--r--sys/arch/i386/stand/libsa/libsa.h4
4 files changed, 32 insertions, 28 deletions
diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c
index 6b8283bdc94..75b140e0cf4 100644
--- a/sys/arch/i386/stand/boot/conf.c
+++ b/sys/arch/i386/stand/boot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.12 1998/04/18 07:39:37 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.13 1998/07/20 18:14:52 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -46,20 +46,26 @@
#include <lib/libsa/unixdev.h>
#include <biosdev.h>
#include <dev/cons.h>
+#include <lib/libsa/exec.h>
const char version[] = "1.23";
int debug;
+const struct x_sw execsw[] = {
+ { "aout", aout_probe, aout_load },
+ { "", NULL, NULL },
+};
+
struct fs_ops file_system[] = {
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek,
ufs_stat, ufs_readdir },
#ifdef notdef
{ fat_open, fat_close, fat_read, fat_write, fat_seek,
fat_stat, fat_readdir },
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
- cd9660_stat, cd9660_readdir },
{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek,
nfs_stat, nfs_readdir },
+ { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
+ cd9660_stat, cd9660_readdir },
#endif
#ifdef _TEST
{ null_open, null_close, null_read, null_write, null_seek,
@@ -87,7 +93,6 @@ struct netif_driver *netif_drivers[] = {
int n_netif_drivers = NENTS(netif_drivers);
#endif
-struct consdev *cn_tab = &constab[0];
struct consdev constab[] = {
#ifdef _TEST
{ unix_probe, unix_init, unix_getc, unix_putc },
@@ -97,4 +102,5 @@ struct consdev constab[] = {
#endif
{ NULL }
};
+struct consdev *cn_tab = constab;
diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile
index 03fc1dd282c..6809b6705f3 100644
--- a/sys/arch/i386/stand/libsa/Makefile
+++ b/sys/arch/i386/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.34 1998/05/30 02:30:49 mickey Exp $
+# $OpenBSD: Makefile,v 1.35 1998/07/20 18:14:55 mickey Exp $
.include "${.CURDIR}/../Makefile.inc"
@@ -27,9 +27,9 @@ CLEANFILES+= unixdev.o unixsys.o nullfs.o
.endif
# stand routines
-SRCS+= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c strlen.c \
+SRCS+= alloc.c exit.c getfile.c gets.c globals.c strcmp.c strlen.c \
strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c \
- strtol.c ctime.c
+ strtol.c ctime.c exec.new.c exec_aout.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
@@ -59,7 +59,7 @@ install:
.include <bsd.lib.mk>
CPPFLAGS+=-DLINKADDR=${LINKADDR} -DHEAP_LIMIT=${HEAP_LIMIT} ${DEBUGFLAGS}
-CPPFLAGS+=-I${S}/stand/boot
+CPPFLAGS+=-I${S}/stand/boot -DCOMPAT_UFS
CFLAGS+=${SACFLAGS} -D__INTERNAL_LIBSA_CREAD
#AS=cat ;
#AS+= -R
diff --git a/sys/arch/i386/stand/libsa/exec_i386.c b/sys/arch/i386/stand/libsa/exec_i386.c
index 75c0b02bffb..6eacf0a105e 100644
--- a/sys/arch/i386/stand/libsa/exec_i386.c
+++ b/sys/arch/i386/stand/libsa/exec_i386.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: exec_i386.c,v 1.22 1998/05/25 19:20:54 mickey Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.23 1998/07/20 18:14:56 mickey Exp $ */
/*
- * Copyright (c) 1997 Michael Shalayeff
+ * Copyright (c) 1997-1998 Michael Shalayeff
* Copyright (c) 1997 Tobias Weingartner
* All rights reserved.
*
@@ -35,24 +35,22 @@
*/
#include <sys/param.h>
-#include <sys/exec.h>
-#include <sys/reboot.h>
#include <dev/cons.h>
#include <stand/boot/bootarg.h>
#include <machine/biosvar.h>
#include <sys/disklabel.h>
#include "disk.h"
#include "libsa.h"
-
-#define round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
+#include <lib/libsa/exec.h>
typedef void (*startfuncp)(int, int, int, int, int, int, int, int)
- __attribute__ ((noreturn));
+ __attribute__ ((noreturn));
void
-machdep_start(startaddr, howto, loadaddr, ssym, esym)
- char *startaddr, *loadaddr, *ssym, *esym;
+machdep_exec(xp, howto, loadaddr)
+ struct x_param *xp;
int howto;
+ void *loadaddr;
{
#ifndef _TEST
dev_t bootdev = bootdev_dip->bootdev;
@@ -65,23 +63,21 @@ machdep_start(startaddr, howto, loadaddr, ssym, esym)
#ifdef EXEC_DEBUG
x = (void *)loadaddr;
- printf("exec {\n\ta_midmag = %lx\n\ta_text = %lx\n\ta_data = %lx\n"
- "\ta_bss = %lx\n\ta_syms = %lx\n\ta_entry = %lx\n"
- "\ta_trsize = %lx\n\ta_drsize = %lx\n}\n",
+ printf("exec {\n\ta_midmag = %x\n\ta_text = %x\n\ta_data = %x\n"
+ "\ta_bss = %x\n\ta_syms = %x\n\ta_entry = %x\n"
+ "\ta_trsize = %x\n\ta_drsize = %x\n}\n",
x->a_midmag, x->a_text, x->a_data, x->a_bss, x->a_syms,
x->a_entry, x->a_trsize, x->a_drsize);
- printf("/bsd(%x,%x,%x,%x,%x,%x,%d,%p)\n",
- howto, bootdev, BOOTARG_APIVER, round_to_size(esym),
- extmem, cnvmem, ac, av);
+ printf("/bsd(%x,%u,%p)\n", BOOTARG_APIVER, ac, av);
getchar();
#endif
- (int)startaddr &= 0xffffff;
+ xp->xp_entry &= 0xffffff;
- printf("entry point at %p\n", startaddr);
+ printf("entry point at 0x%x\n", xp->xp_entry);
/* stack and the gung is ok at this point, so, no need for asm setup */
- (*(startfuncp)startaddr)(howto, bootdev, BOOTARG_APIVER,
- round_to_size(esym), extmem, cnvmem, ac, (int)av);
+ (*(startfuncp)xp->xp_entry)(howto, bootdev, BOOTARG_APIVER,
+ xp->xp_end, extmem, cnvmem, ac, (int)av);
/* not reached */
#endif
}
diff --git a/sys/arch/i386/stand/libsa/libsa.h b/sys/arch/i386/stand/libsa/libsa.h
index 9aeac9d9661..ce2890d083e 100644
--- a/sys/arch/i386/stand/libsa/libsa.h
+++ b/sys/arch/i386/stand/libsa/libsa.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libsa.h,v 1.27 1998/07/13 04:03:26 mickey Exp $ */
+/* $OpenBSD: libsa.h,v 1.28 1998/07/20 18:14:57 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -35,6 +35,8 @@
#include <lib/libsa/stand.h>
#include <machine/biosvar.h>
+#define EXEC_AOUT
+
#define DEFAULT_KERNEL_ADDRESS 0x100000
void gateA20 __P((int));