[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210607023611.159804-1-wangkefeng.wang@huawei.com>
Date: Mon, 7 Jun 2021 10:36:11 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
<linux-kernel@...r.kernel.org>
CC: <linux-mm@...ck.org>, Kefeng Wang <wangkefeng.wang@...wei.com>,
<linux-snps-arc@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-csky@...r.kernel.org>,
<uclinux-h8-devel@...ts.sourceforge.jp>,
<linux-m68k@...ts.linux-m68k.org>, <openrisc@...ts.librecores.org>,
<linuxppc-dev@...ts.ozlabs.org>, <linux-riscv@...ts.infradead.org>,
<linux-sh@...r.kernel.org>, <linux-s390@...r.kernel.org>,
<x86@...nel.org>
Subject: [PATCH v3] mm: add setup_initial_init_mm() helper
Add setup_initial_init_mm() helper to setup kernel text,
data and brk.
Cc: linux-snps-arc@...ts.infradead.org
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linux-csky@...r.kernel.org
Cc: uclinux-h8-devel@...ts.sourceforge.jp
Cc: linux-m68k@...ts.linux-m68k.org
Cc: openrisc@...ts.librecores.org
Cc: linuxppc-dev@...ts.ozlabs.org
Cc: linux-riscv@...ts.infradead.org
Cc: linux-sh@...r.kernel.org
Cc: linux-s390@...r.kernel.org
Cc: x86@...nel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
---
v3: declaration in mm.h, implemention in init-mm.c
include/linux/mm.h | 3 +++
mm/init-mm.c | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c274f75efcf9..02aa057540b7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -244,6 +244,9 @@ int __add_to_page_cache_locked(struct page *page, struct address_space *mapping,
#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
+void setup_initial_init_mm(void *start_code, void *end_code,
+ void *end_data, void *brk);
+
/*
* Linux kernel virtual memory manager primitives.
* The idea being to have a "virtual" mm in the same way
diff --git a/mm/init-mm.c b/mm/init-mm.c
index 153162669f80..b4a6f38fb51d 100644
--- a/mm/init-mm.c
+++ b/mm/init-mm.c
@@ -40,3 +40,12 @@ struct mm_struct init_mm = {
.cpu_bitmap = CPU_BITS_NONE,
INIT_MM_CONTEXT(init_mm)
};
+
+void setup_initial_init_mm(void *start_code, void *end_code,
+ void *end_data, void *brk)
+{
+ init_mm.start_code = (unsigned long)start_code;
+ init_mm.end_code = (unsigned long)end_code;
+ init_mm.end_data = (unsigned long)end_data;
+ init_mm.brk = (unsigned long)brk;
+}
--
2.26.2
Powered by blists - more mailing lists