📄 unifiedkernel-0.2.0-k2.6.13.diff
字号:
diff -Nur linux-2.6.13.ori/arch/i386/kernel/i8259.c linux-2.6.13/arch/i386/kernel/i8259.c--- linux-2.6.13.ori/arch/i386/kernel/i8259.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/i8259.c 2006-12-29 15:12:11.000000000 +0000@@ -314,7 +314,11 @@ * outb_p - this has to work on a wide range of PC hardware. */ outb_p(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */+#ifndef CONFIG_UNIFIED_KERNEL outb_p(0x20 + 0, PIC_MASTER_IMR); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */+#else+ outb_p(0x30 + 0, PIC_MASTER_IMR); /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */ +#endif outb_p(1U << PIC_CASCADE_IR, PIC_MASTER_IMR); /* 8259A-1 (the master) has a slave on IR2 */ if (auto_eoi) /* master does Auto EOI */ outb_p(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR);@@ -322,7 +326,11 @@ outb_p(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR); outb_p(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */+#ifndef CONFIG_UNIFIED_KERNEL outb_p(0x20 + 8, PIC_SLAVE_IMR); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */+#else+ outb_p(0x30 + 8, PIC_SLAVE_IMR); /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */+#endif outb_p(PIC_CASCADE_IR, PIC_SLAVE_IMR); /* 8259A-2 is a slave on master's IR2 */ outb_p(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR); /* (slave's support for AEOI in flat mode is to be investigated) */ if (auto_eoi)diff -Nur linux-2.6.13.ori/arch/i386/kernel/ldt.c linux-2.6.13/arch/i386/kernel/ldt.c--- linux-2.6.13.ori/arch/i386/kernel/ldt.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/ldt.c 2006-12-29 15:12:11.000000000 +0000@@ -105,6 +105,24 @@ return retval; } +#ifdef CONFIG_UNIFIED_KERNEL+int init_new_context_from_task(task_t *ptsk, task_t *tsk, struct mm_struct *mm)+{+ struct mm_struct * old_mm;+ int retval = 0;++ init_MUTEX(&mm->context.sem);+ mm->context.size = 0;+ old_mm = ptsk->mm;+ if (old_mm && old_mm->context.size > 0) {+ down(&old_mm->context.sem);+ retval = copy_ldt(&mm->context, &old_mm->context);+ up(&old_mm->context.sem);+ }+ return retval;+}+#endif+ /* * No need to lock the MM as we are the last user */diff -Nur linux-2.6.13.ori/arch/i386/kernel/process.c linux-2.6.13/arch/i386/kernel/process.c--- linux-2.6.13.ori/arch/i386/kernel/process.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/process.c 2006-12-29 15:12:11.000000000 +0000@@ -401,6 +401,42 @@ } } +#ifdef CONFIG_UNIFIED_KERNEL+/*+ * Free current thread data structures etc..+ */+void exit_thread_for_task(task_t *tsk)+{+ struct thread_struct *t = &tsk->thread;++ /*+ * Remove function-return probe instances associated with this task+ * and put them back on the free list. Do not insert an exit probe for+ * this function, it will be disabled by kprobe_flush_task if you do.+ */+ kprobe_flush_task(tsk);++ /* The process may have allocated an io port bitmap... nuke it. */+ if (unlikely(NULL != t->io_bitmap_ptr)) {+ int cpu = get_cpu();+ struct tss_struct *tss = &per_cpu(init_tss, cpu);++ kfree(t->io_bitmap_ptr);+ t->io_bitmap_ptr = NULL;+ /*+ * Careful, clear this in the TSS too:+ */+ memset(tss->io_bitmap, 0xff, tss->io_bitmap_max);+ t->io_bitmap_max = 0;+ tss->io_bitmap_owner = NULL;+ tss->io_bitmap_max = 0;+ tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET;+ put_cpu();+ }+}+EXPORT_SYMBOL(exit_thread_for_task);+#endif+ void flush_thread(void) { struct task_struct *tsk = current;@@ -886,6 +922,44 @@ return 0; } +#ifdef CONFIG_UNIFIED_KERNEL+/*+ * Set a given TLS descriptor:+ */+asmlinkage int set_win_fs(struct user_desc *info)+{+ struct thread_struct *t = ¤t->thread;+ struct desc_struct *desc;+ int cpu, idx;++ idx = info->entry_number;++ if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)+ return -EINVAL;++ desc = t->tls_array + idx - GDT_ENTRY_TLS_MIN;++ /*+ * We must not get preempted while modifying the TLS.+ */+ cpu = get_cpu();++ if (LDT_empty(info)) {+ desc->a = 0;+ desc->b = 0;+ } else {+ desc->a = LDT_entry_a(info);+ desc->b = LDT_entry_b(info);+ }+ load_TLS(t, cpu);++ put_cpu();++ return 0;+}+EXPORT_SYMBOL(set_win_fs);+#endif+ /* * Get the current Thread-Local Storage area: */@@ -942,3 +1016,6 @@ sp -= get_random_int() % 8192; return sp & ~0xf; }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(arch_align_stack);+#endifdiff -Nur linux-2.6.13.ori/arch/i386/kernel/ptrace.c linux-2.6.13/arch/i386/kernel/ptrace.c--- linux-2.6.13.ori/arch/i386/kernel/ptrace.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/ptrace.c 2006-12-29 15:12:11.000000000 +0000@@ -5,6 +5,7 @@ * Gareth Hughes <gareth@valinux.com>, May 2000 */ +#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/mm.h>@@ -27,6 +28,10 @@ #include <asm/ldt.h> #include <asm/desc.h> +#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/module.h>+#endif+ /* * does not yet catch signals sent when the child dies. * in exit.c or in signal.c.@@ -715,3 +720,6 @@ regs->ebx, regs->ecx, regs->edx, regs->esi); }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(do_syscall_trace);+#endifdiff -Nur linux-2.6.13.ori/arch/i386/kernel/signal.c linux-2.6.13/arch/i386/kernel/signal.c--- linux-2.6.13.ori/arch/i386/kernel/signal.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/signal.c 2006-12-29 15:12:11.000000000 +0000@@ -7,6 +7,7 @@ * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes */ +#include <linux/config.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/smp.h>@@ -31,6 +32,10 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) +#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/module.h>+#endif+ /* * Atomically swap in the new signal mask, and wait for a signal. */@@ -666,3 +671,6 @@ clear_thread_flag(TIF_IRET); }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(do_notify_resume);+#endifdiff -Nur linux-2.6.13.ori/arch/i386/kernel/traps.c linux-2.6.13/arch/i386/kernel/traps.c--- linux-2.6.13.ori/arch/i386/kernel/traps.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/traps.c 2006-12-29 15:12:11.000000000 +0000@@ -944,6 +944,9 @@ 8 - CPU_16BIT_STACK_SIZE; switch32_ptr[1] = __KERNEL_DS; }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(setup_x86_bogus_stack);+#endif fastcall unsigned char * fixup_x86_bogus_stack(unsigned short sp) {@@ -1060,6 +1063,45 @@ _set_gate(idt_table+n,5,0,0,(gdt_entry<<3)); } +#ifdef CONFIG_UNIFIED_KERNEL+int set_w32system_gate(unsigned int n, void *addr)+{+ /* 0x20 ~ 0x2f could be set */+ if ((n & 0xfffffff0) != 0x20)+ return -1;+ _set_gate(idt_table+n,15,3,addr,__KERNEL_CS);+ return 0;+}+EXPORT_SYMBOL(set_w32system_gate);++int backup_idt_entry(unsigned int n, unsigned long *a, unsigned long *b)+{+ unsigned long *gate_addr;++ /* 0x20 ~ 0x2f could be backup */+ if ((n & 0xfffffff0) != 0x20)+ return -1;+ gate_addr = (unsigned long *)(idt_table + n);+ *a = *gate_addr;+ *b = *(gate_addr + 1);+ return 0;+}+EXPORT_SYMBOL(backup_idt_entry);++int restore_idt_entry(unsigned int n, unsigned long a, unsigned long b)+{+ unsigned long *gate_addr;++ /* 0x20 ~ 0x2f could be restore */+ if ((n & 0xfffffff0) != 0x20)+ return -1;+ gate_addr = (unsigned long *)(idt_table + n);+ *gate_addr = a;+ *(gate_addr + 1) = b;+ return 0;+}+EXPORT_SYMBOL(restore_idt_entry);+#endif void __init trap_init(void) {diff -Nur linux-2.6.13.ori/arch/i386/kernel/vm86.c linux-2.6.13/arch/i386/kernel/vm86.c--- linux-2.6.13.ori/arch/i386/kernel/vm86.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/kernel/vm86.c 2006-12-29 15:12:11.000000000 +0000@@ -48,6 +48,9 @@ #include <asm/tlbflush.h> #include <asm/irq.h> +#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/module.h>+#endif /* * Known problems: *@@ -133,6 +136,9 @@ ret = KVM86->regs32; return ret; }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(save_v86_state);+#endif static void mark_screen_rdonly(struct task_struct * tsk) {diff -Nur linux-2.6.13.ori/arch/i386/mm/mmap.c linux-2.6.13/arch/i386/mm/mmap.c--- linux-2.6.13.ori/arch/i386/mm/mmap.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/arch/i386/mm/mmap.c 2006-12-29 15:12:11.000000000 +0000@@ -27,6 +27,9 @@ #include <linux/personality.h> #include <linux/mm.h> #include <linux/random.h>+#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/module.h>+#endif /* * Top of mmap area (just below the process stack).@@ -74,3 +77,6 @@ mm->unmap_area = arch_unmap_area_topdown; } }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(arch_pick_mmap_layout);+#endifdiff -Nur linux-2.6.13.ori/drivers/block/ll_rw_blk.c linux-2.6.13/drivers/block/ll_rw_blk.c--- linux-2.6.13.ori/drivers/block/ll_rw_blk.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/drivers/block/ll_rw_blk.c 2006-12-29 15:12:11.000000000 +0000@@ -3289,6 +3289,33 @@ put_io_context(ioc); } +#ifdef CONFIG_UNIFIED_KERNEL++/* Called by the exitting task */+void exit_io_context_for_task(task_t *tsk)+{+ unsigned long flags;+ struct io_context *ioc;++ local_irq_save(flags);+ task_lock(tsk);+ ioc = tsk->io_context;+ tsk->io_context = NULL;+ ioc->task = NULL;+ task_unlock(tsk);+ local_irq_restore(flags);++ if (ioc->aic && ioc->aic->exit)+ ioc->aic->exit(ioc->aic);+ if (ioc->cic && ioc->cic->exit)+ ioc->cic->exit(ioc->cic);++ put_io_context(ioc);+}+EXPORT_SYMBOL(exit_io_context_for_task);++#endif+ /* * If the current task has no IO context then create one and initialise it. * Otherwise, return its existing IO context.diff -Nur linux-2.6.13.ori/drivers/char/random.c linux-2.6.13/drivers/char/random.c--- linux-2.6.13.ori/drivers/char/random.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/drivers/char/random.c 2006-12-29 15:12:11.000000000 +0000@@ -1608,6 +1608,9 @@ */ return secure_ip_id(current->pid + jiffies); }+#ifdef CONFIG_UNIFIED_KERNEL+EXPORT_SYMBOL(get_random_int);+#endif /* * randomize_range() returns a start address such thatdiff -Nur linux-2.6.13.ori/fs/exec.c linux-2.6.13/fs/exec.c--- linux-2.6.13.ori/fs/exec.c 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/fs/exec.c 2006-12-29 15:12:11.000000000 +0000@@ -56,6 +56,10 @@ #include <linux/kmod.h> #endif +#ifdef CONFIG_UNIFIED_KERNEL+#include <linux/win32_thread.h>+#endif+ int core_uses_pid; char core_pattern[65] = "core"; int suid_dumpable = 0;@@ -869,6 +873,10 @@ if (retval) goto mmap_failed; +#ifdef CONFIG_UNIFIED_KERNEL+ ethread_notify_execve(current);+#endif+ bprm->mm = NULL; /* We're using it now */ /* This is the point of no return */diff -Nur linux-2.6.13.ori/include/asm-i386/mach-default/irq_vectors.h linux-2.6.13/include/asm-i386/mach-default/irq_vectors.h--- linux-2.6.13.ori/include/asm-i386/mach-default/irq_vectors.h 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/include/asm-i386/mach-default/irq_vectors.h 2006-12-29 15:12:11.000000000 +0000@@ -22,17 +22,34 @@ #ifndef _ASM_IRQ_VECTORS_H #define _ASM_IRQ_VECTORS_H ++#ifndef CONFIG_UNIFIED_KERNEL /* * IDT vectors usable for external interrupt sources start * at 0x20: */ #define FIRST_EXTERNAL_VECTOR 0x20+#else+/*+ * Vectord 0x20-0x2f are reserved for win32 implementation, and therefore now+ * IDT vectors usable for external interrupt sources start+ * at 0x30:+ */+#define FIRST_EXTERNAL_VECTOR 0x30+#endif #define SYSCALL_VECTOR 0x80 ++#ifndef CONFIG_UNIFIED_KERNEL /* * Vectors 0x20-0x2f are used for ISA interrupts. */+#else+/*+ * Vectors 0x30-0x3f are used for ISA interrupts.+ */+#endif /* * Special IRQ vectors used by the SMP architecture, 0xf0-0xff@@ -62,7 +79,12 @@ * we start at 0x31 to spread out vectors evenly between priority * levels. (0x80 is the syscall vector) */+#ifndef CONFIG_UNIFIED_KERNEL #define FIRST_DEVICE_VECTOR 0x31+#else+/* Vectors 0x30-0x40 are now used for 8259s */+#define FIRST_DEVICE_VECTOR 0x41+#endif #define FIRST_SYSTEM_VECTOR 0xef #define TIMER_IRQ 0@@ -77,6 +99,15 @@ * the usable vector space is 0x20-0xff (224 vectors) */ +#ifdef CONFIG_UNIFIED_KERNEL+/*+ * For Unified Kernel, 16 more IRQ's are reserved for win32 system+ * call implementation, and thus the number of potential APIC + * interrupt sources is reduced into 192, and the usable vector space+ * is 0x30-0xff (208 vectors)+ */+#endif+ /* * The maximum number of vectors supported by i386 processors * is limited to 256. For processors other than i386, NR_VECTORSdiff -Nur linux-2.6.13.ori/include/asm-i386/mach-default/irq_vectors_limits.h linux-2.6.13/include/asm-i386/mach-default/irq_vectors_limits.h--- linux-2.6.13.ori/include/asm-i386/mach-default/irq_vectors_limits.h 2005-08-28 23:41:01.000000000 +0000+++ linux-2.6.13/include/asm-i386/mach-default/irq_vectors_limits.h 2006-12-29 15:12:11.000000000 +0000@@ -6,6 +6,7 @@ #define NR_IRQ_VECTORS NR_IRQS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -