[PATCH] i386 boot pagetables cleanup part 2

From: Brian Gerst (bgerst@didntduck.org)
Date: Sun Aug 04 2002 - 11:32:38 EST


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

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) }

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



This archive was generated by hypermail 2b29 : Wed Aug 07 2002 - 22:00:24 EST