commit a4780d9d43d429546eab41517da68d937bda1ada
parent f5c9b4328e6102f609a5447c3da42d297463eb28
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Tue, 26 Jul 2022 20:06:32 -0400
pc: make "bye" shutdown QEMU
Diffstat:
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/fs/drv/pc/acpi.fs b/fs/drv/pc/acpi.fs
@@ -0,0 +1,4 @@
+\ ACPI driver
+
+\ For now, it's just a place to send a hardcoded shutdown for QEMU...
+: bye $2000 $604 pw! ;
diff --git a/fs/xcomp/i386.fs b/fs/xcomp/i386.fs
@@ -30,8 +30,6 @@ $7c00 const PSTOP
here to org
forward16 jmp, to L1
-xcode bye 0 jmp,
-
xcode noop pc to lblret ret,
pc to lbltoptr 0 ,
@@ -384,18 +382,42 @@ pc to lblwrite \ eax=n
lblhere m) CELLSZ i) add,
ret,
-xcode pc@ ( port -- n )
+xcode pc@ ( port -- n8 )
dx [ebp] mov,
ax ax xor,
8b! in,
[ebp] ax mov,
ret,
-xcode pc! ( n port -- )
+xcode pc! ( n8 port -- )
DX AX pspop2,
8b! out,
ret,
+xcode pw@ ( port -- n16 )
+ dx [ebp] mov,
+ ax ax xor,
+ 16b! in,
+ [ebp] ax mov,
+ ret,
+
+xcode pw! ( n16 port -- )
+ DX AX pspop2,
+ 16b! out,
+ ret,
+
+xcode p@ ( port -- n32 )
+ dx [ebp] mov,
+ ax ax xor,
+ in,
+ [ebp] ax mov,
+ ret,
+
+xcode p! ( n32 port -- )
+ DX AX pspop2,
+ out,
+ ret,
+
xcode move ( src dst u -- )
CX pspop,
DI SI pspop2,
diff --git a/fs/xcomp/pc/init.fs b/fs/xcomp/pc/init.fs
@@ -3,6 +3,7 @@ herestart to here
0 S" sys" fchild S" file.fs" fchild fload
\ We now have f<<
f<< /sys/doc.fs
+f<< /drv/pc/acpi.fs
f<< /drv/pc/vid8025.fs
f<< /sys/grid.fs
' (emit) to emit