📄 unifiedkernel-0.2.0-k2.6.13.diff
字号:
+{+ unsigned long flags;+ long handle_count;+ struct handle_table_entry*** table;+ struct eprocss* quota_process;+ void* unique_processid;+ long first_free_table_entry;+ long next_index_needing_pool;+ struct eresource handle_table_lock;+ struct list_head handle_table_list;+ struct kevent handle_contention_event;+};++struct ex_fast_ref+{+ union+ {+ void* object;+ unsigned long ref_cnt:3;+ unsigned long value;+ };+};+++struct kgate+{+ struct dispatcher_header header;+};++struct kguarded_mutex+{+ long count;+ struct kthread* owner;+ unsigned long contention;+ struct kgate gate;+ union {+ struct {+ short kernel_apc_disable;+ short special_apc_disable;+ };+ unsigned long combined_apc_disable;+ };+};++struct mmaddress_node+{+ union+ {+ unsigned long balance:2;+ struct mmaddress_node* parent;+ } u1;+ struct mmaddress_node* left_child;+ struct mmaddress_node* right_child;+ unsigned long starting_vpn;+ unsigned long ending_vpn;+};++struct mm_avl_table+{+ struct mmaddress_node balanced_root;+ unsigned long depth_of_tree:5;+ unsigned long unused:3;+ unsigned long number_generic_table_elements:24;+ void* node_hint;+ void* node_free_hint;+};++struct eprocess_quota_entry+{+ unsigned long usage;+ unsigned long limit;+ unsigned long peak;+ unsigned long return_val;+};++struct eprocess_quota_block+{+ struct eprocess_quota_entry quota_entry[3];+ struct list_head quota_list;+ unsigned long reference_count;+ unsigned long process_tount;+};++struct proc_ws_watch_info+{+ void* faulting_pc;+ void* faulting_va;+};++struct pagefault_history+{+ unsigned long current_index;+ unsigned long map_index;+ spinlock_t spinlock;+ void* reserved;+ struct proc_ws_watch_info watch_info[1];+};++struct hardware_pte_x86+{+ unsigned long valid : 1;+ unsigned long write : 1;+ unsigned long owner : 1;+ unsigned long write_through : 1;+ unsigned long cache_disable : 1;+ unsigned long accessed : 1;+ unsigned long dirty : 1;+ unsigned long large_page : 1;+ unsigned long global : 1;+ unsigned long copy_on_write : 1;+ unsigned long prototype : 1;+ unsigned long reserved : 1;+ unsigned long page_frame_number : 20;+};+struct unicode_string+{+ unsigned short length;+ unsigned short max_ength;+ wchar_t* buffer;+};++struct object_name_info+{+ struct unicode_string name;+};++struct se_audit_proc_creation_info+{+ struct object_name_info* image_filename;+};++typedef void* fast_mutex_t;++struct maddress_space+{+ void* memory_area_root;+ fast_mutex_t lock;+ void* lowest_address;+ struct eprocess* process;+ unsigned short* pt_ref_count_table;+ unsigned long pt_ref_count_table_size;+};++struct kdpc;+typedef void+(__stdcall *kdeferred_routine_t)(struct kdpc *dpc, void* deferred_context, + void* system_argument1,void* system_argument2);++struct kdpc {+ short type;+ unsigned char number;+ unsigned char importance;+ struct list_head dpc_list_entry;+ kdeferred_routine_t deferred_routine;+ void* deferred_context;+ void* system_argument1;+ void* system_argument2;+ void* dpc_data;+}; ++#endif /* _WINTERNL_H_ */diff -Nur linux-2.6.13.ori/init/Kconfig linux-2.6.13/init/Kconfig--- linux-2.6.13.ori/init/Kconfig 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/init/Kconfig 2006-12-29 15:12:11.000000000 +0000@@ -380,6 +380,10 @@ no dummy operations need be executed. Zero means use compiler's default. +config UNIFIED_KERNEL+ bool "Unified kernel support"+ default 0+ endmenu # General setup config TINY_SHMEMdiff -Nur linux-2.6.13.ori/kernel/auditsc.c linux-2.6.13/kernel/auditsc.c--- linux-2.6.13.ori/kernel/auditsc.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/kernel/auditsc.c 2006-12-29 15:12:11.000000000 +0000@@ -628,6 +628,35 @@ return 0; } +#ifdef CONFIG_UNIFIED_KERNEL+int audit_alloc_from_task(task_t *ptsk, task_t *tsk)+{+ struct audit_context *context;+ enum audit_state state;++ if (likely(!audit_enabled))+ return 0; /* Return if not auditing. */++ state = audit_filter_task(tsk);+ if (likely(state == AUDIT_DISABLED))+ return 0;++ if (!(context = audit_alloc_context(state))) {+ audit_log_lost("out of memory in audit_alloc");+ return -ENOMEM;+ }++ /* Preserve login uid */+ context->loginuid = -1;+ if (ptsk->audit_context)+ context->loginuid = ptsk->audit_context->loginuid;++ tsk->audit_context = context;+ set_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT);+ return 0;+}+#endif+ static inline void audit_free_context(struct audit_context *context) { struct audit_context *previous;diff -Nur linux-2.6.13.ori/kernel/exit.c linux-2.6.13/kernel/exit.c--- linux-2.6.13.ori/kernel/exit.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/kernel/exit.c 2006-12-29 15:12:11.000000000 +0000@@ -34,6 +34,10 @@ #include <asm/pgtable.h> #include <asm/mmu_context.h> +#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/win32_thread.h>+#endif+ extern void sem_exit (void); extern struct task_struct *child_reaper; @@ -762,6 +766,10 @@ write_unlock_irq(&tasklist_lock); +#ifdef CONFIG_UNIFIED_KERNEL+ ethread_notify_exit(tsk, tsk->exit_code);+ exit_ethread(tsk);+#endif list_for_each_safe(_p, _n, &ptrace_dead) { list_del_init(_p); t = list_entry(_p,struct task_struct,ptrace_list);@@ -866,6 +874,92 @@ EXPORT_SYMBOL_GPL(do_exit); +#ifdef CONFIG_UNIFIED_KERNEL+extern void exit_io_context_for_task(task_t *tsk);+extern void exit_thread_for_task(task_t *tsk);+fastcall void do_exit_task(task_t *tsk, long code)+{+ int group_dead;++ profile_task_exit(tsk);++ WARN_ON(atomic_read(&tsk->fs_excl));++ if (unlikely(in_interrupt()))+ panic("Aiee, killing interrupt handler!");+ if (unlikely(!tsk->pid))+ panic("Attempted to kill the idle task!");+ if (unlikely(tsk->pid == 1))+ panic("Attempted to kill init!");+ if (tsk->io_context)+ exit_io_context_for_task(tsk);++ /*+ * We're taking recursive faults here in do_exit. Safest is to just+ * leave this task alone and wait for reboot.+ call before do_exit_task()+ if (unlikely(tsk->flags & PF_EXITING)) {+ printk(KERN_ALERT+ "Fixing recursive fault but reboot is needed!\n");+ set_mb(tsk->state, TASK_UNINTERRUPTIBLE);+ schedule();+ }+ */++ tsk->flags |= PF_EXITING;++ /*+ * Make sure we don't try to process any timer firings+ * while we are already exiting.+ */+ tsk->it_virt_expires = cputime_zero;+ tsk->it_prof_expires = cputime_zero;+ tsk->it_sched_expires = 0;++#if 0+ if (unlikely(in_atomic()))+ printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",+ tsk->comm, tsk->pid,+ preempt_count());+#endif++ acct_update_integrals(tsk);+ update_mem_hiwater(tsk);+ group_dead = atomic_dec_and_test(&tsk->signal->live);+ if (group_dead) {+ del_timer_sync(&tsk->signal->real_timer);+// acct_process(code);+ }+ exit_mm(tsk);++ exit_sem(tsk);+ __exit_files(tsk);+ __exit_fs(tsk);+ exit_namespace(tsk);+ exit_thread_for_task(tsk);+ cpuset_exit(tsk);+ exit_keys(tsk);++#if 0+ if (group_dead && tsk->signal->leader)+ disassociate_ctty(1);+#endif++ module_put(tsk->thread_info->exec_domain->module);+ if (tsk->binfmt)+ module_put(tsk->binfmt->module);++ tsk->exit_code = code;+ exit_notify(tsk);+#ifdef CONFIG_NUMA+ mpol_free(tsk->mempolicy);+ tsk->mempolicy = NULL;+#endif+}++EXPORT_SYMBOL(do_exit_task);+#endif+ NORET_TYPE void complete_and_exit(struct completion *comp, long code) { if (comp)diff -Nur linux-2.6.13.ori/kernel/fork.c linux-2.6.13/kernel/fork.c--- linux-2.6.13.ori/kernel/fork.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/kernel/fork.c 2006-12-29 15:12:11.000000000 +0000@@ -49,6 +49,10 @@ #include <asm/cacheflush.h> #include <asm/tlbflush.h> +#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/win32_thread.h>+#endif+ /* * Protected counters by write_lock_irq(&tasklist_lock) */@@ -917,7 +921,11 @@ INIT_LIST_HEAD(&p->children); INIT_LIST_HEAD(&p->sibling); p->vfork_done = NULL;+#ifdef CONFIG_UNIFIED_KERNEL+ rwlock_init(&p->alloc_lock);+#else spin_lock_init(&p->alloc_lock);+#endif spin_lock_init(&p->proc_lock); clear_tsk_thread_flag(p, TIF_SIGPENDING);@@ -1005,6 +1013,11 @@ p->pdeath_signal = 0; p->exit_state = 0; +#ifdef CONFIG_UNIFIED_KERNEL+ p->ethread= NULL;+ ethread_notify_fork(current, p, clone_flags);+#endif+ /* * Ok, make it visible to the rest of the system. * We dont wake it up yet.@@ -1285,3 +1298,616 @@ sizeof(struct mm_struct), 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); }++#ifdef CONFIG_UNIFIED_KERNEL+/* FIXME: added for NtCreateProcess() and NtCreateThread() */++extern int audit_alloc_from_task(task_t *ptsk, task_t *tsk);+extern int init_new_context_from_task(task_t *ptsk, task_t *tsk, struct mm_struct *mm);++static inline void clone_files(task_t *tsk)+{+ if (tsk->files)+ atomic_inc(&tsk->files->count);+}++static inline void clone_fs(task_t *tsk)+{+ atomic_inc(&tsk->fs->count);+}++static inline void clone_sighand(task_t *tsk)+{+ atomic_inc(&tsk->sighand->count);+}++static inline void clone_signal(task_t *tsk)+{+ atomic_inc(&tsk->signal->count);+ atomic_inc(&tsk->signal->live);+}++static inline int clone_mm(task_t *parent, task_t *child)+{+ struct mm_struct *mm, *oldmm;++ child->min_flt = child->maj_flt = 0;+ child->nvcsw = child->nivcsw = 0;++ child->mm = NULL;+ child->active_mm = NULL;++ oldmm = parent->mm;+ if (!oldmm)+ return 0;++ atomic_inc(&oldmm->mm_users);+ mm = oldmm;+ /*+ * There are cases where the PTL is held to ensure no+ * new threads start up in user mode using an mm, which+ * allows optimizing out ipis; the tlb_gather_mmu code+ * is an example.+ */+ spin_unlock_wait(&oldmm->page_table_lock);++ child->mm = mm;+ child->active_mm = mm;++ return 0;+}++static inline int create_files(task_t *tsk)+{+ struct files_struct *newf;++ newf = kmem_cache_alloc(files_cachep, SLAB_KERNEL);+ if (!newf) + return -ENOMEM;++ atomic_set(&newf->count, 1);++ spin_lock_init(&newf->file_lock);+ newf->next_fd = 0;+ newf->max_fds = NR_OPEN_DEFAULT;+ newf->max_fdset = __FD_SETSIZE;+ newf->close_on_exec = &newf->close_on_exec_init;+ newf->open_fds = &newf->open_fds_init;+ newf->fd = &newf->fd_array[0];+ memset(newf->close_on_exec, 0, sizeof(newf->close_on_exec_init));+ memset(newf->open_fds, 0, sizeof(newf->open_fds_init));+ memset(newf->fd_array, 0, sizeof(newf->fd_array));++ tsk->files = newf;+ return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -