public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hariprasad Nellitheertha <hari@in.ibm.com>
To: Andi Kleen <ak@muc.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][i386] Comma parsing for the memmap= kernel command line option
Date: Thu, 28 Apr 2005 16:30:38 +0530	[thread overview]
Message-ID: <4270C256.2080905@in.ibm.com> (raw)
In-Reply-To: <4270C213.80408@in.ibm.com>

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

Regards, Hari

[-- Attachment #2: i386-memmap-comma-parsing.patch --]
[-- Type: text/plain, Size: 3302 bytes --]


This patch adds comma parsing ability to the i386
memmap= kernel command line option. With this, multiple
entries to memmap can be separated by a comma instead of
separate entries.

For example, memmap=exactmap,640k@0M,1024M@1M

Signed-off-by: Hariprasad Nellitheertha <hari@in.ibm.com>
---

 linux-2.6.12-rc2-hari/arch/i386/kernel/setup.c |   79 +++++++++++++------------
 1 files changed, 43 insertions(+), 36 deletions(-)

diff -puN arch/i386/kernel/setup.c~i386-memmap-comma-parsing arch/i386/kernel/setup.c
--- linux-2.6.12-rc2/arch/i386/kernel/setup.c~i386-memmap-comma-parsing	2005-04-27 16:30:05.000000000 +0530
+++ linux-2.6.12-rc2-hari/arch/i386/kernel/setup.c	2005-04-28 15:04:42.000000000 +0530
@@ -716,45 +716,52 @@ static void __init parse_cmdline_early (
 		}
 
 		else if (!memcmp(from, "memmap=", 7)) {
-			if (to != command_line)
-				to--;
-			if (!memcmp(from+7, "exactmap", 8)) {
+			from += 7;
+			do {
+				if (to != command_line)
+					to--;
+				if (!memcmp(from, "exactmap", 8)) {
 #ifdef CONFIG_CRASH_DUMP
-				/* If we are doing a crash dump, we
-				 * still need to know the real mem
-				 * size before original memory map is
-				 * reset.
-				 */
-				find_max_pfn();
-				saved_max_pfn = max_pfn;
-#endif
-				from += 8+7;
-				e820.nr_map = 0;
-				userdef = 1;
-			} else {
-				/* If the user specifies memory size, we
-				 * limit the BIOS-provided memory map to
-				 * that size. exactmap can be used to specify
-				 * the exact map. mem=number can be used to
-				 * trim the existing memory map.
-				 */
-				unsigned long long start_at, mem_size;
- 
-				mem_size = memparse(from+7, &from);
-				if (*from == '@') {
-					start_at = memparse(from+1, &from);
-					add_memory_region(start_at, mem_size, E820_RAM);
-				} else if (*from == '#') {
-					start_at = memparse(from+1, &from);
-					add_memory_region(start_at, mem_size, E820_ACPI);
-				} else if (*from == '$') {
-					start_at = memparse(from+1, &from);
-					add_memory_region(start_at, mem_size, E820_RESERVED);
+					/* If we are doing a crash dump, we
+					 * still need to know the real mem
+					 * size before original memory map is
+					 * reset.
+					 */
+					find_max_pfn();
+					saved_max_pfn = max_pfn;
+#endif
+					from += 8;
+					e820.nr_map = 0;
+					userdef = 1;
 				} else {
-					limit_regions(mem_size);
-					userdef=1;
+					/* If the user specifies memory size, we
+					 * limit the BIOS-provided memory map to
+					 * that size. exactmap can be used to specify
+					 * the exact map. mem=number can be used to
+					 * trim the existing memory map.
+					 */
+					unsigned long long start_at, mem_size;
+
+					mem_size = memparse(from, &from);
+					if (*from == '@') {
+						start_at = memparse(from+1, &from);
+						add_memory_region(start_at, mem_size, E820_RAM);
+					} else if (*from == '#') {
+						start_at = memparse(from+1, &from);
+						add_memory_region(start_at, mem_size, E820_ACPI);
+					} else if (*from == '$') {
+						start_at = memparse(from+1, &from);
+						add_memory_region(start_at, mem_size, E820_RESERVED);
+					} else {
+						limit_regions(mem_size);
+						userdef=1;
+					}
 				}
-			}
+				if (*from != ',')
+					break;
+				else
+					from += 1;
+			} while(1);
 		}
 
 		else if (!memcmp(from, "noexec=", 7))
_

      reply	other threads:[~2005-04-28 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-15  6:13 [RFC][x86_64] Introducing the memmap= kernel command line option Hariprasad Nellitheertha
2005-04-15 17:30 ` Andi Kleen
2005-04-18 12:47   ` Hariprasad Nellitheertha
2005-04-28 10:59   ` Hariprasad Nellitheertha
2005-04-28 11:00     ` Hariprasad Nellitheertha [this message]

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=4270C256.2080905@in.ibm.com \
    --to=hari@in.ibm.com \
    --cc=ak@muc.de \
    --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