Configurable larger physical memory

Bernd Paysan (bernd.paysan@gmx.de)
Sat, 17 Apr 1999 21:33:57 +0200 (MEST)


Hi!

To make it more difficult for M$ paid testers not to tune the amount of
physical memory Linux uses, I added a kernel configure for that (Intel
arch only). You can select one, two, three, or almost four GB of physical
memory (which leaves 192M for the app - should be sufficient for a
file/web server). It also updates vmlinux.lds correctly.

This is a patch against version 2.2.5.

Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/

--- linux-2.2.5/arch/i386/config.in.orig Sat Apr 17 19:26:41 1999
+++ linux/arch/i386/config.in Sat Apr 17 19:30:48 1999
@@ -17,6 +17,10 @@
586/K5/5x86/6x86 CONFIG_M586 \
Pentium/K6/TSC CONFIG_M586TSC \
PPro/6x86MX CONFIG_M686" PPro
+choice 'Maximum Physical Memory' \
+ "1GB CONFIG_1GB \
+ 2GB CONFIG_2GB \
+ 3GB CONFIG_3GB \
+ 4GB CONFIG_4GB" 1GB
#
# Define implied options from the CPU selection here
#
--- linux-2.2.5/arch/i386/defconfig.orig Sat Apr 17 19:32:40 1999
+++ linux/arch/i386/defconfig Sat Apr 17 19:33:02 1999
@@ -15,6 +15,7 @@
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
CONFIG_M686=y
+CONFIG_1GB=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
--- linux-2.2.5/arch/i386/Makefile.orig Sat Apr 17 19:34:36 1999
+++ linux/arch/i386/Makefile Sat Apr 17 20:58:33 1999
@@ -62,6 +62,13 @@

MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot

+vmlinux: arch/i386/vmlinux.lds
+
+arch/i386/vmlinux.lds: arch/i386/vmlinux.lds.in FORCE
+ cpp -C -P -I$(HPATH) -imacros $(HPATH)/asm-i386/page_offset.h -Ui386 <arch/i386/vmlinux.lds.in >arch/i386/vmlinux.lds
+
+FORCE: ;
+
zImage: vmlinux
@$(MAKEBOOT) zImage

--- linux-2.2.5/arch/i386/vmlinux.lds.in.orig Sat Apr 17 20:56:49 1999
+++ linux/arch/i386/vmlinux.lds.in Sat Apr 17 20:50:45 1999
@@ -0,0 +1,69 @@
+/* ld script to make i386 Linux kernel
+ * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ */
+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
+ .text.lock : { *(.text.lock) } /* out-of-line lock text */
+ .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 = .;
+
+ _etext = .; /* End of text section */
+
+ .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(4096);
+ __init_end = .;
+
+ . = ALIGN(32);
+ .data.cacheline_aligned : { *(.data.cacheline_aligned) }
+
+ . = ALIGN(4096);
+ .data.page_aligned : { *(.data.idt) }
+
+
+ __bss_start = .; /* BSS */
+ .bss : {
+ *(.bss)
+ }
+ _end = . ;
+
+ /* 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) }
+}
--- linux-2.2.5/include/asm-i386/page.h.orig Sat Apr 17 19:36:50 1999
+++ linux/include/asm-i386/page.h Sat Apr 17 20:55:29 1999
@@ -79,7 +79,10 @@
*
* which has the same constant encoded..
*/
-#define __PAGE_OFFSET (0xC0000000)
+
+#include <asm/page_offset.h>
+
+#define __PAGE_OFFSET (PAGE_OFFSET_RAW)

#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
--- linux-2.2.5/include/asm-i386/page_offset.h.orig Sat Apr 17 20:59:41 1999
+++ linux/include/asm-i386/page_offset.h Sat Apr 17 20:50:25 1999
@@ -0,0 +1,10 @@
+#include <linux/config.h>
+#ifdef 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
+#elif defined(CONFIG_4GB)
+#define PAGE_OFFSET_RAW 0x0C000000 /* it isn't really 4GB, but close */
+#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/