* 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
This commit is contained in:
Andrzej Bialecki 1998-12-22 11:41:51 +00:00
parent cd40239fe3
commit 1c49fb07d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42000
3 changed files with 45 additions and 29 deletions

View File

@ -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

View File

@ -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);
}
/*

View File

@ -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,30 +223,34 @@ 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;
/* 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;
/* 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);
} else {
printf("symbols=[none]");
}
printf("\n");
esym = addr;
mod_addmetadata(mp, MODINFOMD_SSYM, sizeof(ssym), &ssym);
mod_addmetadata(mp, MODINFOMD_ESYM, sizeof(esym), &esym);
return(addr - loadaddr);
}