From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Someone Unknown To: sisyphus@altlinux.ru Subject: Re: [sisyphus] Win4Lin Date: Fri, 21 Feb 2003 19:14:33 +0300 User-Agent: KMail/1.5 References: <200302200239.41035.someone_lists@bk.ru> <00c701c2d997$287f0fa0$e26fa8c0@ukrfin.com.ua> In-Reply-To: <00c701c2d997$287f0fa0$e26fa8c0@ukrfin.com.ua> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_pBlV+3oYBfS1Fr/" Message-Id: <200302211914.33053.someone_lists@bk.ru> Sender: sisyphus-admin@altlinux.ru Errors-To: sisyphus-admin@altlinux.ru X-BeenThere: sisyphus@altlinux.ru X-Mailman-Version: 2.0.9 Precedence: bulk Reply-To: sisyphus@altlinux.ru List-Unsubscribe: , List-Id: List-Post: List-Help: List-Subscribe: , List-Archive: Archived-At: List-Archive: --Boundary-00=_pBlV+3oYBfS1Fr/ Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit Content-Disposition: inline Так... Рецепт следующий. Разбираем srpm и складываем в /usr/src/RPM/SOURCES Туда же складываем Merge kernel interface adapter patch с сайта Netraverse, называется mki-adapter.patch. Туда же складываем приаттаченые Kernel-Win4Lin3-2.4.20-alt4.patch (родной от Netraverse, только несколько поправленный) и Win4Lin-vmscan-hack.patch (это уже мое извращение). Далее патчим kernel-2.4-stable.spec при помощи kernel-2.4-stable.spec.patch. На данный момент получили spec, из которого будет построено custom-ядро (kernel24-w4l-2.4.20-alt4) безо всего (без alsa, всяческих модемов и т.п.). Если это все вам надо - включите в спеке. Оно собирается, просто оно мне не надо было... 8) Далее надо сделать конфиги для custom-ядра. Для однопроцессорной машины я делал так: for i in *-up*.config; do cp $i `echo $i | sed 's/-up/-w4l/'`; done for i in *-w4l*.config; do echo 'CONFIG_MKI=y' >> $i; done После чего его можно собирать. Делитесь впечаллениями! 8) --Boundary-00=_pBlV+3oYBfS1Fr/ Content-Type: text/x-diff; charset="koi8-r"; name="Kernel-Win4Lin3-2.4.20-alt4.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Kernel-Win4Lin3-2.4.20-alt4.patch" diff -aur linux-2.4.20/arch/i386/boot/compressed/head.S linux-2.4.20-win4lin/arch/i386/boot/compressed/head.S --- linux-2.4.20/arch/i386/boot/compressed/head.S 2000-07-05 12:03:12.000000000 -0700 +++ linux-2.4.20-win4lin/arch/i386/boot/compressed/head.S 2002-12-02 09:51:56.000000000 -0800 @@ -31,7 +31,7 @@ startup_32: cld cli - movl $(__KERNEL_DS),%eax + movl $(__BOOT_KERNEL_DS),%eax movl %eax,%ds movl %eax,%es movl %eax,%fs @@ -74,7 +74,7 @@ popl %esi # discard address popl %esi # real mode pointer xorl %ebx,%ebx - ljmp $(__KERNEL_CS), $0x100000 + ljmp $(__BOOT_KERNEL_CS), $0x100000 /* * We come here, if we were loaded high. @@ -101,7 +101,7 @@ popl %eax # hcount movl $0x100000,%edi cli # make sure we don't get interrupted - ljmp $(__KERNEL_CS), $0x1000 # and jump to the move routine + ljmp $(__BOOT_KERNEL_CS), $0x1000 # and jump to the move routine /* * Routine (template) for moving the decompressed kernel in place, @@ -124,5 +124,5 @@ movsl movl %ebx,%esi # Restore setup pointer xorl %ebx,%ebx - ljmp $(__KERNEL_CS), $0x100000 + ljmp $(__BOOT_KERNEL_CS), $0x100000 move_routine_end: diff -aur linux-2.4.20/arch/i386/boot/compressed/misc.c linux-2.4.20-win4lin/arch/i386/boot/compressed/misc.c --- linux-2.4.20/arch/i386/boot/compressed/misc.c 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/boot/compressed/misc.c 2002-12-02 09:51:56.000000000 -0800 @@ -301,7 +301,7 @@ struct { long * a; short b; - } stack_start = { & user_stack [STACK_SIZE] , __KERNEL_DS }; + } stack_start = { & user_stack [STACK_SIZE] , __BOOT_KERNEL_DS }; static void setup_normal_output_buffer(void) { diff -aur linux-2.4.20/arch/i386/boot/setup.S linux-2.4.20-win4lin/arch/i386/boot/setup.S --- linux-2.4.20/arch/i386/boot/setup.S 2002-08-02 17:39:42.000000000 -0700 +++ linux-2.4.20-win4lin/arch/i386/boot/setup.S 2002-12-02 09:51:56.000000000 -0800 @@ -812,7 +812,7 @@ .byte 0x66, 0xea # prefix + jmpi-opcode code32: .long 0x1000 # will be set to 0x100000 # for big kernels - .word __KERNEL_CS + .word __BOOT_KERNEL_CS # Here's a bunch of information about your current kernel.. kernel_version: .ascii UTS_RELEASE @@ -1024,7 +1024,7 @@ .word 0 # idt limit = 0 .word 0, 0 # idt base = 0L gdt_48: - .word 0x8000 # gdt limit=2048, + .word 0x8000 # gdt limit=2048 + reserve, # 256 GDT entries .word 0, 0 # gdt base (filled in later) diff -aur linux-2.4.20/arch/i386/config.in linux-2.4.20-win4lin/arch/i386/config.in --- linux-2.4.20/arch/i386/config.in 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/config.in 2002-12-02 09:51:56.000000000 -0800 @@ -440,6 +440,13 @@ source net/bluetooth/Config.in mainmenu_option next_comment +comment 'Windows Applications support' +if [ "$CONFIG_MODULES" = "y" ]; then +bool 'Include NeTraverse Win4Lin Support' CONFIG_MKI +fi +endmenu + +mainmenu_option next_comment comment 'Kernel hacking' bool 'Kernel debugging' CONFIG_DEBUG_KERNEL diff -aur linux-2.4.20/arch/i386/kernel/entry.S linux-2.4.20-win4lin/arch/i386/kernel/entry.S --- linux-2.4.20/arch/i386/kernel/entry.S 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/kernel/entry.S 2002-12-02 09:51:56.000000000 -0800 @@ -213,6 +213,11 @@ cli # need_resched and signals atomic test cmpl $0,need_resched(%ebx) jne reschedule +#ifdef CONFIG_MKI + pushl %esp + call SYMBOL_NAME(mki_ret_user) + addl $4,%esp +#endif /* CONFIG_MKI */ cmpl $0,sigpending(%ebx) jne signal_return restore_all: @@ -253,6 +258,13 @@ jmp ret_from_sys_call ALIGN +#ifdef CONFIG_MKI +ENTRY(mki_process_trapret) +#ifdef CONFIG_PREEMPT + GET_CURRENT(%ebx) + jmp ret_from_exception +#endif +#endif /* CONFIG_MKI */ ENTRY(ret_from_intr) GET_CURRENT(%ebx) ret_from_exception: diff -aur linux-2.4.20/arch/i386/kernel/head.S linux-2.4.20-win4lin/arch/i386/kernel/head.S --- linux-2.4.20/arch/i386/kernel/head.S 2002-08-02 17:39:42.000000000 -0700 +++ linux-2.4.20-win4lin/arch/i386/kernel/head.S 2002-12-02 09:51:56.000000000 -0800 @@ -46,7 +46,7 @@ * Set segments to known values */ cld - movl $(__KERNEL_DS),%eax + movl $(__BOOT_KERNEL_DS),%eax movl %eax,%ds movl %eax,%es movl %eax,%fs @@ -104,7 +104,7 @@ jmp *%eax /* make sure eip is relocated */ 1: /* Set up the stack pointer */ - lss stack_start,%esp + lss boot_stack_start,%esp #ifdef CONFIG_SMP orw %bx,%bx @@ -319,6 +319,10 @@ jne rp_sidt ret +ENTRY(boot_stack_start) + .long SYMBOL_NAME(init_task_union)+8192 + .long __BOOT_KERNEL_DS + ENTRY(stack_start) .long SYMBOL_NAME(init_task_union)+8192 .long __KERNEL_DS @@ -408,19 +412,6 @@ .org 0x5000 -/* - * Real beginning of normal "text" segment - */ -ENTRY(stext) -ENTRY(_stext) - -/* - * This starts the data section. Note that the above is all - * in the text section because it has alignment requirements - * that we cannot fulfill any other way. - */ -.data - ALIGN /* * This contains typically 140 quadwords, depending on NR_CPUS. @@ -445,4 +436,28 @@ .quad 0x00409a0000000000 /* 0x48 APM CS code */ .quad 0x00009a0000000000 /* 0x50 APM CS 16 code (16 bit) */ .quad 0x0040920000000000 /* 0x58 APM DS data */ +#ifdef CONFIG_MKI +/* increase the ENTRIES_AFTER_KERNEL constant in segment.h if more */ +/* entries are added after 0x18 above */ + .fill __GDT_SLOTS_RESERVED-(2+ENTRIES_AFTER_KERNEL_DS),8,0 + /* fill to page boundary + 2 slots */ + .quad 0x00cf9a000000ffff /* 0x1010 kernel 4GB code at 0x00000000 */ + .quad 0x00cf92000000ffff /* 0x1018 kernel 4GB data at 0x00000000 */ + .fill ENTRIES_AFTER_KERNEL_DS,8,0 +#endif .fill NR_CPUS*16,8,0 /* space for TSS's and LDT's, 128byte aligned for new x86 CPUs */ + + ALIGN +/* + * Real beginning of normal "text" segment + */ +ENTRY(stext) +ENTRY(_stext) + +/* + * This starts the data section. Note that the above is all + * in the text section because it has alignment requirements + * that we cannot fulfill any other way. + */ +.data + diff -aur linux-2.4.20/arch/i386/kernel/process.c linux-2.4.20-win4lin/arch/i386/kernel/process.c --- linux-2.4.20/arch/i386/kernel/process.c 2002-08-02 17:39:42.000000000 -0700 +++ linux-2.4.20-win4lin/arch/i386/kernel/process.c 2002-12-02 09:51:56.000000000 -0800 @@ -47,6 +47,9 @@ #ifdef CONFIG_MATH_EMULATION #include #endif +#ifdef CONFIG_MKI +#include +#endif #include @@ -696,6 +699,11 @@ asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs)); asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs)); +#ifdef CONFIG_MKI + if (next_p->mki_task_info) + CALL_MKI_HOOK(MKI_HOOK_SWITCH_TO, next_p, NULL); +#endif /* CONFIG_MKI */ + /* * Restore %fs and %gs. */ diff -aur linux-2.4.20/arch/i386/kernel/signal.c linux-2.4.20-win4lin/arch/i386/kernel/signal.c --- linux-2.4.20/arch/i386/kernel/signal.c 2002-08-02 17:39:42.000000000 -0700 +++ linux-2.4.20-win4lin/arch/i386/kernel/signal.c 2002-12-02 09:51:56.000000000 -0800 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -592,8 +593,16 @@ * kernel mode. Just return without doing anything * if so. */ +#ifdef CONFIG_MKI + /* When we are in vm86 mode don't do the quick return */ + if (((regs->eflags & 0x20000) == 0) && + ((regs->xcs & 3) != 3)) { + return 1; + } +#else if ((regs->xcs & 3) != 3) return 1; +#endif if (!oldset) oldset = ¤t->blocked; diff -aur linux-2.4.20/arch/i386/kernel/smpboot.c linux-2.4.20-win4lin/arch/i386/kernel/smpboot.c --- linux-2.4.20/arch/i386/kernel/smpboot.c 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/kernel/smpboot.c 2002-12-02 09:51:56.000000000 -0800 @@ -499,6 +499,11 @@ unsigned short ss; } stack_start; +extern struct { + void * esp; + unsigned short ss; +} boot_stack_start; + static int __init fork_by_hand(void) { struct pt_regs regs; @@ -820,6 +825,7 @@ /* So we see what's up */ printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip); stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle); + boot_stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle); /* * This grunge runs the startup process for diff -aur linux-2.4.20/arch/i386/kernel/trampoline.S linux-2.4.20-win4lin/arch/i386/kernel/trampoline.S --- linux-2.4.20/arch/i386/kernel/trampoline.S 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/kernel/trampoline.S 2002-12-02 09:51:56.000000000 -0800 @@ -26,6 +26,7 @@ * entries except for the gdt one.. */ +#include #include #include #include @@ -54,7 +55,7 @@ lmsw %ax # into protected mode jmp flush_instr flush_instr: - ljmpl $__KERNEL_CS, $0x00100000 + ljmpl $__BOOT_KERNEL_CS, $0x00100000 # jump to startup_32 in arch/i386/kernel/head.S idt_48: diff -aur linux-2.4.20/arch/i386/Makefile linux-2.4.20-win4lin/arch/i386/Makefile --- linux-2.4.20/arch/i386/Makefile 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/Makefile 2002-12-02 09:51:56.000000000 -0800 @@ -98,6 +98,11 @@ DRIVERS += arch/i386/math-emu/math.o endif +ifdef CONFIG_MKI +SUBDIRS += arch/i386/mki +CORE_FILES += arch/i386/mki/mki.o +endif + arch/i386/kernel: dummy $(MAKE) linuxsubdirs SUBDIRS=arch/i386/kernel diff -aur linux-2.4.20/arch/i386/mki/Makefile linux-2.4.20-win4lin/arch/i386/mki/Makefile --- linux-2.4.20/arch/i386/mki/Makefile 2002-12-02 09:58:28.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/mki/Makefile 2002-12-02 09:51:56.000000000 -0800 @@ -0,0 +1,27 @@ +# +# Makefile for the Merge Kernel Interface (MKI). +# +# Copyright 1999-2001 by NeTraverse Inc. +# This source code is provided "AS IS", free of charge +# and without restrictions. +# NeTraverse (and it's third party suppliers and licensors) make no warranty +# to its use, performance, or suitability for any particular purpose. +# In no event, shall NeTraverse (and it's third party suppliers and licensors) +# be liable for any damages resulting in the use of this source code. +# The entire risk arising out of the use of this source code remains +# with you. +# +#********************************************************************** +# This software may be used and distributed according to the terms +# of the GNU General Public License, incorporated herein by reference. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definitions are now in the main makefile... + +all: mki.o +#OX_OBJS := mki.o +export-objs := mki.o +include $(TOPDIR)/Rules.make diff -aur linux-2.4.20/arch/i386/mki/mki.c linux-2.4.20-win4lin/arch/i386/mki/mki.c --- linux-2.4.20/arch/i386/mki/mki.c 2002-12-02 09:58:28.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/mki/mki.c 2002-12-02 09:51:56.000000000 -0800 @@ -0,0 +1,92 @@ +/* + * Copyright 1999-2001 by NeTraverse Inc. + * This source code is provided "AS IS", free of charge + * and without restrictions. + * NeTraverse (and it's third party suppliers and licensors) make no warranty + * to its use, performance, or suitability for any particular purpose. + * In no event, shall NeTraverse (and it's third party suppliers and licensors) + * be liable for any damages resulting in the use of this source code. + * The entire risk arising out of the use of this source code remains + * with you. + * + *********************************************************************** + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ +/* + * These hooks will get populated by the mki-adapter module + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +void mhi_void_hook(void *parm1, void *parm2) +{ + return; +} + +void (*mhi_hooks[])(void *, void *) = +{ + &mhi_void_hook, /* MKI_HOOK_RET_USER */ + &mhi_void_hook, /* MKI_HOOK_SWITCH_TO */ + &mhi_void_hook, /* MKI_HOOK_SWITCH_AWAY */ + &mhi_void_hook, /* MKI_HOOK_EXIT */ + &mhi_void_hook, /* MKI_HOOK_SWAP */ +}; + +void mki_ret_user(unsigned long *r0ptr) +{ + CALL_MKI_HOOK(MKI_HOOK_RET_USER, r0ptr, NULL); +} + +EXPORT_SYMBOL_NOVERS(mhi_void_hook); +EXPORT_SYMBOL_NOVERS(mhi_hooks); +EXPORT_SYMBOL_NOVERS(mki_ret_user); +extern void mki_process_trapret(void); +EXPORT_SYMBOL_NOVERS(mki_process_trapret); +//some data that we need for the other modules +#include +#include +#include +EXPORT_SYMBOL_NOVERS(init_tss); +EXPORT_SYMBOL_NOVERS(idt); +EXPORT_SYMBOL_NOVERS(gdt_table); +EXPORT_SYMBOL_NOVERS(runqueue_lock); +EXPORT_SYMBOL_NOVERS(mmu_cr4_features); +//and some functions +#include +EXPORT_SYMBOL_NOVERS(handle_mm_fault); +EXPORT_SYMBOL_NOVERS(make_pages_present); +#ifdef CONFIG_SMP +EXPORT_SYMBOL_NOVERS(smp_send_reschedule); +extern void flush_tlb_all(void); +EXPORT_SYMBOL_NOVERS(flush_tlb_all); +#endif + +/* pte and pmd allocation changed in 2.4.3 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) +#include +EXPORT_SYMBOL_NOVERS(__handle_bad_pmd); +EXPORT_SYMBOL_NOVERS(get_pte_slow); +#else +EXPORT_SYMBOL_NOVERS(__pmd_alloc); +EXPORT_SYMBOL_NOVERS(pte_alloc); +#endif + +#include +EXPORT_SYMBOL_NOVERS(search_exception_table); +extern int sys_mprotect(unsigned long, size_t, unsigned long); +EXPORT_SYMBOL_NOVERS(sys_mprotect); +extern int sys_ftruncate(int, unsigned long); +EXPORT_SYMBOL_NOVERS(sys_ftruncate); +extern int sys_munmap(unsigned long, size_t); +EXPORT_SYMBOL_NOVERS(sys_munmap); +void do_exit(long code); +EXPORT_SYMBOL_NOVERS(do_exit); diff -aur linux-2.4.20/arch/i386/mm/fault.c linux-2.4.20-win4lin/arch/i386/mm/fault.c --- linux-2.4.20/arch/i386/mm/fault.c 2002-11-28 15:53:09.000000000 -0800 +++ linux-2.4.20-win4lin/arch/i386/mm/fault.c 2002-12-02 09:51:56.000000000 -0800 @@ -19,6 +19,7 @@ #include #include #include /* For unblank_screen() */ +#include #include #include @@ -268,7 +269,11 @@ up_read(&mm->mmap_sem); /* User mode accesses just cause a SIGSEGV */ +#ifdef CONFIG_MKI + if (user_mode(regs)) { +#else if (error_code & 4) { +#endif tsk->thread.cr2 = address; tsk->thread.error_code = error_code; tsk->thread.trap_no = 14; diff -aur linux-2.4.20/drivers/ide/ide-cd.c linux-2.4.20-win4lin/drivers/ide/ide-cd.c --- linux-2.4.20/drivers/ide/ide-cd.c 2002-11-28 15:53:13.000000000 -0800 +++ linux-2.4.20-win4lin/drivers/ide/ide-cd.c 2002-12-02 09:51:56.000000000 -0800 @@ -1457,6 +1457,8 @@ if (pc->sense == NULL) pc->sense = &sense; + generic_unplug_device(&drive->queue); + /* Start of retry loop. */ do { ide_init_drive_cmd (&req); diff -aur linux-2.4.20/include/asm-i386/desc.h linux-2.4.20-win4lin/include/asm-i386/desc.h --- linux-2.4.20/include/asm-i386/desc.h 2001-07-26 13:40:32.000000000 -0700 +++ linux-2.4.20-win4lin/include/asm-i386/desc.h 2002-12-02 09:51:56.000000000 -0800 @@ -2,6 +2,7 @@ #define __ARCH_DESC_H #include +#include /* * The layout of the GDT under Linux: @@ -34,7 +35,7 @@ * * Entry into gdt where to find first TSS. */ -#define __FIRST_TSS_ENTRY 12 +#define __FIRST_TSS_ENTRY (12+__GDT_SLOTS_RESERVED) #define __FIRST_LDT_ENTRY (__FIRST_TSS_ENTRY+1) #define __TSS(n) (((n)<<4) + __FIRST_TSS_ENTRY) diff -aur linux-2.4.20/include/asm-i386/mki.h linux-2.4.20-win4lin/include/asm-i386/mki.h --- linux-2.4.20/include/asm-i386/mki.h 2002-12-02 09:58:28.000000000 -0800 +++ linux-2.4.20-win4lin/include/asm-i386/mki.h 2002-12-02 09:51:56.000000000 -0800 @@ -0,0 +1,38 @@ +/* + * Copyright 1999-2001 by NeTraverse Inc. + * This source code is provided "AS IS", free of charge + * and without restrictions. + * NeTraverse (and it's third party suppliers and licensors) make no warranty + * to its use, performance, or suitability for any particular purpose. + * In no event, shall NeTraverse (and it's third party suppliers and licensors) + * be liable for any damages resulting in the use of this source code. + * The entire risk arising out of the use of this source code remains + * with you. + * + *********************************************************************** + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + + +#ifdef CONFIG_MKI +#ifndef INCLUDE_MKI_H +#define INCLUDE_MKI_H + +extern void mhi_void_hook(void *, void *); +extern void (*mhi_hooks[])(void *, void *); + +#define CALL_MKI_HOOK(hook, arg1, arg2) mhi_hooks[hook](arg1, arg2) + +/* for mki-adapter module */ +#define MKI_HOOK_TABLE_EXISTS 1 + +/* constants for hook table */ +#define MKI_HOOK_RET_USER 0 +#define MKI_HOOK_SWITCH_TO 1 +#define MKI_HOOK_SWITCH_AWAY 2 +#define MKI_HOOK_EXIT 3 +#define MKI_HOOK_SWAP 4 + +#endif /* INCLUDE_MKI_H */ +#endif /* CONFIG_MKI */ diff -aur linux-2.4.20/include/asm-i386/mkiversion.h linux-2.4.20-win4lin/include/asm-i386/mkiversion.h --- linux-2.4.20/include/asm-i386/mkiversion.h 2002-12-02 09:58:28.000000000 -0800 +++ linux-2.4.20-win4lin/include/asm-i386/mkiversion.h 2002-12-02 09:51:56.000000000 -0800 @@ -0,0 +1,25 @@ +/* + * Copyright 1999-2001 by NeTraverse Inc. + * This source code is provided "AS IS", free of charge + * and without restrictions. + * NeTraverse (and it's third party suppliers and licensors) make no warranty + * to its use, performance, or suitability for any particular purpose. + * In no event, shall NeTraverse (and it's third party suppliers and licensors) + * be liable for any damages resulting in the use of this source code. + * The entire risk arising out of the use of this source code remains + * with you. + * + *********************************************************************** + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#ifdef CONFIG_MKI +#ifndef INCLUDE_MKI_VERSION_H +#define INCLUDE_MKI_VERSION_H + +int mki_version_3_0_1 = 0; +EXPORT_SYMBOL_NOVERS(mki_version_3_0_1); + +#endif /* INCLUDE_MKI_H */ +#endif /* CONFIG_MKI */ diff -aur linux-2.4.20/include/asm-i386/segment.h linux-2.4.20-win4lin/include/asm-i386/segment.h --- linux-2.4.20/include/asm-i386/segment.h 1997-12-01 10:34:12.000000000 -0800 +++ linux-2.4.20-win4lin/include/asm-i386/segment.h 2002-12-02 09:51:56.000000000 -0800 @@ -1,8 +1,22 @@ #ifndef _ASM_SEGMENT_H #define _ASM_SEGMENT_H +#include -#define __KERNEL_CS 0x10 -#define __KERNEL_DS 0x18 +#ifdef CONFIG_MKI +/* this number increases if more entries than + * this are added after 0x18 in head.S */ +#define ENTRIES_AFTER_KERNEL_DS 8 +#define ENTRIES_BEFORE_KERNEL_CS 2 +#define __GDT_SLOTS_RESERVED 512 /* Reserve a page full. */ +#else +#define __GDT_SLOTS_RESERVED 0 +#endif + +#define __BOOT_KERNEL_CS 0x10 +#define __BOOT_KERNEL_DS 0x18 + +#define __KERNEL_CS (__GDT_SLOTS_RESERVED*8) + 0x10 +#define __KERNEL_DS (__GDT_SLOTS_RESERVED*8) + 0x18 #define __USER_CS 0x23 #define __USER_DS 0x2B diff -aur linux-2.4.20/include/linux/sched.h linux-2.4.20-win4lin/include/linux/sched.h --- linux-2.4.20/include/linux/sched.h 2002-11-28 15:53:15.000000000 -0800 +++ linux-2.4.20-win4lin/include/linux/sched.h 2002-12-02 09:51:56.000000000 -0800 @@ -418,6 +418,14 @@ /* journalling filesystem info */ void *journal_info; +#ifdef CONFIG_MKI +/* mki task info structure */ + void *mki_task_info; +#define MKI_INIT_TASK mki_task_info: NULL, +#else +#define MKI_INIT_TASK +#endif + }; /* @@ -510,6 +518,7 @@ blocked: {{0}}, \ alloc_lock: SPIN_LOCK_UNLOCKED, \ journal_info: NULL, \ + MKI_INIT_TASK \ } diff -aur linux-2.4.20/kernel/exit.c linux-2.4.20-win4lin/kernel/exit.c --- linux-2.4.20/kernel/exit.c 2002-11-28 15:53:15.000000000 -0800 +++ linux-2.4.20-win4lin/kernel/exit.c 2002-12-02 09:51:56.000000000 -0800 @@ -20,6 +20,9 @@ #include #include #include +#ifdef CONFIG_MKI +#include +#endif extern void sem_exit (void); extern struct task_struct *child_reaper; @@ -439,6 +442,9 @@ #ifdef CONFIG_BSD_PROCESS_ACCT acct_process(code); #endif +#ifdef CONFIG_MKI + CALL_MKI_HOOK(MKI_HOOK_EXIT, NULL, NULL); +#endif __exit_mm(tsk); lock_kernel(); diff -aur linux-2.4.20/kernel/fork.c linux-2.4.20-win4lin/kernel/fork.c --- linux-2.4.20/kernel/fork.c 2002-11-28 15:53:15.000000000 -0800 +++ linux-2.4.20-win4lin/kernel/fork.c 2002-12-02 09:51:56.000000000 -0800 @@ -616,6 +616,10 @@ atomic_inc(&p->user->__count); atomic_inc(&p->user->processes); +#ifdef CONFIG_MKI + p->mki_task_info = NULL; +#endif + /* * Counter increases are protected by * the kernel lock so nr_threads can't diff -aur linux-2.4.20/kernel/sched.c linux-2.4.20-win4lin/kernel/sched.c --- linux-2.4.20/kernel/sched.c 2002-11-28 15:53:15.000000000 -0800 +++ linux-2.4.20-win4lin/kernel/sched.c 2002-12-02 09:51:56.000000000 -0800 @@ -32,6 +32,9 @@ #include #include +#ifdef CONFIG_MKI +#include +#endif extern void timer_bh(void); extern void tqueue_bh(void); @@ -659,6 +662,9 @@ #endif /* CONFIG_SMP */ kstat.context_swtch++; +#ifdef CONFIG_MKI + CALL_MKI_HOOK(MKI_HOOK_SWITCH_AWAY, prev, NULL); +#endif /* * there are 3 processes which are affected by a context switch: * diff -aur linux-2.4.20/mm/vmscan.c linux-2.4.20-win4lin/mm/vmscan.c --- linux-2.4.20/mm/vmscan.c 2002-11-28 15:53:15.000000000 -0800 +++ linux-2.4.20-win4lin/mm/vmscan.c 2002-12-02 09:51:56.000000000 -0800 @@ -34,5 +34,11 @@ */ int vm_passes = 60; +int _def_priority = 6; +#include +#ifdef CONFIG_MKI +#include +#endif + /* * "vm_cache_scan_ratio" is how much of the inactive LRU queue we will scan @@ -300,6 +305,9 @@ counter = mmlist_nr << 1; do { +#ifdef CONFIG_MKI + CALL_MKI_HOOK(MKI_HOOK_SWAP, (void *)_def_priority, (void *)gfp_mask); +#endif if (unlikely(current->need_resched)) { __set_current_state(TASK_RUNNING); schedule(); --Boundary-00=_pBlV+3oYBfS1Fr/ Content-Type: text/x-diff; charset="koi8-r"; name="Win4Lin-vmscan-hack.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Win4Lin-vmscan-hack.patch" --- linux-2.4.20.w4l/mm/vmscan.c.orig 2003-02-18 18:05:02 +0300 +++ linux-2.4.20.w4l/mm/vmscan.c 2003-02-18 18:07:28 +0300 @@ -343,8 +343,8 @@ return count; } -static int FASTCALL(swap_out(zone_t * classzone)); -static int swap_out(zone_t * classzone) +static int FASTCALL(swap_out(unsigned int gfp_mask, zone_t * classzone)); +static int swap_out(unsigned int gfp_mask, zone_t * classzone) { int counter, nr_pages = SWAP_CLUSTER_MAX; struct mm_struct *mm; @@ -592,7 +592,7 @@ #endif if (!*failed_swapout) - *failed_swapout = !swap_out(classzone); + *failed_swapout = !swap_out(gfp_mask, classzone); max_mapped = nr_pages * vm_mapped_ratio; @@ -738,7 +738,7 @@ #endif if (!failed_swapout) - failed_swapout = !swap_out(classzone); + failed_swapout = !swap_out(gfp_mask, classzone); } while (--tries); if (likely(current->pid != 1)) --Boundary-00=_pBlV+3oYBfS1Fr/ Content-Type: text/x-diff; charset="koi8-r"; name="kernel-2.4-stable.spec.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kernel-2.4-stable.spec.patch" --- kernel/linux-2.4.20-alt4.src.rpm.orig/kernel-2.4-stable.spec 2003-02-13 20:14:03 +0300 +++ kernel/linux-2.4.20-alt4.src.rpm/kernel-2.4-stable.spec 2003-02-18 20:47:20 +0300 @@ -2,7 +2,7 @@ # Define what kernels to be built # -%define BUILD_CUSTOM 0 +%define BUILD_CUSTOM 1 %define BUILD_BOOT 0 # BOOT kernel only can be built for i386 arch @@ -14,8 +14,8 @@ %define BUILD_RSBAC_UP 0 # RSBAC kernels now aren't avaiable so don't try to build them -%define BUILD_SMP 1 -%define BUILD_UP 1 +%define BUILD_SMP 0 +%define BUILD_UP 0 # Normal kernels %define BUILD_LINUS 0 @@ -41,7 +41,7 @@ # # Name of the custom kernel - it's "custom" by default -%define CUSTOM custom +%define CUSTOM w4l # # Define what additional drivers to be built @@ -55,7 +55,7 @@ %define BUILD_DRM_GAMMA 0 # Define it to build new alsa drivers (0.9.x) -%define BUILD_ALSA 1 +%define BUILD_ALSA 0 # Define what alsa modules to build (all by default) %define ALSA_MODULES all @@ -68,17 +68,17 @@ %define BUILD_SAA7134 0 # Define it to build hsflinmoded drivers -%define BUILD_HSF 1 +%define BUILD_HSF 0 # Define it to build slmdm drivers -%define BUILD_SLMDM 1 +%define BUILD_SLMDM 0 # Define it to build hpt drivers -%define BUILD_HPT 1 +%define BUILD_HPT 0 # Define it to build ATI Radeon drivers # Note that currently it does'nt work -%define BUILD_ATI 1 +%define BUILD_ATI 0 # Define it to apply rsbac patches. Keep in # mind that you can compile only custom kernel with this option @@ -702,6 +702,16 @@ Patch10060: linux-2.4.18-rsbac-syscall.patch Patch10090: rsbac-aci_data_structures.patch +### +# +# Win4Lin patches +# +### + +Patch80001: mki-adapter.patch +Patch80002: Kernel-Win4Lin3-%kversion-%release.patch +Patch80003: Win4Lin-vmscan-hack.patch + #################### ### DESCRIPTIONS ### #################### @@ -1393,6 +1403,20 @@ rm -rf aa_patches +### +# +# Win4Lin patches +# +### + +%if %BUILD_CUSTOM + +%patch80001 -p1 +%patch80002 -p1 +%patch80003 -p1 + +%endif #BUILD_CUSTOM + # Apply suse patches for i in suse_patches/*; do cat "$i" |patch -s -p1 --Boundary-00=_pBlV+3oYBfS1Fr/--