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: Allocating an LDT entry / calling a kernel function from user code



On Jun 20, 2005, at 12:06 PM, Gavriel State wrote:
I'm doing some experimental work on Darwin/x86 that involves a requirement to allocate an LDT (or GDT) entry and there appears to be a perfectly nice kernel function to do it:
thread_set_user_ldt(), in osfmk/i386/bsd_i386.c


Unfortunately, I don't see any kind of corresponding header in /usr/ include, so presumably this kernel function isn't accessible through libSystem - is there some way that I can call it directly from user code? If so, where can I find documentation and/or sample code for doing so?

I don't believe thread_set_user_ldt is exposed via any user-callable function. If you need this functionality via a supported API, I'd suggest filing a bug at <http://bugreport.apple.com/> or contacting DTS.


It looks like the function goes through the machdep call table defined in osfmk/i386/machdep_call.c, and there's an exported kernel symbol for this table - but again, the table doesn't appear to be accessible from libSystem, so I'm not sure how user code can access it. Also, is there any assurance that the machdep call table order will remain the same across different versions of darwin?

Absolutely none. There is no guarantee of compatibility at the syscall level between versions of Darwin.


If you want to try calling an unsupported machdep call, you can find examples of how to do it by looking for callers of the other functions defined in machdep_call.c. For example, the x86 implementation of pthread_set_self (in Libc) invokes the thread_fast_set_cthread_self call.

Alexei

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-x86 mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-x86/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.