[OpenBIOS] r471 - in cpu: i8051 ppc/Linux

svn at openbios.org svn at openbios.org
Wed Jul 18 07:08:52 CEST 2007


Author: wmb
Date: 2007-07-18 07:08:52 +0200 (Wed, 18 Jul 2007)
New Revision: 471

Modified:
   cpu/i8051/kernel.bth
   cpu/i8051/metainit.fth
   cpu/i8051/target.fth
   cpu/ppc/Linux/Makefile
Log:
Checkpoint of 8051 scaffolding.


Modified: cpu/i8051/kernel.bth
===================================================================
--- cpu/i8051/kernel.bth	2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/i8051/kernel.bth	2007-07-18 05:08:52 UTC (rev 471)
@@ -42,7 +42,7 @@
 warning-t  off  	\ Turn OFF target warning messages
 
 \ Uncomment the following line(s) for more debug output
-\ show? on  1 granularity !  1 threshold !
+\ show? on  1 granularity !  540 threshold !
 \ warning-t on
 
 fload ${BP}/cpu/i8051/kerncode.fth         \ CPU-dependent Forth kernel

Modified: cpu/i8051/metainit.fth
===================================================================
--- cpu/i8051/metainit.fth	2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/i8051/metainit.fth	2007-07-18 05:08:52 UTC (rev 471)
@@ -26,17 +26,12 @@
 \ This number is a target token rather than an absolute address.
 hex
 
-0.0000 org  0.0000 voc-link-t token-t!
+0 voc-link-t token-t!
 
-ps-size-t equ ps-size
+\ ps-size-t equ ps-size
 
 assembler
 
-\ This is at the first location in the Forth image.
-
-hex
-mlabel cld
-
 \ LICENSE_BEGIN
 \ Copyright (c) 2007 FirmWorks
 \ 

Modified: cpu/i8051/target.fth
===================================================================
--- cpu/i8051/target.fth	2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/i8051/target.fth	2007-07-18 05:08:52 UTC (rev 471)
@@ -7,17 +7,21 @@
 
 only forth also meta definitions
 
+: note-string-t  ( adr len -- adr len )  ;
+
 : lobyte h# 0ff and ;
 : hibyte 8 rshift lobyte ;
 
 2 constant /w-t
-/l-t constant /n-t
+: /l-t true abort" /l-t called" ;
+: l,-t true abort" l,-t called" ;
+/w-t constant /n-t
 /w-t constant /a-t
 /a-t constant /thread-t
-/w-t constant /token-t
+3 constant /token-t   \ ljmp <adr>
 /w-t constant /link-t
 /token-t constant /defer-t
-\ /n-t h# 600 * constant user-size-t
+h# 80 constant user-size-t
 \ /n-t h# 100 * constant ps-size-t
 \ /n-t h# 100 * constant rs-size-t
 /w-t constant /user#-t
@@ -27,14 +31,20 @@
 \ 32 bit host Forth compiling 16-bit target Forth
 
 : n->n-t ; immediate
+: n->l-t ; immediate
+: s->l-t ; immediate
 
 : c!-t ( n add -- ) >hostaddr c! ;
 : c at -t ( target-address -- n ) >hostaddr c@ ;
 
-\ Intel processors are little-endian
+\ Store data in little endian
 : w!-t ( n add -- )  over lobyte over c!-t  ca1+ swap hibyte swap c!-t  ;
 : w at -t ( target-address -- n )  dup c at -t swap 1+ c at -t 8 << or  ;
 
+\ ljmp addresses are big endian
+: be-w!-t  ( n target-address -- )  over lobyte over ca1+ c!-t  swap hibyte swap c!-t  ;
+: be-w at -t  ( target-address -- n )  dup + c at -t swap c at -t 8 << or  ;
+
 alias le-w!-t w!-t
 alias le-w at -t w at -t
 
@@ -57,15 +67,13 @@
 
 : a at -t ( target-address -- target-address )  w at -t  origin-t +  ;
 : a!-t ( token target-address -- )  swap  origin-t -  swap  w!-t  ;
-: token at -t ( target-address -- target-acf )  a at -t  ;
-: token!-t ( acf target-address -- )  a!-t  ;
+: token at -t ( target-address -- target-acf )  1+ a at -t  ;
+: token!-t ( acf target-address -- )  h# 12 over c!-t  1+ be-w!-t  ;  \ lcall instruction
 
 : rlink at -t  ( occurrence -- next-occurrence )  w at -t  origin-t +  ;
 : rlink!-t  ( next-occurrence occurrence -- ) swap  origin-t -  swap  w!-t  ;
 
-\ Machine independent
 : a,-t  ( adr -- )  here-t /a-t allot-t  a!-t  ;
