1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 16:48:06 +11:00

De-stabilize EXIT

This marks the end of wordrefs in stable ABI. Nice.
This commit is contained in:
Virgil Dupras 2020-09-19 20:35:35 -04:00
parent 3aa681ceca
commit b1a95648f1
12 changed files with 17 additions and 46 deletions

View File

@ -1,7 +1,8 @@
: X:
(xentry) 1 ( compiled ) C,
BEGIN
WORD DUP LIT" ;" S= IF DROP 0x0b , EXIT THEN
WORD DUP LIT" ;" S= IF
DROP LIT" EXIT" XFIND , EXIT THEN
XCURRENT @ SWAP ( xcur w ) _find ( a f )
IF ( a )
DUP IMMED? IF ABORT THEN
@ -11,5 +12,4 @@
IF DUP IMMED? NOT IF ABORT THEN EXECUTE
ELSE (parse) XLITN THEN
THEN
AGAIN
;
AGAIN ;

View File

@ -9,8 +9,7 @@ is IP. SP points to PSP TOS, but you can still use the stack
in native code. you just have to make sure you've restored it
before "next".
STABLE ABI: The boot binary starts with a list of references.
The address of these references have to stay to those addr-
esses. The rest of the Collapse OS code depend on it. In fact,
up until 0x67, the (?br) wordref, pretty much everything has
to stay put. (cont.)
The boot binary is loaded in 2 parts. The first part, "decla-
rations", are loaded after xcomp, before xcomp overrides, with
"282 LOAD". The rest, after xcomp overrides, with "283 335
LOADR".

View File

@ -1,4 +0,0 @@
The boot binary is loaded in 2 parts. The first part, "decla-
rations", are loaded after xcomp, before xcomp overrides, with
"282 LOAD". The rest, after xcomp overrides, with "283 335
LOADR".

View File

@ -1,7 +1,7 @@
H@ ORG ! ( STABLE ABI )
0 JP, ( 00, main ) NOP, ( unused ) NOP, NOP, ( 04, BOOT )
NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused )
0 A, 0 JP, ( 0b, EXIT ) NOP, ( unused )
NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST )
NOP, NOP, NOP, NOP, NOP, NOP, ( unused )
0 JP, ( RST 10 ) NOP, NOP, ( 13, oflw )
NOP, NOP, NOP, NOP, NOP, ( unused )
0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused )

View File

@ -1,10 +1,5 @@
lblexec BSET L1 FSET ( B284 ) L2 FSET ( B286 )
( DE -> wordref )
( When we have a BIN( offset, we need to adjust stable
ABI offsets. )
BIN( @ [IF]
A XORr, D ORr, IFZ, D BIN( @ 256 / LDri, THEN,
[THEN]
LDA(DE), DE INCd,
A ORr, IFZ, EXDEHL, JP(HL), THEN,
A DECr, JRZ, L1 FWR ( compiled B289 )

View File

@ -4,7 +4,6 @@ CODE EXECUTE
lblexec @ JP,
CODE EXIT
PC ORG @ 0x0d + ! ( stable ABI JP )
C 0 IX+ LDrIXY,
B 1 IX+ LDrIXY,
IX DECd, IX DECd,

View File

@ -9,7 +9,7 @@
: _ ( : will get its name almost at the very end )
(entry) 1 ( compiled ) C,
BEGIN
WORD DUP LIT" ;" S= IF DROP 0x0b , EXIT THEN
WORD DUP LIT" ;" S= IF DROP COMPILE EXIT EXIT THEN
FIND IF ( is word ) DUP IMMED? IF EXECUTE ELSE , THEN
ELSE ( maybe number ) (parse) LITN THEN
AGAIN ;

View File

@ -3,7 +3,7 @@ H@ ORG !
JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno )
0 A,, ( 04, BOOT )
0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) 0 A,, ( unused )
JMPn, 0 A,, ( 0b, EXIT )
0 A, 0 A,, ( 0b, EXIT )
0 A,, 0 A,, ( unused ) 0 A,, ( 13, oflw )
0 A,, 0 A,, 0 A, ( unused )
JMPn, 0 A,, ( 1a, next )

View File

@ -2,7 +2,6 @@
CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn,
CODE EXIT
PC 0x0f - ORG @ 0x0d + ! ( stable abi )
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
;CODE

Binary file not shown.

View File

@ -11,9 +11,7 @@ CREATE BIN( 0 ,
270 LOAD ( xcomp overrides )
H@ ORG !
0x0b ALLOT0
0 C, 0 C, ( EXIT )
0x08 ALLOT0
0x15 ALLOT0
( END OF STABLE ABI )
H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
0x00 CODE EXIT

View File

@ -195,28 +195,13 @@ otherwise be difficult to access. Here's the complete list of
these references:
04 BOOT addr 06 (uflw) addr 08 LATEST
0b EXIT wordref 13 (oflw) addr 1a next addr
13 (oflw) addr 1a next addr
BOOT, (uflw) and (oflw) exist because they are referred to
before those words are defined (in core words). LATEST is a
critical part of the initialization sequence.
Stable wordrefs are there for more complicated reasons. When
cross-compiling Collapse OS, we use immediate words from the
host and some of them compile wordrefs (LITN compiles (n),
";" compiles EXIT). These compiled wordref need to be stable
across binaries, so they're part of the stable ABI.
Another layer of complexity is the fact that some binaries
don't begin at offset 0. In that case, the stable ABI doesn't
begin at 0 either. The EXECUTE word has a special handling of
those case where any wordref < 0x100 has the binary offset
applied to it.
But that's not the end of our problems. If an offsetted binary
cross compiles a binary with a different offset, stable ABI
references will be > 0x100 and be broken.
For this reason, any stable wordref compiled in the "hot zone"
(B397-B400) has to be compiled by direct offset reference to
avoid having any binary offset applied to it.
All Collapse OS binaries, regardless of architecture, have
those values at those offsets of them. Some binaries are built
to run at offset different than zero. This stable ABI lives at
that offset, not 0.