public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Brian Gerst <bgerst@didntduck.org>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org,
	Zwane Mwaikambo <zwane@linuxpower.ca>
Subject: Re: [PATCH] more i386 head.S cleanups
Date: Sat, 3 Apr 2004 10:02:26 -0600	[thread overview]
Message-ID: <20040403160226.GY6248@waste.org> (raw)
In-Reply-To: <406ECAE7.1020407@quark.didntduck.org>

On Sat, Apr 03, 2004 at 09:32:07AM -0500, Brian Gerst wrote:
> - Move empty_zero_page and swapper_pg_dir to BSS.  This requires that 
> BSS is cleared earlier, but reclaims over 3k that was lost due to page 
> alignment.
> - Move stack_start, ready, and int_msg, boot_gdt_descr, idt_descr, and 
> cpu_gdt_descr to .data.  They were interfering with disassembly while in 
> .text.

Nice. Do you mean 3k here or 0x3000? 

On a related note, I've been sitting on this patch which reorders the
bootstrap code so we can free most of it once we're up:


drop i386 bootstrap text

From: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Subject: [PATCH][2.6-tiny] free i386 bootstrap text

Shuffle the idt/gdt descriptors around so that we get a full page and then
free it.

Index: linux-2.6.1-rc1-tiny2/arch/i386/kernel/head.S
===================================================================
RCS file: /home/cvsroot/linux-2.6.1-rc1-tiny2/arch/i386/kernel/head.S,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 head.S


 tiny-mpm/arch/i386/kernel/head.S |   40 +++++++++++++++++++--------------------
 tiny-mpm/arch/i386/mm/init.c     |    8 +++++++
 2 files changed, 28 insertions(+), 20 deletions(-)

diff -puN arch/i386/kernel/head.S~bootstrap-free arch/i386/kernel/head.S
--- tiny/arch/i386/kernel/head.S~bootstrap-free	2004-03-20 12:14:33.000000000 -0600
+++ tiny-mpm/arch/i386/kernel/head.S	2004-03-20 12:14:33.000000000 -0600
@@ -386,6 +386,26 @@ ignore_int:
 	iret
 
 /*
+ * swapper_pg_dir is the main page directory, address 0x00101000
+ *
+ * This is initialized to create an identity-mapping at 0 (for bootup
+ * purposes) and another mapping at virtual address PAGE_OFFSET.  The
+ * values put here should be all invalid (zero); the valid
+ * entries are created dynamically at boot time.
+ *
+ * The code creates enough page tables to map 0-_end, the page tables
+ * themselves, plus INIT_MAP_BEYOND_END bytes; see comment at beginning.
+ */
+.org 0x1000
+ENTRY(swapper_pg_dir)
+	.fill 1024,4,0
+
+.org 0x2000
+ENTRY(empty_zero_page)
+	.fill 4096,1,0
+
+.org 0x3000
+/*
  * 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
@@ -417,26 +437,6 @@ cpu_gdt_descr:
 	.fill NR_CPUS-1,8,0		# space for the other GDT descriptors
 
 /*
- * swapper_pg_dir is the main page directory, address 0x00101000
- *
- * This is initialized to create an identity-mapping at 0 (for bootup
- * purposes) and another mapping at virtual address PAGE_OFFSET.  The
- * values put here should be all invalid (zero); the valid
- * entries are created dynamically at boot time.
- *
- * The code creates enough page tables to map 0-_end, the page tables
- * themselves, plus INIT_MAP_BEYOND_END bytes; see comment at beginning.
- */
-.org 0x1000
-ENTRY(swapper_pg_dir)
-	.fill 1024,4,0
-
-.org 0x2000
-ENTRY(empty_zero_page)
-	.fill 4096,1,0
-
-.org 0x3000
-/*
  * Real beginning of normal "text" segment
  */
 ENTRY(stext)
diff -puN arch/i386/mm/init.c~bootstrap-free arch/i386/mm/init.c
--- tiny/arch/i386/mm/init.c~bootstrap-free	2004-03-20 12:14:33.000000000 -0600
+++ tiny-mpm/arch/i386/mm/init.c	2004-03-20 12:14:33.000000000 -0600
@@ -586,6 +586,14 @@ void free_initmem(void)
 		free_page(addr);
 		totalram_pages++;
 	}
+
+	/* free early bootstrap code in head.S */
+	addr = (unsigned long)&_text;
+	ClearPageReserved(virt_to_page(addr));
+	set_page_count(virt_to_page(addr), 1);
+	free_page(addr);
+	totalram_pages++;
+
 	printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10);
 }
 

_



-- 
Matt Mackall : http://www.selenic.com : Linux development and consulting

  reply	other threads:[~2004-04-03 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-03 14:32 [PATCH] more i386 head.S cleanups Brian Gerst
2004-04-03 16:02 ` Matt Mackall [this message]
2004-04-03 22:48   ` Brian Gerst
2004-04-03 23:51     ` Zwane Mwaikambo
2004-04-15 14:14 ` Coywolf Qi Hunt
2004-04-15 14:19   ` Randy.Dunlap
2004-04-15 20:58 ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040403160226.GY6248@waste.org \
    --to=mpm@selenic.com \
    --cc=akpm@osdl.org \
    --cc=bgerst@didntduck.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@linuxpower.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox