]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/task.h
xnu-517.9.5.tar.gz
[apple/xnu.git] / osfmk / kern / task.h
index 569fa0292de3da70c04e9cabe7ce0fad392a827c..3e4c87b3cdfae4b6eccbfca4cb1ee83fd21a8460 100644 (file)
 #include <mach/mach_types.h>
 #include <vm/pmap.h>
 
 #include <mach/mach_types.h>
 #include <vm/pmap.h>
 
-#ifdef MACH_KERNEL_PRIVATE
+#ifdef __APPLE_API_PRIVATE
+
+#ifdef MACH_KERNEL_PRIVATE
+
 #include <mach/boolean.h>
 #include <mach/port.h>
 #include <mach/time_value.h>
 #include <mach/boolean.h>
 #include <mach/port.h>
 #include <mach/time_value.h>
@@ -107,7 +110,6 @@ typedef struct task {
        decl_mutex_data(,lock)          /* Task's lock */
        int             ref_count;      /* Number of references to me */
        boolean_t       active;         /* Task has not been terminated */
        decl_mutex_data(,lock)          /* Task's lock */
        int             ref_count;      /* Number of references to me */
        boolean_t       active;         /* Task has not been terminated */
-       boolean_t       kernel_loaded;  /* Created with kernel_task_create() */
 
        /* Miscellaneous */
        vm_map_t        map;            /* Address space description */
 
        /* Miscellaneous */
        vm_map_t        map;            /* Address space description */
@@ -127,11 +129,11 @@ typedef struct task {
        queue_chain_t   swapped_tasks;  /* list of non-resident tasks */
 #endif /* TASK_SWAPPER */
 
        queue_chain_t   swapped_tasks;  /* list of non-resident tasks */
 #endif /* TASK_SWAPPER */
 
-       /* Activations in this task */
-       queue_head_t    thr_acts;       /* list of thread_activations */
-       int             thr_act_count;
-       int             res_act_count;
-       int             active_act_count; /* have not terminate_self yet */
+       /* Threads in this task */
+       queue_head_t    threads;
+       int                             thread_count;
+       int                             res_thread_count;
+       int                             active_thread_count;
 
        processor_set_t processor_set;  /* processor set for new threads */
 #if    MACH_HOST
 
        processor_set_t processor_set;  /* processor set for new threads */
 #if    MACH_HOST
@@ -147,8 +149,9 @@ typedef struct task {
        integer_t               priority;                       /* base priority for threads */
        integer_t               max_priority;           /* maximum priority for threads */
 
        integer_t               priority;                       /* base priority for threads */
        integer_t               max_priority;           /* maximum priority for threads */
 
-       /* Task security token */
+       /* Task security and audit tokens */
        security_token_t sec_token;
        security_token_t sec_token;
+       audit_token_t   audit_token;
         
        /* Statistics */
        time_value_t    total_user_time;        /* user time for dead threads */
         
        /* Statistics */
        time_value_t    total_user_time;        /* user time for dead threads */
@@ -172,10 +175,6 @@ typedef struct task {
 
        struct ipc_space *itk_space;
 
 
        struct ipc_space *itk_space;
 
-       /* RPC subsystem information */
-       queue_head_t    subsystem_list; /* list of subsystems */
-       int             subsystem_count;/* number of subsystems */
-
        /* Synchronizer ownership information */
        queue_head_t    semaphore_list;         /* list of owned semaphores   */
        queue_head_t    lock_set_list;          /* list of owned lock sets    */
        /* Synchronizer ownership information */
        queue_head_t    semaphore_list;         /* list of owned semaphores   */
        queue_head_t    lock_set_list;          /* list of owned lock sets    */
@@ -188,6 +187,7 @@ typedef struct task {
         /* Ledgers */
        struct ipc_port *wired_ledger_port;
        struct ipc_port *paged_ledger_port;
         /* Ledgers */
        struct ipc_port *wired_ledger_port;
        struct ipc_port *paged_ledger_port;
+       unsigned long   priv_flags;     /* privelege resource flags */
         
 #if    NORMA_TASK
        long            child_node;     /* if != -1, node for new children */
         
 #if    NORMA_TASK
        long            child_node;     /* if != -1, node for new children */
@@ -210,9 +210,11 @@ typedef struct task {
 #endif  
        vm_offset_t     system_shared_region;
        vm_offset_t     dynamic_working_set;
 #endif  
        vm_offset_t     system_shared_region;
        vm_offset_t     dynamic_working_set;
+       uint32_t taskFeatures[2];               /* Special feature for this task */
+#define tf64BitAddr    0x80000000              /* Task has 64-bit addressing */
+#define tf64BitData    0x40000000              /* Task has 64-bit data registers */
 } Task;
 
 } Task;
 
-
 #define task_lock(task)                mutex_lock(&(task)->lock)
 #define task_lock_try(task)    mutex_try(&(task)->lock)
 #define task_unlock(task)      mutex_unlock(&(task)->lock)
 #define task_lock(task)                mutex_lock(&(task)->lock)
 #define task_lock_try(task)    mutex_try(&(task)->lock)
 #define task_unlock(task)      mutex_unlock(&(task)->lock)
@@ -222,42 +224,37 @@ typedef struct task {
 #define        itk_lock(task)          mutex_lock(&(task)->itk_lock_data)
 #define        itk_unlock(task)        mutex_unlock(&(task)->itk_lock_data)
 
 #define        itk_lock(task)          mutex_lock(&(task)->itk_lock_data)
 #define        itk_unlock(task)        mutex_unlock(&(task)->itk_lock_data)
 
+#define task_reference_locked(task) ((task)->ref_count++)
+
+/*
+ *   priv_flags definitions
+ */
+#define VM_BACKING_STORE_PRIV  0x1
+
 /*
  *     Internal only routines
  */
 
 /*
  *     Internal only routines
  */
 
+extern void task_backing_store_privileged(
+                               task_t task);
+
 /* Initialize task module */
 extern void            task_init(void);
 
 /* task create */
 /* Initialize task module */
 extern void            task_init(void);
 
 /* task create */
-extern kern_return_t   task_create_local(
+extern kern_return_t   task_create_internal(
                                task_t          parent_task,
                                boolean_t       inherit_memory,
                                task_t          parent_task,
                                boolean_t       inherit_memory,
-                               boolean_t       kernel_loaded,
                                task_t          *child_task);   /* OUT */
 
                                task_t          *child_task);   /* OUT */
 
-#if    MACH_HOST
-/* Freeze and unfreeze task from being reassigned processor sets */
-extern void            task_freeze(
-                               task_t          task);
-
-extern void            task_unfreeze(
-                               task_t          task);
-#endif /* MACH_HOST */
-
 extern void            consider_task_collect(void);
 
 #define        current_task_fast()     (current_act_fast()->task)
 #define current_task()         current_task_fast()
 
 extern void            consider_task_collect(void);
 
 #define        current_task_fast()     (current_act_fast()->task)
 #define current_task()         current_task_fast()
 
-#else /* !MACH_KERNEL_PRIVATE */
-
-extern task_t current_task(void);
-
-#endif /* !MACH_KERNEL_PRIVATE */
+#endif /* MACH_KERNEL_PRIVATE */
 
 extern task_t          kernel_task;
 
 extern task_t          kernel_task;
-extern boolean_t       is_kerneltask(task_t);
 
 /* Temporarily hold all threads in a task */
 extern kern_return_t   task_hold(
 
 /* Temporarily hold all threads in a task */
 extern kern_return_t   task_hold(
@@ -271,15 +268,6 @@ extern kern_return_t       task_release(
 extern kern_return_t   task_halt(
                                task_t  task);
 
 extern kern_return_t   task_halt(
                                task_t  task);
 
-/* Take reference on task (make sure it doesn't go away) */
-extern void            task_reference(task_t   task);
-
-/* Try to take a reference on task, return false if it would block */
-extern boolean_t       task_reference_try(task_t task);
-
-/* Remove reference to task */
-extern void            task_deallocate(task_t  task);
-
 #if defined(MACH_KERNEL_PRIVATE) || defined(BSD_BUILD)
 extern kern_return_t   task_importance(
                                                        task_t                  task,
 #if defined(MACH_KERNEL_PRIVATE) || defined(BSD_BUILD)
 extern kern_return_t   task_importance(
                                                        task_t                  task,
@@ -292,4 +280,21 @@ extern void        set_bsdtask_info(task_t,void *);
 extern vm_map_t get_task_map(task_t);
 extern vm_map_t        swap_task_map(task_t, vm_map_t);
 extern pmap_t  get_task_pmap(task_t);
 extern vm_map_t get_task_map(task_t);
 extern vm_map_t        swap_task_map(task_t, vm_map_t);
 extern pmap_t  get_task_pmap(task_t);
+
+extern boolean_t       task_reference_try(task_t task);
+
+#endif /* __APPLE_API_PRIVATE */
+
+#if            !defined(MACH_KERNEL_PRIVATE)
+
+extern task_t  current_task(void);
+
+#endif /* MACH_KERNEL_TASK */
+
+/* Take reference on task (make sure it doesn't go away) */
+extern void            task_reference(task_t   task);
+
+/* Remove reference to task */
+extern void            task_deallocate(task_t  task);
+
 #endif /* _KERN_TASK_H_ */
 #endif /* _KERN_TASK_H_ */