[OpenBIOS] [PATCH] package.fs: don't reveal interposed packages

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Fri Sep 15 16:42:31 CEST 2017


The IEEE-1275 interpose specification suggests that interposed packages should
not be visible unless an interpose-aware Forth word is used.

Commit 247c6169 "Fix for interpose problem" realised this by converting the romvec
obp_inst2pkg() function over to use ihandle>non-interposed-phandle but didn't make
the same change to the equivalent CIF call instance-to-path (which is presumably
correct since the interpose specification also states that interposed packages are
only visible to a new instance-to-interposed-path CIF call).

Here we add a new instance-to-package word as a wrapper to
ihandle>non-interposed-phandle and update obp_inst2pkg() and instance-to-path to
use it accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 arch/sparc32/romvec.c   |    2 +-
 forth/device/package.fs |    4 ++++
 forth/system/ciface.fs  |    2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/sparc32/romvec.c b/arch/sparc32/romvec.c
index 8757c28..7a01035 100644
--- a/arch/sparc32/romvec.c
+++ b/arch/sparc32/romvec.c
@@ -372,7 +372,7 @@ int obp_inst2pkg(int dev_desc)
     int ret;
 
     PUSH(dev_desc);
-    fword("ihandle>non-interposed-phandle");
+    fword("instance-to-package");
     ret = POP();
 
     DPRINTF("obp_inst2pkg(fd 0x%x) = 0x%x\n", dev_desc, ret);
diff --git a/forth/device/package.fs b/forth/device/package.fs
index d5b52c3..3056c1d 100644
--- a/forth/device/package.fs
+++ b/forth/device/package.fs
@@ -32,6 +32,10 @@
   >in.device-node @
 ;
 
+: instance-to-package ( ihandle -- phandle )
+  dup 0<> if ihandle>non-interposed-phandle then
+;
+
 : ihandle>phandle ( ihandle -- phandle )
   >in.device-node @
 ;
diff --git a/forth/system/ciface.fs b/forth/system/ciface.fs
index 85a6076..9dc433c 100644
--- a/forth/system/ciface.fs
+++ b/forth/system/ciface.fs
@@ -159,7 +159,7 @@ external
 ;
 
 : instance-to-package ( ihandle -- phandle )
-  ?ihandle ihandle>phandle
+  ?ihandle instance-to-package
 ;
 
 : package-to-path ( buflen buf phandle -- length )
-- 
1.7.10.4




More information about the OpenBIOS mailing list