duskos

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

commit 65222488e5be30103d6bbbf39c2b680467417e0c
parent 54782dd02b6022301ee6a32b28e484d4e4ed0aff
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Mon, 24 Oct 2022 13:05:37 -0400

xcomp: move things around

Create the new xcomp/i386 directory and move i386.fs to it, as kernel.fs. Then,
move the whole "pc" directory into it. The idea is that xcomp will contain one
directory per architecture, which will then contain one directory per platform
supported in that architecture.

Diffstat:
Mbuildpc.fs | 4++--
Mbuildpctest.fs | 5+++--
Rfs/xcomp/i386.fs -> fs/xcomp/i386/kernel.fs | 0
Afs/xcomp/i386/pc/build.fs | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rfs/xcomp/pc/glue.fs -> fs/xcomp/i386/pc/glue.fs | 0
Rfs/xcomp/pc/init.fs -> fs/xcomp/i386/pc/init.fs | 0
Rfs/xcomp/pc/inittest.fs -> fs/xcomp/i386/pc/inittest.fs | 0
Rfs/xcomp/pc/kernel.fs -> fs/xcomp/i386/pc/kernel.fs | 0
Rfs/xcomp/pc/mbr.fs -> fs/xcomp/i386/pc/mbr.fs | 0
Dfs/xcomp/pc/build.fs | 60------------------------------------------------------------
10 files changed, 65 insertions(+), 64 deletions(-)