-: token,-t ( token -- )  here-t /token-t allot-t  token!-t  ;
 
 \ These versions of linkx-t are for absolute links
 : link at -t ( target-address -- target-address' )  a at -t  ;
@@ -85,7 +93,7 @@
 
 \ Machine independent
 : a-t, ( target-address -- )  here  /a-t allot  a-t!  ;
-: token-t, ( target-address -- )  here  /token-t allot  token-t!  ;
+: token-t, ( target-address -- )  here  /token-t allot  token!-t  ;
 
 \ Dictionary linked list; the list head is in the metacompiler environment
 \ during metacompilation
@@ -112,6 +120,8 @@
    userarea-t >hostaddr user-size-t  erase
 ;
 
+: >body-t ( cfa-t -- pfa-t )  3 + w at -t  ;
+
 : (>user-t)    ( cfa-t -- user-address-t )  >body-t  w at -t  userarea-t  +  ;
 : >user-t  ( cfa-t -- user-address-h )  (>user-t)  >hostaddr  ;
 
@@ -158,7 +168,7 @@
    /link +loop
 ;
 : initmeta  ( -- )
-   init-relocation-t
+\   init-relocation-t
    threads-t clear-threads-t  threads-t current-t !
 ;
 
@@ -170,9 +180,6 @@
 : branch! ( from-t target-addr-t -- )  over -  swap  ( offset from-t )   w!-t  ;
 : branch, ( target-t -- )  here-t -  w,-t  ;
 
-\ XXX FIXME for subroutine threaded
-: >body-t ( cfa-t -- pfa-t )  /n-t +  ;   \ This version is for indirect threaded
-
 \ Store actions for some data types.
 
 : isuser  ( n acf -- )  >user-t n-t!  ;
@@ -187,6 +194,7 @@
    ['] here-t  is here
    ['] allot-t is asm-allot
    ['] c!-t    is asm8!
+   ['] c at -t    is asm8@
    [ previous meta ]
 ;
 : install-host-assembler  ( -- )  [ assembler ] resident [ meta ]  ;

Modified: cpu/ppc/Linux/Makefile
===================================================================
--- cpu/ppc/Linux/Makefile	2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/ppc/Linux/Makefile	2007-07-18 05:08:52 UTC (rev 471)
@@ -2,8 +2,11 @@
 WRAPPER = pforth
 OPT = -O
 # OPT =
-CFLAGS = -DUNIX -DSYS5 -DSIM -DPOWERPC -DARGREGS -DSIMNEXT
 
+BP=../../..
+
+CFLAGS = -DUNIX -DPPCSIM -DTARGET_POWERPC
+
 CC = gcc
 
 WRDIR = ${BP}/forth/wrapper
@@ -12,8 +15,8 @@
 
 ZIPOBJS = zipmem.o deflate.o trees.o bits.o util.o inflate.o
 
-OBJS = wrapper.o ppcsim.o logger.o ${ZIPOBJS}
-TRACEOBJS = wrapper.o ppcsim.trace.o logger.o ${ZIPOBJS}
+OBJS = wrapsim.o ppcsim.o logger.o ${ZIPOBJS}
+TRACEOBJS = wrapsim.o ppcsim.trace.o logger.o ${ZIPOBJS}
 SIMROMOBJS = simrom.o ppcsim.simrom.o
 
 all: ppcforth ppcforth.trace
@@ -27,6 +30,9 @@
 simrom: $(SIMROMOBJS)
 	$(CC) $(LFLAGS)  $(SIMROMOBJS)  -o $@
 
+wrapsim.o: ${WRDIR}/wrapper.c
+	${CC} -c ${CFLAGS} $< -o $@
+
 %.o: ${WRDIR}/%.c
 	${CC} -c ${CFLAGS} $< -o $@
 
@@ -34,16 +40,16 @@
 	${CC} -c ${CFLAGS} -I${ZIPDIR} $< -o $@
 
 ppcsim.o: $(SIMDIR)/ppcsim.c
-	$(CC) $(OPT) $(CFLAGS) -c $< -o $@
+	$(CC) $(OPT) $(CFLAGS) -DARGREGS -DSIMNEXT -c $< -o $@
 
 ppcsim.trace.o: $(SIMDIR)/ppcsim.c
-	$(CC) $(OPT) $(CFLAGS) -DTRACE -c $< -o $@
+	$(CC) $(OPT) $(CFLAGS)  -DARGREGS -DSIMNEXT -DTRACE -c $< -o $@
 
 ppcsim.simrom.o: $(SIMDIR)/ppcsim.c
-	$(CC) $(CFLAGS) -DTRACE -DSIMROM -c $< -o $@
+	$(CC) $(CFLAGS)  -DARGREGS -DSIMNEXT -DTRACE -DSIMROM -c $< -o $@
 
 simrom.o: $(SIMDIR)/simrom.c
-	$(CC) $(CFLAGS) -DTRACE -DSIMROM -c $< -o $@
+	$(CC) $(CFLAGS)  -DARGREGS -DSIMNEXT -DTRACE -DSIMROM -c $< -o $@
 
 clean:
 	@rm -f *.o ppcforth ppcforth.trace




More information about the OpenBIOS mailing list