Subject: Re: How does the asm interface to OF work? I need to enhance it
To: Derek Peschel <dpeschel@eskimo.com>
From: Andrew Cagney <cagney@mac.com>
List: port-macppc
Date: 01/04/2002 22:02:01
> OF_call_method takes an ihandle but I want to call a global word (not
> associated with any device). I used 0 but that might not work.
>
> My FIND functions don't work either but I wanted to get DEPTH and DROP
> working first.
>
> And the local university library has short hours (it's between quarters)
> so I can't go look at the standard until Monday. Grr. Maybe the public
> library has it, though.
You want 6.3.2.6 User Interface; ``inerpret''.
The interpret call takes:
IN: [string] cmd, stack-arg1, ..., stack-argP
OUT: catch-result, stack-result1, ..., stack-resultQ
P == NARGS - 1
Q == NRETURNS - 1
It pushes those arguments onto the stack and then interprets CMD from
within a ``catch''. At the end, it pops the stack items returning them
as results.
Looking in openfirm.c, something like:
static struct {
char *name;
int nargs;
int nreturns;
char *expr;
int ans;
} args = {
"interpret",
1,
1,
};
args.expr = "1 2 +"; // but in firmware space - careful
// see bug I've submitted about NBSD using space outside
// of OpenFirmware address space.
openfirmware(&args);
....
or wait until Monday.
enjoy,
Andrew