]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/user_ldt.h
xnu-792.17.14.tar.gz
[apple/xnu.git] / osfmk / i386 / user_ldt.h
index e11cd3072dadf06055a51a363154f894e42ee52d..4295d939efce46ac0367356c6cc817ffb79a880d 100644 (file)
@@ -1,23 +1,29 @@
 /*
  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
 /*
  * User LDT management.
  *
- * Each task may have its own LDT.
+ * Each thread in a task may have its own LDT.
  */
 
-#define        LDT_AUTO_ALLOC  0xffffffff
-
-#ifdef KERNEL
 #include <i386/seg.h>
 
 struct user_ldt {
-       unsigned int start;             /* first descriptor in table */
-       unsigned int count;             /* how many descriptors in table */
-       struct real_descriptor  ldt[0]; /* descriptor table (variable) */
+       struct real_descriptor  desc;   /* descriptor for self */
+       struct real_descriptor  ldt[1]; /* descriptor table (variable) */
 };
 typedef struct user_ldt *      user_ldt_t;
 
-extern user_ldt_t      user_ldt_copy(
-                       user_ldt_t      uldt);
+/*
+ * Check code/stack/data selector values against LDT if present.
+ */
+#define        S_CODE  0               /* code segment */
+#define        S_STACK 1               /* stack segment */
+#define        S_DATA  2               /* data segment */
+
+extern boolean_t selector_check(
+                       thread_t        thread,
+                       int             sel,
+                       int             type);
 extern void    user_ldt_free(
                        user_ldt_t      uldt);
-extern void    user_ldt_set(
-                       thread_t        thread);
-#else /* !KERNEL */
-#include <sys/cdefs.h>
-
-union ldt_entry;
-
-__BEGIN_DECLS
-int i386_get_ldt(int, union ldt_entry *, int);
-int i386_set_ldt(int, const union ldt_entry *, int);
-__END_DECLS
-#endif /* KERNEL */
 
 #endif /* _I386_USER_LDT_H_ */