From 5490de9fd26db43610e4f0a891d27479aea83dcc Mon Sep 17 00:00:00 2001
From: 4lDO2 <4lDO2@protonmail.com>
Date: Sat, 18 Apr 2020 17:33:03 +0200
Subject: [PATCH] Fix a page fault.

---
 src/arch/x86_64/start.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/arch/x86_64/start.rs b/src/arch/x86_64/start.rs
index 86d9cbcf..11f8404c 100644
--- a/src/arch/x86_64/start.rs
+++ b/src/arch/x86_64/start.rs
@@ -70,6 +70,8 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
         let stack_size = args.stack_size as usize;
         let env_base = args.env_base as usize;
         let env_size = args.env_size as usize;
+        let acpi_rsdps_base = args.acpi_rsdps_base;
+        let acpi_rsdps_size = args.acpi_rsdps_size;
 
         // BSS should already be zero
         {
@@ -83,10 +85,10 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
         println!("Kernel: {:X}:{:X}", kernel_base, kernel_base + kernel_size);
         println!("Stack: {:X}:{:X}", stack_base, stack_base + stack_size);
         println!("Env: {:X}:{:X}", env_base, env_base + env_size);
-        println!("RSDPs: {:X}:{:X}", args.acpi_rsdps_base, args.acpi_rsdps_base + args.acpi_rsdps_size);
+        println!("RSDPs: {:X}:{:X}", acpi_rsdps_base, acpi_rsdps_base + acpi_rsdps_size);
 
         let ext_mem_ranges = if args.acpi_rsdps_base != 0 && args.acpi_rsdps_size > 0 {
-            Some([(args.acpi_rsdps_base as usize, args.acpi_rsdps_size as usize)])
+            Some([(acpi_rsdps_base as usize, acpi_rsdps_size as usize)])
         } else {
             None
         };
@@ -143,7 +145,7 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
         // Read ACPI tables, starts APs
         #[cfg(feature = "acpi")]
         {
-            acpi::init(&mut active_table, if args.acpi_rsdps_base != 0 && args.acpi_rsdps_size > 0 { Some((args.acpi_rsdps_base, args.acpi_rsdps_size)) } else { None });
+            acpi::init(&mut active_table, if acpi_rsdps_base != 0 && acpi_rsdps_size > 0 { Some((acpi_rsdps_base, acpi_rsdps_size)) } else { None });
             device::init_after_acpi(&mut active_table);
         }
 
-- 
GitLab