Mailing Lists: Apple Mailing Lists

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

Re: Finding symbols in loaded kexts



At 10:15 -0700 6/8/07, Michael Smith wrote:
On Aug 6, 2007, at 9:58 AM, Andrew Gallatin wrote:
If the symbol is not global, but still present, would it work to call
it via a function pointer initialized to the correct address?  Eg,
does the "global" property mean anything once the module is relocated?

All that "global" means is that it's available to modules linking with it, in this context.

Actually... you have to be careful about this, at least on Intel 32-bit, at least in user space. If you declare a function to be "static", the compiler knows all of the callers and is free to adjust the parameter passing to its own ends. I've seen this happen on Intel 32-bit, where the compiler decides to ignore the standard calling conventions and pass some parameters in registers. Calling such a function via a function pointer (or, indeed, from GDB, which is how I tripped over this) is a way to a dusty (and confusing) death.


S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-kernel/email@hidden

This email sent to email@hidden
References: 
 >Finding symbols in loaded kexts (From: Ryan Govostes <email@hidden>)
 >Re: Finding symbols in loaded kexts (From: Dean Reece <email@hidden>)
 >Re: Finding symbols in loaded kexts (From: Andrew Gallatin <email@hidden>)
 >Re: Finding symbols in loaded kexts (From: Michael Smith <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.