summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabial <abial@FreeBSD.org>1998-12-22 11:41:51 +0000
committerabial <abial@FreeBSD.org>1998-12-22 11:41:51 +0000
commit524f060924f0e318250a13b7ea8041e649bdcce6 (patch)
tree71b19ea84fd7d00f25dd753085642209fa5773cb
parent32888e39b1d94003af67ac74b865aef91e92e9fa (diff)
downloadFreeBSD-src-524f060924f0e318250a13b7ea8041e649bdcce6.zip
FreeBSD-src-524f060924f0e318250a13b7ea8041e649bdcce6.tar.gz
* Begin integration of built-ins with Forth: leave the exit code from
a built-in command on Forth stack. * Fix a bug which was causing a panic when loading stripped aout kernels. Reviewed by: jkh
-rw-r--r--sys/boot/common/interp.c15
-rw-r--r--sys/boot/common/interp_forth.c13
-rw-r--r--sys/boot/common/load_aout.c48
3 files changed, 46 insertions, 30 deletions
diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c
index 8ae6d03..95f2967 100644
--- a/sys/boot/common/interp.c
+++ b/sys/boot/common/interp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: interp.c,v 1.7 1998/10/21 20:07:04 msmith Exp $
+ * $Id: interp.c,v 1.8 1998/11/04 00:29:01 msmith Exp $
*/
/*
* Simple commandline interpreter, toplevel and misc.
@@ -35,6 +35,15 @@
#include <string.h>
#include "bootstrap.h"
+#ifdef BOOT_FORTH
+#include "ficl.h"
+#define RETURN(x) stackPushINT32(bf_vm->pStack,!x); return(x)
+
+extern FICL_VM *bf_vm;
+#else
+#define RETURN(x) return(x)
+#endif
+
#define MAXARGS 20 /* maximum number of arguments allowed */
static void prompt(void);
@@ -68,7 +77,7 @@ perform(int argc, char *argv[])
} else {
command_errmsg = "unknown command";
}
- return(result);
+ RETURN(result);
}
/*
@@ -138,7 +147,7 @@ command_source(int argc, char *argv[])
for (i = 1; i < argc; i++)
source(argv[i]);
- return(CMD_OK);
+ RETURN(CMD_OK);
}
struct sourceline
diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c
index 9da74a5..06daf7a 100644
--- a/sys/boot/common/interp_forth.c
+++ b/sys/boot/common/interp_forth.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: interp_forth.c,v 1.6 1998/11/07 03:44:10 jkh Exp $
+ * $Id: interp_forth.c,v 1.7 1998/11/07 06:18:00 jkh Exp $
*/
#include <stand.h>
@@ -42,7 +42,7 @@
* BootForth Interface to Ficl Forth interpreter.
*/
-static FICL_VM *bf_vm;
+FICL_VM *bf_vm;
/*
* Shim for taking commands from BF and passing them out to 'standard'
@@ -89,14 +89,17 @@ bf_command(FICL_VM *vm)
if (!parse(&argc, &argv, line)) {
result = (cmd)(argc, argv);
free(argv);
- if (result != 0) {
- strcpy(command_errmsg, vm->pad);
- vmTextOut(vm, vm->pad, 1);
+ if(result != 0) {
+ vmTextOut(vm,argv[0],0);
+ vmTextOut(vm,": ",0);
+ vmTextOut(vm,command_errmsg,1);
}
} else {
vmTextOut(vm, "parse error\n", 1);
+ result=1;
}
free(line);
+ stackPushINT32(vm->pStack,!result);
}
/*
diff --git a/sys/boot/common/load_aout.c b/sys/boot/common/load_aout.c
index 3a5d34d..6d33ad4 100644
--- a/sys/boot/common/load_aout.c
+++ b/sys/boot/common/load_aout.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: load_aout.c,v 1.9 1998/10/09 23:15:39 peter Exp $
+ * $Id: load_aout.c,v 1.10 1998/10/12 09:05:12 peter Exp $
*/
#include <sys/param.h>
@@ -223,29 +223,33 @@ aout_loadimage(struct loaded_module *mp, int fd, vm_offset_t loadaddr, struct ex
/* symbol table size */
ssym = addr;
- archsw.arch_copyin(&ehdr->a_syms, addr, sizeof(ehdr->a_syms));
- addr += sizeof(ehdr->a_syms);
+ if(ehdr->a_syms!=NULL) {
+ archsw.arch_copyin(&ehdr->a_syms, addr, sizeof(ehdr->a_syms));
+ addr += sizeof(ehdr->a_syms);
- /* symbol table */
- printf("symbols=[0x%x+0x%lx", sizeof(ehdr->a_syms), ehdr->a_syms);
- if (archsw.arch_readin(fd, addr, ehdr->a_syms) != ehdr->a_syms)
- return(0);
- addr += ehdr->a_syms;
-
- /* string table */
- read(fd, &ss, sizeof(ss));
- archsw.arch_copyin(&ss, addr, sizeof(ss));
- addr += sizeof(ss);
- ss -= sizeof(ss);
- printf("+0x%x+0x%x]", sizeof(ss), ss);
- if (archsw.arch_readin(fd, addr, ss) != ss)
- return(0);
- printf(" \n");
- addr += ss;
- esym = addr;
+ /* symbol table */
+ printf("symbols=[0x%x+0x%lx", sizeof(ehdr->a_syms), ehdr->a_syms);
+ if (archsw.arch_readin(fd, addr, ehdr->a_syms) != ehdr->a_syms)
+ return(0);
+ addr += ehdr->a_syms;
+
+ /* string table */
+ read(fd, &ss, sizeof(ss));
+ archsw.arch_copyin(&ss, addr, sizeof(ss));
+ addr += sizeof(ss);
+ ss -= sizeof(ss);
+ printf("+0x%x+0x%x]", sizeof(ss), ss);
+ if (archsw.arch_readin(fd, addr, ss) != ss)
+ return(0);
+ addr += ss;
- mod_addmetadata(mp, MODINFOMD_SSYM, sizeof(ssym), &ssym);
- mod_addmetadata(mp, MODINFOMD_ESYM, sizeof(esym), &esym);
+ mod_addmetadata(mp, MODINFOMD_SSYM, sizeof(ssym), &ssym);
+ mod_addmetadata(mp, MODINFOMD_ESYM, sizeof(esym), &esym);
+ } else {
+ printf("symbols=[none]");
+ }
+ printf("\n");
+ esym = addr;
return(addr - loadaddr);
}
OpenPOWER on IntegriCloud