[Openmcl-devel] How to check for a G5?y
Gary Byers
gb at clozure.com
Tue Apr 12 04:54:12 PDT 2005
On Tue, 12 Apr 2005, Tord Kallqvist Romstad wrote:
> Hi!
>
> A simple question:
>
> Is there an easy way for an OpenMCL program to determine at runtime
> whether it is running on a G5 or not?
>
> --
> Tord Romstad
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>
Apple suggests using Mach's #_host_info function; I think that you can also
do this with #_sysctl.
A translation of the example code in
<http://developer.apple.com/technotes/tn/tn2086.html#checkforG5>
int OpenMCL's FFI might look something like:
#+darwin-target
(defun mach-machine-type ()
(rlet ((host-info :host_basic_info)
(info-count :mach_msg_type_number_t #$HOST_BASIC_INFO_COUNT))
(#_host_info (#_mach_host_self) #$HOST_BASIC_INFO host-info info-count)
;; This is assuming that the cpu_type = #$CPU_TYPE_POWERPC
(pref host-info :host_basic_info.cpu_subtype)))
;;; On an iBook G4:
? (mach-machine-type)
11 ; 11 = #$CPU_SUBTYPE_POWERPC_7450
A G5 would presumably return #$CPU_SUBTYPE_POWERPC_970 (= 100).
More information about the Openmcl-devel
mailing list