mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i386 boot pagetables cleanup part 2
@ 2002-08-04 16:32 Brian Gerst
  0 siblings, 0 replies; only message in thread
From: Brian Gerst @ 2002-08-04 16:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

Reorganize i386/kernel/head.S to eliminate the .org directives.
- boot_pgtables move to .data.init so they can be reclaimed after the 
final pagetables are set up.
- empty_zero_page and swapper_pg_dir move to .data.page_aligned
- the IDT and GDT descriptors are moved to .data

The end effect is that we can now fully use the first page of head.S 
saving about half a page of memory.

--
				Brian Gerst

[-- Attachment #2: boot_pte2-1 --]
[-- Type: text/plain, Size: 3312 bytes --]

diff -urN linux-bg1/arch/i386/kernel/head.S linux/arch/i386/kernel/head.S
--- linux-bg1/arch/i386/kernel/head.S	Sun Aug  4 11:01:52 2002
+++ linux/arch/i386/kernel/head.S	Sun Aug  4 11:58:40 2002
@@ -339,6 +339,19 @@
 	iret
 
 /*
+ * 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
+
+/*
  * The IDT and GDT 'descriptors' are a strange 48-bit object
  * only used by the lidt and lgdt instructions. They are not
  * like usual segment descriptors - they consist of a 16-bit
@@ -362,53 +375,6 @@
 
 	.fill NR_CPUS-1,6,0		# space for the other GDT descriptors
 
-/*
- * This is initialized to create an identity-mapping at 0-8M (for bootup
- * purposes) and another mapping of the 0-8M area at virtual address
- * PAGE_OFFSET.
- */
-.org 0x1000
-ENTRY(swapper_pg_dir)
-	.long 0x0007 + __PA(boot_pgtables)
-	.long 0x1007 + __PA(boot_pgtables)
-	/* default: 766 entries */
-	.fill BOOT_USER_PGD_PTRS-2,4,0
-	.long 0x0007 + __PA(boot_pgtables)
-	.long 0x1007 + __PA(boot_pgtables)
-	/* default: 254 entries */
-	.fill BOOT_KERNEL_PGD_PTRS-2,4,0
-
-/*
- * The page tables are initialized to only 8MB here - the final page
- * tables are set up later depending on memory size.
- */
-.org 0x2000
-boot_pgtables:
-
-/*
- * empty_zero_page must immediately follow the page tables ! (The
- * initialization loop counts until empty_zero_page)
- */
-
-.org 0x4000
-boot_pgtables_end:
-ENTRY(empty_zero_page)
-
-.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
 /*
  * The Global Descriptor Table contains 20 quadwords, per-CPU.
@@ -444,3 +410,26 @@
 	.fill (NR_CPUS-1)*GDT_ENTRIES,8,0 /* other CPU's GDT */
 #endif
 
+.section .data.page_aligned, "aw"
+ENTRY(empty_zero_page)
+	.fill 4096,1,0
+
+/*
+ * This is initialized to create an identity-mapping at 0-8M (for bootup
+ * purposes) and another mapping of the 0-8M area at virtual address
+ * PAGE_OFFSET.
+ */
+ENTRY(swapper_pg_dir)
+	.long 0x0007 + __PA(boot_pgtables)
+	.long 0x1007 + __PA(boot_pgtables)
+	/* default: 766 entries */
+	.fill BOOT_USER_PGD_PTRS-2,4,0
+	.long 0x0007 + __PA(boot_pgtables)
+	.long 0x1007 + __PA(boot_pgtables)
+	/* default: 254 entries */
+	.fill BOOT_KERNEL_PGD_PTRS-2,4,0
+
+.section .data.boot_pgtable, "aw"
+boot_pgtables:
+	.fill 2*4096,1,0
+boot_pgtables_end:
diff -urN linux-bg1/arch/i386/vmlinux.lds linux/arch/i386/vmlinux.lds
--- linux-bg1/arch/i386/vmlinux.lds	Tue Jul 23 19:19:44 2002
+++ linux/arch/i386/vmlinux.lds	Sun Aug  4 11:59:19 2002
@@ -63,6 +63,7 @@
   .data.percpu  : { *(.data.percpu) }
   __per_cpu_end = .;
   . = ALIGN(4096);
+  .data.boot_pgtable : { *(.data.boot_pgtable) }
   __init_end = .;
 
   . = ALIGN(4096);
@@ -72,7 +73,7 @@
   __nosave_end = .;
 
   . = ALIGN(4096);
-  .data.page_aligned : { *(.data.idt) }
+  .data.page_aligned : { *(.data.page_aligned) *(.data.idt) }
 
   . = ALIGN(32);
   .data.cacheline_aligned : { *(.data.cacheline_aligned) }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-04 16:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-04 16:32 [PATCH] i386 boot pagetables cleanup part 2 Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®