mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stratos Psomadakis <psomas@cslab.ece.ntua.gr>
To: linux-kernel@vger.kernel.org
Cc: Stratos Psomadakis <psomas@cslab.ece.ntua.gr>
Subject: [PATCH 2/2] head_32.S: Update the comments for the initial kernel mapping(KERNEL_IMAGE_SIZE no longer used)
Date: Sun, 27 Feb 2011 23:21:38 +0200	[thread overview]
Message-ID: <1298841698-31823-3-git-send-email-psomas@cslab.ece.ntua.gr> (raw)
In-Reply-To: <1298841698-31823-1-git-send-email-psomas@cslab.ece.ntua.gr>

Update the comments regarding the initial kernel mapping in head_32.S and 
cleanup the code(KERNEL_IMAGE_SIZE no longer used).

Signed-off-by: Stratos Psomadakis <psomas@cslab.ece.ntua.gr>
---
 arch/x86/kernel/head_32.S |   44 +++++++++++++++++---------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 187aa63..77990a5 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -39,42 +39,32 @@
 #define X86_VENDOR_ID	new_cpu_data+CPUINFO_x86_vendor_id
 
 /*
- * This is how much memory in addition to the memory covered up to
- * and including _end we need mapped initially.
- * We need:
- *     (KERNEL_IMAGE_SIZE/4096) / 1024 pages (worst case, non PAE)
- *     (KERNEL_IMAGE_SIZE/4096) / 512 + 4 pages (worst case for PAE)
- *
- * Modulo rounding, each megabyte assigned here requires a kilobyte of
- * memory, which is currently unreclaimed.
- *
- * This should be a multiple of a page.
- *
- * KERNEL_IMAGE_SIZE should be greater than pa(_end)
- * and small than max_low_pfn, otherwise will waste some page table entries
+ * Worst-case size of the kernel mapping we need to make:
+ * a relocatable kernel can live anywhere in lowmem, so we need to be able
+ * to map all of lowmem.
  */
 
-#if PTRS_PER_PMD > 1
-#define PAGE_TABLE_SIZE(pages) (((pages) / PTRS_PER_PMD) + PTRS_PER_PGD)
-#else
-#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD)
-#endif
-
 /* Number of possible pages in the lowmem region */
 LOWMEM_PAGES = (((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT)
-	
-/* Enough space to fit pagetables for the low memory linear map */
-MAPPING_BEYOND_END = PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT
 
 /*
- * Worst-case size of the kernel mapping we need to make:
- * a relocatable kernel can live anywhere in lowmem, so we need to be able
- * to map all of lowmem.
+ * This is the size of the pagetable(in pages) we need for the kernel mapping.
+ * We need:
+ *     LOWMEM_PAGES / 1024 pages (worst case, non PAE)
+ *     LOWMEM_PAGES / 512 + 4 pages (worst casem, PAE)
  */
-KERNEL_PAGES = LOWMEM_PAGES
 
-INIT_MAP_SIZE = PAGE_TABLE_SIZE(KERNEL_PAGES) * PAGE_SIZE
+#if PTRS_PER_PMD > 1
+#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PMD) + PTRS_PER_PGD
+#else
+#define PAGE_TABLE_SIZE(pages) (pages) / PTRS_PER_PGD
+#endif
+
+INIT_MAP_SIZE = PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT
 RESERVE_BRK(pagetables, INIT_MAP_SIZE)
+	
+/* Map enough space after _end for the lowmem linear map */
+MAPPING_BEYOND_END = INIT_MAP_SIZE
 
 /*
  * 32-bit kernel entrypoint; only used by the boot CPU.  On entry,
-- 
1.7.4.1


  parent reply	other threads:[~2011-02-27 21:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-27 21:21 [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
2011-02-27 21:21 ` [PATCH 1/2] Remove KERNEL_IMAGE_SIZE for x86_32 code(no longer used) Stratos Psomadakis
2011-02-27 21:21 ` Stratos Psomadakis [this message]
2011-02-28 19:58 ` [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis

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=1298841698-31823-3-git-send-email-psomas@cslab.ece.ntua.gr \
    --to=psomas@cslab.ece.ntua.gr \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome