Subject: Re: How does the asm interface to OF work? I need to enhance it
To: None <port-macppc@netbsd.org>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: port-macppc
Date: 12/28/2001 11:36:50
--fOHHtNG4YXGJ0yqR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Dec 28, 2001 at 08:22:43AM -0800, Derek Peschel wrote:
> Yes, but if I want the @@#$%!@ keyboard detection code to work right,
> it has to be fixed.

Oh yes, of course. And I agree that should happen. I meant the
"knowing how many return values you'll have ahead of time" part
being hard to fix. (It's not like you can just pull some printf()
stunt here, you're not going to get return values, you're going to
get a bunch of stuff pushed onto a stack with no clear delineation
of where your data ends and someone else's begins.)

> Expecting one value instead of two should work (I have to think about
> it though).  When I said "call openfirmware() again to pop..." I meant
> that I'd use the C interface to call DROP, which would call openfirmware()
> as a side effect.  My point was	that you go through openfirmware()
> twice, rather than once as in my first idea.

Okay, I pretty clearly need to look at machdep.c, since I don't have
a very good conception of its structure (I've only ever looked at
specific blocks that other people have pointed to). But...

What's the problem, really, with going through openfirmware() more
than once? I mean, we already do that quite a bit in machdep.c, do
we not? Sure, we usually only call it once per command, but if it's
a workable and not-that-ugly hack to make this problem go away, hey,
what the hell, right?

> The only problem with dropping the second value is that it might be usefu=
l.
> It's the address of the method.  Of course if I call my function
> OF_does_method_exist rather than OF_address_of_method, I don't have to
> worry about returning the second value!

Is there no "read the top of the stack and then pop" command
floating around? That's what you really want, I think.

(Though, yes, clever naming conventions wouldn't hurt, and I don't
think we need the device's address in this case, since the
appropriate -kbd-ihandle[s] command is what we use to get the
address.)

> I meant "Hope that the OF interface routines always clear the stack
> between calls", not "Trust every single piece of code in the system
> except mine to clear the stack." :)

Fair enough. I still don't know that that's something you want to
trust. ;^>

> P.S.  Please don't Cc: me, since it only creates twice as much mail.

Whoops, sorry, that's actually a bad habit I'm trying to kick.

(This time, it happened because all of my email is coming to my
inbox rather than procmailed properly. Usually, that means that
something came to me privately and in a mailing list. Right now, it
just means that there's no power for my primary MX and I'm not in
town to fix it. :^>)

--=20
gabriel rosenkoetter
gr@eclipsed.net

--fOHHtNG4YXGJ0yqR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjwsn6IACgkQ9ehacAz5CRobbQCeLXP7Vh3ZmaWn2CCv4sATSiGM
b2gAn20XVdGF9FpA00G4S9tQ4B7Qfc6K
=5/YX
-----END PGP SIGNATURE-----

--fOHHtNG4YXGJ0yqR--