Author: wmb Date: 2008-08-20 04:03:20 +0200 (Wed, 20 Aug 2008) New Revision: 884
Modified: cpu/ppc/kerncode.fth cpu/x86/kerncode.fth ofw/confvar/nameval.fth Log: Fixed yet another problem with r838. There was a buffer conflict with configuration variables, causing boot-device and boot-file (or any pair) of string-valued variables to interfere with one another.
Modified: cpu/ppc/kerncode.fth =================================================================== --- cpu/ppc/kerncode.fth 2008-08-18 10:00:37 UTC (rev 883) +++ cpu/ppc/kerncode.fth 2008-08-20 02:03:20 UTC (rev 884) @@ -291,6 +291,13 @@ add tos,tos,t0 c;
+\ Loop limit for current do loop +code ilimit (s -- n ) + push-tos + lwz tos,1cell(rp) + addis tos,tos,h#-8000 \ Bias by h#8000.0000 +c; + \ Loop index for next enclosing do loop code j (s -- n ) push-tos @@ -299,6 +306,13 @@ add tos,tos,t0 c;
+\ Loop limit for next enclosing do loop +code jlimit (s -- n ) + push-tos + lwz tos,16(rp) + addis tos,tos,h#-8000 \ Bias by h#8000.0000 +c; + code (leave) (s -- ) mlabel pleave lwz ip,2cells(rp) \ Get the address of the ending offset
Modified: cpu/x86/kerncode.fth =================================================================== --- cpu/x86/kerncode.fth 2008-08-18 10:00:37 UTC (rev 883) +++ cpu/x86/kerncode.fth 2008-08-20 02:03:20 UTC (rev 884) @@ -251,9 +251,15 @@ \ Loop index for current do loop code i (s -- n ) 0 [rp] ax mov /n [rp] ax add 1push c;
+\ Loop limit for current do loop +code ilimit ( -- n ) 1 /n* [rp] ax mov 80000000 # ax sub 1push c; + \ Loop index for next enclosing do loop code j (s -- n ) 3 /n* [rp] ax mov 4 /n* [rp] ax add 1push c;
+\ Loop limit for next enclosing do loop +code jlimit ( -- n ) 4 /n* [rp] ax mov 80000000 # ax sub 1push c; + code (leave) (s -- ) mloclabel pleave 2 /n* [rp] ip mov 3 /n* # rp add
Modified: ofw/confvar/nameval.fth =================================================================== --- ofw/confvar/nameval.fth 2008-08-18 10:00:37 UTC (rev 883) +++ ofw/confvar/nameval.fth 2008-08-20 02:03:20 UTC (rev 884) @@ -284,14 +284,15 @@ h# ffe constant /pack-buf /pack-buf 2+ buffer: pack-buf 0 value pntr -: #consecutive ( adr b -- n ) - swap ( b adr ) - h# 3f 0 do ( b adr ) - 2dup i ca+ c@ <> if ( b adr ) - 2drop i unloop exit ( n ) - then ( b adr ) - loop ( b adr ) - 2drop h# 7f +: #consecutive ( lastadr adr b -- n ) + -rot ( b lastadr adr ) + tuck - h# 3f min ( b adr maxn ) + -rot 2 pick 0 do ( maxn b adr ) + 2dup i ca+ c@ <> if ( maxn b adr ) + 3drop i unloop exit ( n ) + then ( maxn b adr ) + loop ( maxn b adr ) + 2drop ( maxn ) ; : pack-byte ( b -- full? ) pack-buf pntr ca+ c! @@ -302,18 +303,18 @@ 0 to pntr bounds ?do ( ) i c@ case ( c: char ) 0 of ( ) - h# fe pack-byte ( ) - i 0 #consecutive ( step ) + h# fe pack-byte ?leave ( ) + ilimit i 0 #consecutive ( step ) dup ( step code ) endof ( step code ) h# fe of ( ) - h# fe pack-byte ( ) - i h# fe #consecutive ( step ) + h# fe pack-byte ?leave ( ) + ilimit i h# fe #consecutive ( step ) dup h# 40 or ( step code ) endof ( step code ) h# ff of ( ) - h# fe pack-byte ( ) - i h# ff #consecutive ( step ) + h# fe pack-byte ?leave ( ) + ilimit i h# ff #consecutive ( step ) dup h# 80 or ( step code ) endof ( step code ) ( default ) 1 swap dup ( step char char ) @@ -322,9 +323,32 @@ +loop ( ) pack-buf pntr ( adr len ) ; +0 value unpack-buf +0 value /unpack-buf +: not-packed? ( adr len -- flag ) + dup false ( adr len len packed? ) + 2swap bounds ?do ( ulen packed? ) + i c@ h# fe = if ( ulen packed? ) + drop 2- \ fe and next ( ulen' ) + i 1+ c@ h# 3f and + \ #inserted ( ulen' ) + true 2 ( ulen packed? advance ) + else ( ulen packed? ) + 1 ( ulen packed? advance ) + then ( ulen advance ) + +loop ( ulen packed? ) + if ( ulen ) + dup to /unpack-buf ( ulen ) + alloc-mem to unpack-buf ( ) + false ( false ) + else ( ulen ) + drop true ( true ) + then ( flag ) +; + : unpack-env ( adr len -- adr' len' ) \ Packed to binary + 2dup not-packed? if exit then ( adr len ) 0 to pntr bounds ?do ( ) - /pack-buf pntr u<= ?leave + /unpack-buf pntr u<= ?leave 1 i c@ dup h# fe = if ( 1 c ) 2drop 2 i 1+ c@ ( 2 n' ) dup h# 3f and >r ( 2 n' ) @@ -332,16 +356,16 @@ 6 rshift ( 2 index ) " "(00 fe ff ff)" drop + c@ ( 2 c' )
- pack-buf pntr ca+ ( 2 c' a ) - r@ /pack-buf pntr - min ( 2 c' a len ) + unpack-buf pntr ca+ ( 2 c' a ) + r@ /unpack-buf pntr - min ( 2 c' a len ) rot fill ( 2 ) r> pntr + to pntr ( 2 ) else ( 1 c ) - pack-buf pntr ca+ c! ( 1 ) + unpack-buf pntr ca+ c! ( 1 ) pntr 1+ to pntr ( 1 ) then ( step ) +loop ( ) - pack-buf pntr ( adr len ) + unpack-buf pntr ( adr len ) ;
: (cv-bytes@) ( apf -- adr len )