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@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 )
Hi Mark,
On Fri, Sep 15, 2017 at 03:42:31PM +0100, Mark Cave-Ayland wrote:
+: instance-to-package ( ihandle -- phandle )
- dup 0<> if ihandle>non-interposed-phandle then
+;
"0<> if" is the same as just "if".
Segher
On 16/09/17 07:10, Segher Boessenkool wrote:
Hi Mark,
On Fri, Sep 15, 2017 at 03:42:31PM +0100, Mark Cave-Ayland wrote:
+: instance-to-package ( ihandle -- phandle )
- dup 0<> if ihandle>non-interposed-phandle then
+;
"0<> if" is the same as just "if".
Thanks Segher. I'll wait for any further comments, and if yours is the only feedback then I'll just touch it up on commit.
ATB,
Mark.
Hi!
On Sat, Sep 16, 2017 at 05:50:04PM +0100, Mark Cave-Ayland wrote:
On 16/09/17 07:10, Segher Boessenkool wrote:
On Fri, Sep 15, 2017 at 03:42:31PM +0100, Mark Cave-Ayland wrote:
+: instance-to-package ( ihandle -- phandle )
- dup 0<> if ihandle>non-interposed-phandle then
+;
"0<> if" is the same as just "if".
Thanks Segher. I'll wait for any further comments, and if yours is the only feedback then I'll just touch it up on commit.
The rest looks fine to me btw, but I don't know this code well.
Segher
On 16/09/17 17:50, Mark Cave-Ayland wrote:
On 16/09/17 07:10, Segher Boessenkool wrote:
Hi Mark,
On Fri, Sep 15, 2017 at 03:42:31PM +0100, Mark Cave-Ayland wrote:
+: instance-to-package ( ihandle -- phandle )
- dup 0<> if ihandle>non-interposed-phandle then
+;
"0<> if" is the same as just "if".
Thanks Segher. I'll wait for any further comments, and if yours is the only feedback then I'll just touch it up on commit.
Pushed to master, along with Segher's suggested modification.
ATB,
Mark.