[OpenBIOS] [PATCHv2 3/4] SPARC32: mark pre-loaded kernel image memory as being in use

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Feb 22 22:27:32 CET 2015


This is to ensure that a client OS reading the memory lists from the PROM
won't consider its own memory space available.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/arch/sparc32/openbios.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c
index 32255b6..6f4ee45 100644
--- a/openbios-devel/arch/sparc32/openbios.c
+++ b/openbios-devel/arch/sparc32/openbios.c
@@ -865,9 +865,14 @@ arch_init( void )
         romvec = init_openprom();
 
 	kernel_size = fw_cfg_read_i32(FW_CFG_KERNEL_SIZE);
-	if (kernel_size)
+	if (kernel_size) {
 		kernel_image = fw_cfg_read_i32(FW_CFG_KERNEL_ADDR);
 
+		/* Mark the kernel memory as in use */
+		ofmem_claim_phys(PAGE_ALIGN(kernel_image), PAGE_ALIGN(kernel_size), 0);
+		ofmem_claim_virt(PAGE_ALIGN(kernel_image), PAGE_ALIGN(kernel_size), 0);
+	}
+
         kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE);
         if (kernel_cmdline) {
             cmdline = strdup(kernel_cmdline);
-- 
1.7.10.4




More information about the OpenBIOS mailing list