diff -urN linux-2.4.34/Documentation/Configure.help linux-2.4.34-3g/Documentation/Configure.help --- linux-2.4.34/Documentation/Configure.help Sun Oct 22 14:16:52 2006 +++ linux-2.4.34-3g/Documentation/Configure.help Sat Feb 17 21:26:52 2007 @@ -406,6 +406,64 @@ Select this if you have a 32-bit processor and more than 4 gigabytes of physical RAM. +Adressable RAM size in low memory +CONFIG_0_9GB + By default with HIGHMEM disabled, it is only possible to access the + first 896 MB of memory. The remaining 3 GB are used as virtual + memory addressable from userspace, for malloc & mmap for instance. + On systems with 1GB and more, it may be desirable to make use of + the whole memory without enabling HIGHMEM, which also implies that + the each process' virtual address space will be reduced. + + The default setting ("896MB") is recommended, changing it may break + some applications which heavily rely on the kernel start address. + + You may select the closest value to your system's RAM size to get + the most efficient setup. Rounded values provide the most efficient + memory usage, but are not compatible with some programs such as + VMWare. Use any x.9GB value if maximum compatibility is required. + + If unsure, say "896MB". + +1GB RAM size in low memory +CONFIG_1_0GB + Set this if you want to access the entire first GB of RAM on the + system without enabling HIGHMEM. Userspace processes will be able + to address 2.9 GB. + + WARNING! using this value breaks some applications such as VMWare. + Use 896 MB, 1.9GB or 2.9GB if unsure. + +1.9GB RAM size in low memory +CONFIG_1_9GB + Set this if you want to access the first 2GB of RAM on the system + without enabling HIGHMEM. The last 128 MB will remain unused though. + Userspace processes will be able to address 2.0 GB. + +2GB RAM size in low memory +CONFIG_2_0GB + Set this if you want to access the entire first 2GB of RAM on the + system without enabling HIGHMEM. Userspace processes will be able + to address 1.9 GB. + + WARNING! using this value breaks some applications such as VMWare. + Use 896 MB, 1.9GB or 2.9GB if unsure. + +2.9GB RAM size in low memory +CONFIG_2_9GB + Set this if you want to access the first 3GB of RAM on the system + without enabling HIGHMEM. The last 128 MB will remain unused though. + Userspace processes will be able to address 1.0 GB. + +3GB RAM size in low memory +CONFIG_3_0GB + Set this if you want to access the entire first 3GB of RAM on the + system without enabling HIGHMEM. Userspace processes will be able + to address 896 MB. + + WARNING! using this value breaks some applications such as VMWare. + Use 896 MB, 1.9GB or 2.9GB if unsure. + HIGHMEM I/O support CONFIG_HIGHIO If you want to be able to do I/O to high memory pages, say Y. diff -urN linux-2.4.34/Rules.make linux-2.4.34-3g/Rules.make --- linux-2.4.34/Rules.make Fri Feb 20 07:38:24 2004 +++ linux-2.4.34-3g/Rules.make Sat Feb 17 20:57:48 2007 @@ -215,12 +215,45 @@ # # 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 genksyms_smp_prefix := -p smp_ else genksyms_smp_prefix := +endif + +ifdef CONFIG_1_9GB +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_2gig_ +else + genksyms_smp_prefix := -p 2gig_ +endif +endif + +ifdef CONFIG_2_0GB +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_2gig_ +else + genksyms_smp_prefix := -p 2gig_ +endif +endif + +ifdef CONFIG_2_9GB +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_3gig_ +else + genksyms_smp_prefix := -p 3gig_ +endif +endif + +ifdef CONFIG_3_0GB +ifdef CONFIG_SMP + genksyms_smp_prefix := -p smp_3gig_ +else + genksyms_smp_prefix := -p 3gig_ +endif endif $(MODINCL)/%.ver: %.c diff -urN linux-2.4.34/arch/i386/Makefile linux-2.4.34-3g/arch/i386/Makefile --- linux-2.4.34/arch/i386/Makefile Sun Oct 22 14:16:52 2006 +++ linux-2.4.34-3g/arch/i386/Makefile Sat Feb 17 20:34:20 2007 @@ -116,6 +116,9 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot +arch/i386/vmlinux.lds: arch/i386/vmlinux.lds.S FORCE + $(CPP) -C -P -U$(ARCH) -I$(HPATH) arch/$(ARCH)/vmlinux.lds.S >arch/$(ARCH)/vmlinux.lds + vmlinux: arch/i386/vmlinux.lds FORCE: ; @@ -152,6 +155,7 @@ @$(MAKEBOOT) clean archmrproper: + rm -f arch/i386/vmlinux.lds archdep: @$(MAKEBOOT) dep diff -urN linux-2.4.34/arch/i386/config.in linux-2.4.34-3g/arch/i386/config.in --- linux-2.4.34/arch/i386/config.in Tue Aug 15 10:53:55 2006 +++ linux-2.4.34-3g/arch/i386/config.in Sat Feb 17 20:59:06 2007 @@ -219,6 +219,13 @@ if [ "$CONFIG_HIGHMEM64G" = "y" ]; then define_bool CONFIG_X86_PAE y fi +choice 'Adressable RAM size in lowmem (rest is for user-space)' \ + "896MB CONFIG_0_9GB \ + 1.0GB CONFIG_1_0GB \ + 1.9GB CONFIG_1_9GB \ + 2.0GB CONFIG_2_0GB \ + 2.9GB CONFIG_2_9GB \ + 3.0GB CONFIG_3_0GB" 896MB if [ "$CONFIG_HIGHMEM" = "y" ]; then bool 'HIGHMEM I/O support' CONFIG_HIGHIO diff -urN linux-2.4.34/arch/i386/vmlinux.lds linux-2.4.34-3g/arch/i386/vmlinux.lds --- linux-2.4.34/arch/i386/vmlinux.lds Sun Mar 3 17:17:05 2002 +++ linux-2.4.34-3g/arch/i386/vmlinux.lds Thu Jan 1 01:00:00 1970 @@ -1,82 +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 */ - - . = ALIGN(8192); /* 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) } -} diff -urN linux-2.4.34/arch/i386/vmlinux.lds.S linux-2.4.34-3g/arch/i386/vmlinux.lds.S --- linux-2.4.34/arch/i386/vmlinux.lds.S Thu Jan 1 01:00:00 1970 +++ linux-2.4.34-3g/arch/i386/vmlinux.lds.S Sat Feb 17 20:34:20 2007 @@ -0,0 +1,85 @@ +/* ld script to make i386 Linux kernel + * Written by Martin Mares ; + */ + +#include + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) +SECTIONS +{ + . = __PAGE_OFFSET + 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 */ + + . = ALIGN(8192); /* 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) } +} diff -urN linux-2.4.34/include/asm-i386/page.h linux-2.4.34-3g/include/asm-i386/page.h --- linux-2.4.34/include/asm-i386/page.h Sat Feb 17 10:18:09 2007 +++ linux-2.4.34-3g/include/asm-i386/page.h Sat Feb 17 20:34:20 2007 @@ -79,7 +79,7 @@ * and CONFIG_HIGHMEM64G options in the kernel configuration. */ -#define __PAGE_OFFSET (0xC0000000) +#include /* * This much address space is reserved for vmalloc() and iomap() diff -urN linux-2.4.34/include/asm-i386/page_offset.h linux-2.4.34-3g/include/asm-i386/page_offset.h --- linux-2.4.34/include/asm-i386/page_offset.h Thu Jan 1 01:00:00 1970 +++ linux-2.4.34-3g/include/asm-i386/page_offset.h Sat Feb 17 20:56:25 2007 @@ -0,0 +1,23 @@ +#include + +/* + * NB: we can subtract 128 MB so that we don't have to enable CONFIG_HIGHMEM + * just to access the last 128 MB of the first GB. However, some programs + * which heavily rely on PAGE_OFFSET value may break (eg: vmware). + */ + +#if defined(CONFIG_0_9GB) +#define __PAGE_OFFSET 0xC0000000 +#elif defined(CONFIG_1_0GB) +#define __PAGE_OFFSET 0xB8000000 +#elif defined(CONFIG_1_9GB) +#define __PAGE_OFFSET 0x80000000 +#elif defined(CONFIG_2_0GB) +#define __PAGE_OFFSET 0x78000000 +#elif defined(CONFIG_2_9GB) +#define __PAGE_OFFSET 0x40000000 +#elif defined(CONFIG_3_0GB) +#define __PAGE_OFFSET 0x38000000 +#else +#error "I don't know what memory splitting scheme you want !" +#endif diff -urN linux-2.4.34/mm/memory.c linux-2.4.34-3g/mm/memory.c --- linux-2.4.34/mm/memory.c Sat Feb 17 10:09:21 2007 +++ linux-2.4.34-3g/mm/memory.c Sat Feb 17 20:34:20 2007 @@ -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); }