Rules.make | 17 +++++++ arch/i386/Makefile | 4 + arch/i386/config.in | 10 ++++ arch/i386/vmlinux.lds | 99 ----------------------------------------- arch/i386/vmlinux.lds.S | 99 +++++++++++++++++++++++++++++++++++++++++ include/asm-i386/page.h | 4 + include/asm-i386/page_offset.h | 10 ++++ include/asm-i386/processor.h | 4 + mm/memory.c | 23 +++++++-- 9 files changed, 165 insertions(+), 105 deletions(-) Index: linux-2.4.22-vanilla/arch/i386/config.in =================================================================== --- linux-2.4.22-vanilla.orig/arch/i386/config.in 2003-12-02 23:55:28.000000000 +0300 +++ linux-2.4.22-vanilla/arch/i386/config.in 2003-12-15 23:09:28.000000000 +0300 @@ -212,6 +212,16 @@ fi if [ "$CONFIG_HIGHMEM64G" = "y" ]; then define_bool CONFIG_X86_PAE y + choice 'User address space size' \ + "3GB CONFIG_1GB \ + 2GB CONFIG_2GB \ + 1GB CONFIG_3GB" 3GB +else + choice 'User address space size' \ + "3GB CONFIG_1GB \ + 2GB CONFIG_2GB \ + 1GB CONFIG_3GB \ + 3.5GB CONFIG_05GB" 3GB fi if [ "$CONFIG_HIGHMEM" = "y" ]; then Index: linux-2.4.22-vanilla/arch/i386/Makefile =================================================================== --- linux-2.4.22-vanilla.orig/arch/i386/Makefile 2003-11-03 22:50:58.000000000 +0300 +++ linux-2.4.22-vanilla/arch/i386/Makefile 2003-12-15 23:09:28.000000000 +0300 @@ -114,6 +114,9 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot +arch/i386/vmlinux.lds: arch/i386/vmlinux.lds.S FORCE + $(CPP) -C -P -I$(HPATH) -imacros $(HPATH)/asm-i386/page_offset.h -Ui386 arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds + vmlinux: arch/i386/vmlinux.lds FORCE: ; @@ -150,6 +153,7 @@ @$(MAKEBOOT) clean archmrproper: + rm -f arch/i386/vmlinux.lds archdep: @$(MAKEBOOT) dep Index: linux-2.4.22-vanilla/arch/i386/vmlinux.lds.S =================================================================== --- linux-2.4.22-vanilla.orig/arch/i386/vmlinux.lds.S 2003-01-30 13:24:37.000000000 +0300 +++ linux-2.4.22-vanilla/arch/i386/vmlinux.lds.S 2003-12-15 23:10:46.000000000 +0300 @@ -0,0 +1,83 @@ +/* ld script to make i386 Linux kernel + * Written by Martin Mares ; + */ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) +SECTIONS +{ + . = PAGE_OFFSET_RAW + 0x100000; + _text = .; /* Text and read-only data */ + .text : { + *(.text) + *(.fixup) + *(.gnu.warning) + } = 0x9090 + + _etext = .; /* End of text section */ + + .rodata : { *(.rodata) *(.rodata.*) } + .kstrtab : { *(.kstrtab) } + + . = ALIGN(16); /* Exception table */ + __start___ex_table = .; + __ex_table : { *(__ex_table) } + __stop___ex_table = .; + + __start___ksymtab = .; /* Kernel symbol table */ + __ksymtab : { *(__ksymtab) } + __stop___ksymtab = .; + + .data : { /* Data */ + *(.data) + CONSTRUCTORS + } + + _edata = .; /* End of data section */ + +/* chose the biggest of the possible stack sizes here? */ + . = ALIGN(65536); /* init_task */ + .data.init_task : { *(.data.init_task) } + + . = ALIGN(4096); /* Init code and data */ + __init_begin = .; + .text.init : { *(.text.init) } + .data.init : { *(.data.init) } + . = ALIGN(16); + __setup_start = .; + .setup.init : { *(.setup.init) } + __setup_end = .; + __initcall_start = .; + .initcall.init : { *(.initcall.init) } + __initcall_end = .; + . = ALIGN(4096); + __init_end = .; + + . = ALIGN(4096); + .data.page_aligned : { *(.data.idt) } + + . = ALIGN(32); + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + + __bss_start = .; /* BSS */ + .bss : { + *(.bss) + } + _end = . ; + + /* Sections to be discarded */ + /DISCARD/ : { + *(.text.exit) + *(.data.exit) + *(.exitcall.exit) + } + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } +} Index: linux-2.4.22-vanilla/arch/i386/vmlinux.lds =================================================================== --- linux-2.4.22-vanilla.orig/arch/i386/vmlinux.lds 2003-12-15 23:17:09.000000000 +0300 +++ linux-2.4.22-vanilla/arch/i386/vmlinux.lds 2003-01-30 13:24:37.000000000 +0300 @@ -1,83 +0,0 @@ -/* ld script to make i386 Linux kernel - * Written by Martin Mares ; - */ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") -OUTPUT_ARCH(i386) -ENTRY(_start) -SECTIONS -{ - . = 0xC0000000 + 0x100000; - _text = .; /* Text and read-only data */ - .text : { - *(.text) - *(.fixup) - *(.gnu.warning) - } = 0x9090 - - _etext = .; /* End of text section */ - - .rodata : { *(.rodata) *(.rodata.*) } - .kstrtab : { *(.kstrtab) } - - . = ALIGN(16); /* Exception table */ - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - __start___ksymtab = .; /* Kernel symbol table */ - __ksymtab : { *(__ksymtab) } - __stop___ksymtab = .; - - .data : { /* Data */ - *(.data) - CONSTRUCTORS - } - - _edata = .; /* End of data section */ - -/* chose the biggest of the possible stack sizes here? */ - . = ALIGN(65536); /* init_task */ - .data.init_task : { *(.data.init_task) } - - . = ALIGN(4096); /* Init code and data */ - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(16); - __setup_start = .; - .setup.init : { *(.setup.init) } - __setup_end = .; - __initcall_start = .; - .initcall.init : { *(.initcall.init) } - __initcall_end = .; - . = ALIGN(4096); - __init_end = .; - - . = ALIGN(4096); - .data.page_aligned : { *(.data.idt) } - - . = ALIGN(32); - .data.cacheline_aligned : { *(.data.cacheline_aligned) } - - __bss_start = .; /* BSS */ - .bss : { - *(.bss) - } - _end = . ; - - /* Sections to be discarded */ - /DISCARD/ : { - *(.text.exit) - *(.data.exit) - *(.exitcall.exit) - } - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } -} Index: linux-2.4.22-vanilla/include/asm-i386/page.h =================================================================== --- linux-2.4.22-vanilla.orig/include/asm-i386/page.h 2003-11-03 23:51:46.000000000 +0300 +++ linux-2.4.22-vanilla/include/asm-i386/page.h 2003-12-15 23:09:28.000000000 +0300 @@ -78,7 +78,9 @@ * and CONFIG_HIGHMEM64G options in the kernel configuration. */ -#define __PAGE_OFFSET (0xC0000000) +#include + +#define __PAGE_OFFSET (PAGE_OFFSET_RAW) /* * This much address space is reserved for vmalloc() and iomap() Index: linux-2.4.22-vanilla/include/asm-i386/page_offset.h =================================================================== --- linux-2.4.22-vanilla.orig/include/asm-i386/page_offset.h 2003-01-30 13:24:37.000000000 +0300 +++ linux-2.4.22-vanilla/include/asm-i386/page_offset.h 2003-12-15 23:09:28.000000000 +0300 @@ -0,0 +1,10 @@ +#include +#ifdef CONFIG_05GB +#define PAGE_OFFSET_RAW 0xE0000000 +#elif defined(CONFIG_1GB) +#define PAGE_OFFSET_RAW 0xC0000000 +#elif defined(CONFIG_2GB) +#define PAGE_OFFSET_RAW 0x80000000 +#elif defined(CONFIG_3GB) +#define PAGE_OFFSET_RAW 0x40000000 +#endif Index: linux-2.4.22-vanilla/include/asm-i386/processor.h =================================================================== --- linux-2.4.22-vanilla.orig/include/asm-i386/processor.h 2003-12-02 23:55:28.000000000 +0300 +++ linux-2.4.22-vanilla/include/asm-i386/processor.h 2003-12-15 23:09:28.000000000 +0300 @@ -265,7 +265,11 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ +#ifndef CONFIG_05GB #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) +#else +#define TASK_UNMAPPED_BASE (TASK_SIZE / 16) +#endif /* * Size of io_bitmap in longwords: 32 is ports 0-0x3ff. Index: linux-2.4.22-vanilla/mm/memory.c =================================================================== --- linux-2.4.22-vanilla.orig/mm/memory.c 2003-05-16 05:29:15.000000000 +0400 +++ linux-2.4.22-vanilla/mm/memory.c 2003-12-15 23:09:28.000000000 +0300 @@ -108,8 +108,7 @@ static inline void free_one_pgd(pgd_t * dir) { - int j; - pmd_t * pmd; + pmd_t * pmd, * md, * emd; if (pgd_none(*dir)) return; @@ -120,9 +119,23 @@ } pmd = pmd_offset(dir, 0); pgd_clear(dir); - for (j = 0; j < PTRS_PER_PMD ; j++) { - prefetchw(pmd+j+(PREFETCH_STRIDE/16)); - free_one_pmd(pmd+j); + + /* + * Beware if changing the loop below. It once used int j, + * for (j = 0; j < PTRS_PER_PMD; j++) + * free_one_pmd(pmd+j); + * but some older i386 compilers (e.g. egcs-2.91.66, gcc-2.95.3) + * terminated the loop with a _signed_ address comparison + * using "jle", when configured for HIGHMEM64GB (X86_PAE). + * If also configured for 3GB of kernel virtual address space, + * if page at physical 0x3ffff000 virtual 0x7ffff000 is used as + * a pmd, when that mm exits the loop goes on to free "entries" + * found at 0x80000000 onwards. The loop below compiles instead + * to be terminated by unsigned address comparison using "jb". + */ + for (md = pmd, emd = pmd + PTRS_PER_PMD; md < emd; md++) { + prefetchw(md+(PREFETCH_STRIDE/16)); + free_one_pmd(md); } pmd_free(pmd); } Index: linux-2.4.22-vanilla/Rules.make =================================================================== --- linux-2.4.22-vanilla.orig/Rules.make 2003-05-16 05:28:27.000000000 +0400 +++ linux-2.4.22-vanilla/Rules.make 2003-12-15 23:09:28.000000000 +0300 @@ -215,6 +215,7 @@ # # Added the SMP separator to stop module accidents between uniprocessor # and SMP Intel boxes - AC - from bits by Michael Chastain +# Added separator for different PAGE_OFFSET memory models - Ingo. # ifdef CONFIG_SMP @@ -223,6 +224,22 @@ genksyms_smp_prefix := endif +ifdef CONFIG_2GB +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_2gig_ +else + genksyms_smp_prefix := -p 2gig_ +endif +endif + +ifdef CONFIG_3GB +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_3gig_ +else + genksyms_smp_prefix := -p 3gig_ +endif +endif + $(MODINCL)/%.ver: %.c @if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $< ]; then \ echo '$(CC) $(CFLAGS) $(EXTRA_CFLAGS_nostdinc) -E -D__GENKSYMS__ $<'; \