[OpenBIOS] [PATCH 1/6] Make current CPU context available in Forth

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Oct 8 12:56:07 CEST 2016


Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 forth/debugging/client.fs |    6 ++++++
 libopenbios/init.c        |    4 ++++
 2 files changed, 10 insertions(+)

diff --git a/forth/debugging/client.fs b/forth/debugging/client.fs
index 853998c..c8cd5b6 100644
--- a/forth/debugging/client.fs
+++ b/forth/debugging/client.fs
@@ -1,5 +1,11 @@
 \ 7.6 Client Program Debugging command group
 
+\ Saved program state context
+variable __context
+0 __context !
+
+: saved-context __context @ @ ;
+
 
 \ 7.6.1    Registers display
 
diff --git a/libopenbios/init.c b/libopenbios/init.c
index 9b81821..8882bf3 100644
--- a/libopenbios/init.c
+++ b/libopenbios/init.c
@@ -22,6 +22,10 @@
 void
 openbios_init( void )
 {
+	// Bind the saved program state context into Forth
+	PUSH(pointer2cell((void *)&__context));
+	feval("['] __context cell+ !");
+
 	// Bind the C implementation of (init-program) into Forth
 	bind_func("(init-program)", init_program);
 	
-- 
1.7.10.4




More information about the OpenBIOS mailing list