On Oct 4, 2012, at 3:30 PM, openbios-request@openbios.org wrote:

Message: 5
Date: Tue, 25 Sep 2012 16:03:20 +0200
From: Segher Boessenkool <segher@kernel.crashing.org>
To: The OpenBIOS Mailinglist <openbios@openbios.org>
Subject: Re: [OpenBIOS] [PATCH] Adds the get-time word to the
dictionary. Used to obtain the current time.
Message-ID: <21F2BBE0-1211-44F5-8C20-8148431F682A@kernel.crashing.org>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

: get-time
  " rtc" open-dev                   ( ihandle )
  ?dup 0= if
     cr abort" Sorry but no rtc node is present on this system"
  then                              ( ihandle )
r " get-time" r@ $call-method    ( <returned args - 6 of em?  
Yikes > )
  r> close-dev                      ( <returned args> )
;

: get-time
  s" rtc" s" get-time" execute-device-method
  0= ABORT" Sorry but no rtc node is present on this system" ;

(note that ABORT" takes a flag as input), but better is

: get-time
  s" rtc" s" get-time" execute-device-method
  0= IF fake-some-sort-of-plausible-time-1970-or-so THEN ;

which is pretty much what Apple's OF does.  execute-device-method
is not the same thing as open-dev followed by $call-method: it
does not call "open" in the instance for the device itself (you
only need that for devices that can have multiple clients at the
same time and need to keep state for each client; or when instead
you need to prevent concurrent access from multiple clients, by
having the second open fail).


Segher


I honestly see no reason to replace open-dev with execute-device-method. My original patch is just fine.