duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 924626e5631bfd7d24ca72823fb516fec8b117ac
parent 95ae86970da0e8d79149f0bdd44fb093be1bdff9
Author: binarycat <binarycat@envs.net>
Date:   Mon, 11 Jul 2022 10:56:02 -0400

add "bootfile" word

"bootfile" is a word that is serves multiple functions:
1. when a file is embedded in boot.fs, mark it as loaded
1A. making sure the file is not loaded again by ?f<<
1B. making the output of .floaded accurate
2. signal to the user that a file may be embedded in boot.fs
2A. and thus may be useful for bootstrapping
2B. and thus may have access to less words than normal
3. makes the file boundaries in boot.fs clear

Diffstat:
Mfs/drv/ramdrive.fs | 2++
Mfs/fs/fatlo.fs | 1+
Mfs/xcomp/boothi.fs | 1+
Mfs/xcomp/bootlo.fs | 3++-
Mfs/xcomp/glue1.fs | 2+-
Mfs/xcomp/glue2.fs | 2+-
6 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/drv/ramdrive.fs b/fs/drv/ramdrive.fs @@ -1,3 +1,4 @@ +bootfile drv/ramdrive.fs \ Drive in RAM \ This implements the "drive" protocol, which for now is undocumented, on top @@ -11,3 +12,4 @@ swap _addr swap ( src buf ) RAMDRVSECSZ move ; : ramdrv! ( blkno buf -- ) swap _addr ( buf dst ) RAMDRVSECSZ move ; + diff --git a/fs/fs/fatlo.fs b/fs/fs/fatlo.fs @@ -1,3 +1,4 @@ +bootfile fs/fatlo.fs \ The "low" part of a FAT12/FAT16 implementation \ This is a subset of a FAT12/FAT16 implementation. It is designed to be diff --git a/fs/xcomp/boothi.fs b/fs/xcomp/boothi.fs @@ -1,3 +1,4 @@ +bootfile xcomp/boothi.fs 0 value curfd \ file descriptor of the file currently being read 0 value fecho : f< ( -- c ) curfd fgetc fecho if dup emit then ; diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -104,10 +104,11 @@ alias else endof immediate 0 value floaded \ address of the current "loaded file" structure : floaded, ( fname -- ) floaded here to floaded , ( fname ) dup c@ 1+ move, ; - +: bootfile word to' in< @ ['] boot< = if floaded, else drop then ; \ doc comment placeholder alias \ \\ \ words for alias chaining : unaliases ' to' execute @ execute, ; immediate +bootfile xcomp/bootlo.fs diff --git a/fs/xcomp/glue1.fs b/fs/xcomp/glue1.fs @@ -1,5 +1,5 @@ +bootfile xcomp/glue1.fs \ Glue code between the storage driver and the FS handler -S" drv/ramdrive.fs" floaded, fatfs( to ramdrv( RAMDRVSECSZ const drvblksz alias ramdrv@ (drv@) diff --git a/fs/xcomp/glue2.fs b/fs/xcomp/glue2.fs @@ -1,5 +1,5 @@ +bootfile xcomp/glue2.fs \ Glue code that goes between the filesystem part and boothi -S" fs/fatlo.fs" floaded, alias fatopen fopen alias fatgetc fgetc alias fatclose fclose