Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using unsupported exports from 8.0.0 and 8.1.0 kernels



Hi,

I work for one of the upgrade card companies and our KEXT requires 
access to a few of the in-kernel globals that no longer seem to be 
exported without linking directly against com.apple.kernel (they aren't 
even in com.apple.kpi.unsupported).  Specifically, we need access to the 
following globals:

_PerProcTable
_cpu_number
_real_ncpus (*)
_thread_bind
_thread_block_reason

(*) This isn't strictly necessary, we can use the hw.ncpu sysctl to get 
it.

Our software allows the user to enable or disable the various caches on 
the upgrade card as well as set up some other processor features.  For 
this reason, we need access to the PerProcTable entry for the current 
CPU (so we can modify the L2/L3 processor features).

We also ship dual-processor upgrades, so we need the _cpu_number and 
_real_ncpus globals to determine which CPU we are running on and how 
many CPUs there are in the system.

Finally, in order to enable/disable various features for a particular 
CPU, we need to make sure that the current thread is running on the 
desired CPU.  For this, we use the _thread_bind routine to bind the 
current thread to the target CPU and the _thread_block_reason to 
immediately block the current thread so that it gets swapped over to the 
target CPU as quickly as possible.

Currently, these globals are all exported from com.apple.kernel but 
nowhere else.  For 10.4, we simply linked against against version 8.0.0 
pof com.apple.kernel, but of course that broke when 10.4.1 was released 
this week and the kernel version was bumped to 8.1.0.  Unfortunately, 
these globals don't seem to be exported anywhere else (grepping for 
them in /System/Library/Extensions/ doesn't show them anywhere).

Our KEXT is loaded via a StartupItem (using kextload) at boot time, or 
when our application is first run (again using kextload).  If there was 
some kextload option that attempted to link the KEXT against the 
specified OSBundleLibraries without checking the library version, that 
would solve my problem (we have multiple versions of the KEXT and the 
StartupItem/application loads the appropriate one for the appropriate OS 
version), but I can't seem to find such an option.  Alternatively, in my 
KEXT's Info.plist file, I could specify the various com.apple.kernel 
versions that we can link against, but again I can't seem to find a way 
to specify more than one compatible library version.

The goal here is to not have to ship a new version of the KEXT every 
time a minor OS revision ships, and to not have to ship multiple KEXT 
versions for 10.4.x OS versions.  The source code between the 10.4 and 
10.4.1 KEXTs is identical, but I don't see any way to get a single KEXT 
to load on both OS versions due to the problematic com.apple.kernel 
dependency.

Anyone have any ideas?  Or any suggestions on how to use supported 
exported globals to do what I need to do?  Any help would be extremely 
gratefully appreciated!

Thanks,
TG
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.