diff --git a/buildpc.fs b/buildpc.fs @@ -1,5 +1,5 @@ -f<< /xcomp/pc/build.fs +f<< /xcomp/i386/pc/build.fs S" pc.img" mountImage ( drv ) 1938 buildPC -S" /xcomp/pc/init.fs" S" /xcomp/init.fs" rot combineInit +S" /xcomp/i386/pc/init.fs" S" /xcomp/init.fs" rot combineInit bye diff --git a/buildpctest.fs b/buildpctest.fs @@ -1,5 +1,6 @@ -f<< /xcomp/pc/build.fs +f<< /xcomp/i386/pc/build.fs S" pctest.img" mountImage ( drv ) 1938 buildPC -S" /xcomp/pc/init.fs" S" /xcomp/pc/inittest.fs" rot combineInit +S" /xcomp/i386/pc/init.fs" +S" /xcomp/i386/pc/inittest.fs" rot combineInit bye diff --git a/fs/xcomp/i386.fs b/fs/xcomp/i386/kernel.fs diff --git a/fs/xcomp/i386/pc/build.fs b/fs/xcomp/i386/pc/build.fs @@ -0,0 +1,60 @@ +?f<< /fs/fat.fs +?f<< /xcomp/tools.fs + +." Compiling MBR" nl> +f<< /xcomp/i386/pc/mbr.fs +here org - value mbrlen +org value mbr + +." Compiling i386 kernel" nl> +f<< /xcomp/i386/kernel.fs +f<< /xcomp/i386/pc/kernel.fs +xbindict orgifydict +here org - value kernellen +org value kernel + +: createFAT ( drv clustercnt -- fat ) + \ We need to reserve (56) enough sectors for MBR + pc.bin + >r dup 16 ( rootentsec ) 56 ( rsvdsec ) 1 ( secperclus ) + r> FAT newFAT12 ( drv ) FAT :mountvolume ; + +: copyfs ( srcfs dstfs -- ) + 0 Path :new ( srcfs dstpath ) swap 0 Path :new Path :copydir ; + +$200 const SECSZ \ TODO: get from drive +create _buf SECSZ allot0 +1 value _sec +0 value _ptr +: rsvdflush ( drv -- ) + _sec _buf rot Drive :sec! 1 to+ _sec 0 to _ptr _buf SECSZ 0 fill ; +: rsvdwrite ( c drv -- ) + swap _buf _ptr + c! 1 to+ _ptr _ptr SECSZ = if rsvdflush else drop then ; + +: spitfile ( fpath drv -- ) >r + curpath :find# Path :open begin ( fc ) + begin dup IO :getc keepc? until + dup 0>= while r@ rsvdwrite repeat ( fc c ) + drop File :close rdrop ; + +: combineInit ( fname1 fname2 fat -- ) >r swap >r >r \ V1=fat V2=f1 V3=f2 + S" /init.fs" V1 0 Path :new Path :find# + V2 bootfs 0 Path :new Path :find# Path :copyfile + V3 bootfs 0 Path :new Path :find# + S" /init.fs" V1 0 Path :new Path :find# Path :appendfile + rfree ; + +: buildPC ( drv clustercnt -- fat ) over >r \ V1=drv + ." creating FAT and copying files" nl> + createFAT dup >r bootfs swap copyfs \ V2=fat + ." Putting MBR in place" nl> + 0 here V1 Drive :sec@ + mbr here $3e + mbrlen move + 0 here V1 Drive :sec! + ." Putting kernel in place" nl> + kernellen >r kernel begin c@+ V1 rsvdwrite next drop + S" /xcomp/bootlo.fs" V1 spitfile + S" /drv/pc/int13h.fs" V1 spitfile + S" /fs/fatlo.fs" V1 spitfile + S" /xcomp/i386/pc/glue.fs" V1 spitfile + S" /xcomp/boothi.fs" V1 spitfile + V1 rsvdflush r> rdrop ; diff --git a/fs/xcomp/pc/glue.fs b/fs/xcomp/i386/pc/glue.fs diff --git a/fs/xcomp/pc/init.fs b/fs/xcomp/i386/pc/init.fs diff --git a/fs/xcomp/pc/inittest.fs b/fs/xcomp/i386/pc/inittest.fs diff --git a/fs/xcomp/pc/kernel.fs b/fs/xcomp/i386/pc/kernel.fs diff --git a/fs/xcomp/pc/mbr.fs b/fs/xcomp/i386/pc/mbr.fs diff --git a/fs/xcomp/pc/build.fs b/fs/xcomp/pc/build.fs @@ -1,60 +0,0 @@ -?f<< /fs/fat.fs -?f<< /xcomp/tools.fs - -." Compiling MBR" nl> -f<< /xcomp/pc/mbr.fs -here org - value mbrlen -org value mbr - -." Compiling i386 kernel" nl> -f<< /xcomp/i386.fs -f<< /xcomp/pc/kernel.fs -xbindict orgifydict -here org - value kernellen -org value kernel - -: createFAT ( drv clustercnt -- fat ) - \ We need to reserve (56) enough sectors for MBR + pc.bin - >r dup 16 ( rootentsec ) 56 ( rsvdsec ) 1 ( secperclus ) - r> FAT newFAT12 ( drv ) FAT :mountvolume ; - -: copyfs ( srcfs dstfs -- ) - 0 Path :new ( srcfs dstpath ) swap 0 Path :new Path :copydir ; - -$200 const SECSZ \ TODO: get from drive -create _buf SECSZ allot0 -1 value _sec -0 value _ptr -: rsvdflush ( drv -- ) - _sec _buf rot Drive :sec! 1 to+ _sec 0 to _ptr _buf SECSZ 0 fill ; -: rsvdwrite ( c drv -- ) - swap _buf _ptr + c! 1 to+ _ptr _ptr SECSZ = if rsvdflush else drop then ; - -: spitfile ( fpath drv -- ) >r - curpath :find# Path :open begin ( fc ) - begin dup IO :getc keepc? until - dup 0>= while r@ rsvdwrite repeat ( fc c ) - drop File :close rdrop ; - -: combineInit ( fname1 fname2 fat -- ) >r swap >r >r \ V1=fat V2=f1 V3=f2 - S" /init.fs" V1 0 Path :new Path :find# - V2 bootfs 0 Path :new Path :find# Path :copyfile - V3 bootfs 0 Path :new Path :find# - S" /init.fs" V1 0 Path :new Path :find# Path :appendfile - rfree ; - -: buildPC ( drv clustercnt -- fat ) over >r \ V1=drv - ." creating FAT and copying files" nl> - createFAT dup >r bootfs swap copyfs \ V2=fat - ." Putting MBR in place" nl> - 0 here V1 Drive :sec@ - mbr here $3e + mbrlen move - 0 here V1 Drive :sec! - ." Putting kernel in place" nl> - kernellen >r kernel begin c@+ V1 rsvdwrite next drop - S" /xcomp/bootlo.fs" V1 spitfile - S" /drv/pc/int13h.fs" V1 spitfile - S" /fs/fatlo.fs" V1 spitfile - S" /xcomp/pc/glue.fs" V1 spitfile - S" /xcomp/boothi.fs" V1 spitfile - V1 rsvdflush r> rdrop ;