clean-up left-over arch-depend code from kernel base
authorLunaixsky <lunaixsky@qq.com>
Sun, 6 Oct 2024 17:23:02 +0000 (18:23 +0100)
committerLunaixsky <lunaixsky@qq.com>
Sun, 6 Oct 2024 17:23:02 +0000 (18:23 +0100)
* ref: restructure the trace related arch-dependent stuff to make it
       less redundant
* ref: rename the boot_end/boot_start section markers so it will not
       conflict with out in name (in particular the boot_end() function)
* ref: remove the reference to port-io thing from ahci driver base
* ref: only compile the pmio vairant of uart when the correspond,
  arch-related feature is turned on.
* ref: temporary disable the vga module, as it is incompleted and buggy
* fix: add back a missing #include to asm/cpu.h

lunaix-os/arch/generic/includes/sys-generic/trace_arch.h
lunaix-os/hal/ahci/ahci.c
lunaix-os/hal/char/uart/LBuild
lunaix-os/hal/char/uart/LConfig
lunaix-os/hal/gfxa/LBuild
lunaix-os/includes/lunaix/hart_state.h
lunaix-os/includes/lunaix/sections.h
lunaix-os/includes/lunaix/syscall.h
lunaix-os/kernel/debug/trace.c
lunaix-os/kernel/spike.c

index 83953d1fb1a9f2bc953f5a5e253c95d135e7e1fd..4ff75b27d51a5fee834b6c7242e74bc1fb41f672 100644 (file)
@@ -3,6 +3,13 @@
 
 #include <lunaix/hart_state.h>
 
 
 #include <lunaix/hart_state.h>
 
+static inline bool 
+arch_valid_fp(ptr_t ptr) {
+    extern int __bsskstack_end[];
+    extern int __bsskstack_start[];
+    return ((ptr_t)__bsskstack_start <= ptr && ptr <= (ptr_t)__bsskstack_end);
+}
+
 void
 trace_print_transistion_short(struct hart_state* hstate);
 
 void
 trace_print_transistion_short(struct hart_state* hstate);
 
index f40ae2428a135457793da09bf209e42d271ab73c..2de7e98ad5888aed61a58227d6a0ae56f9ebecfb 100644 (file)
@@ -14,8 +14,6 @@
 #include <hal/ahci/scsi.h>
 #include <hal/pci.h>
 
 #include <hal/ahci/scsi.h>
 #include <hal/pci.h>
 
-#include <asm/x86_pmio.h>
-
 #include <klibc/string.h>
 #include <lunaix/block.h>
 #include <asm-generic/isrm.h>
 #include <klibc/string.h>
 #include <lunaix/block.h>
 #include <asm-generic/isrm.h>
@@ -71,7 +69,7 @@ __hba_reset_port(hba_reg_t* port_reg)
     }
     // 如果port未响应,则继续执行重置
     port_reg[HBA_RPxSCTL] = (port_reg[HBA_RPxSCTL] & ~0xf) | 1;
     }
     // 如果port未响应,则继续执行重置
     port_reg[HBA_RPxSCTL] = (port_reg[HBA_RPxSCTL] & ~0xf) | 1;
-    port_delay(100000); // 等待至少一毫秒,差不多就行了
+
     port_reg[HBA_RPxSCTL] &= ~0xf;
 }
 
     port_reg[HBA_RPxSCTL] &= ~0xf;
 }
 
index 83088c659775567aec63e6887517442122d9901f..ebbb8491eddc4c2e9e91d2fdafe70183b924d2cc 100644 (file)
@@ -1,11 +1,16 @@
 sources([
     "16x50_base.c",
 sources([
     "16x50_base.c",
-    "16x50_pmio.c",
     "16x50_mmio.c",
 ])
 
 if config("xt_16x50"):
     "16x50_mmio.c",
 ])
 
 if config("xt_16x50"):
-    sources("16x50_isa.c")
+    sources([
+        "16x50_pmio.c", 
+        "16x50_isa.c"
+    ])
 
 if config("pci_16x50"):
 
 if config("pci_16x50"):
-    sources("16x50_pci.c")
\ No newline at end of file
+    sources([
+        "16x50_pmio.c", 
+        "16x50_pci.c"
+    ])
\ No newline at end of file
index 9ed1f09ec4d63177d8437e5b264c01477234986c..4b59141dbd49dbb961891dedc7d2f35bab25c9f2 100644 (file)
@@ -13,7 +13,10 @@ def uart_16x50():
         type(bool)
 
         is_x86 = v(arch) in ["i386", "x86_64"]
         type(bool)
 
         is_x86 = v(arch) in ["i386", "x86_64"]
-        default(is_x86)
+        if not is_x86:
+            set_value(False)
+        else:
+            default(is_x86)
 
         return is_x86
     
 
         return is_x86
     
index 54d50d131eb44d4c60310e87441ea305fb9e4488..d43f9357ca2e8b3d853c24e9054f7b62b80fcb9d 100644 (file)
@@ -1,4 +1,4 @@
-use("vga")
+use("vga")
 
 sources([
     "gfxm.c"
 
 sources([
     "gfxm.c"
index 5ec53bf57e50580d7a08a21f14756ff0da751805..e9d0f1c25d0425a5836f4951b0e50c6f4ee7589f 100644 (file)
@@ -14,7 +14,7 @@ struct hart_transition
     struct {
         struct hart_state state;
         struct exec_param eret;
     struct {
         struct hart_state state;
         struct exec_param eret;
-    } compact transfer;
+    } transfer;
 };
 
 bool
 };
 
 bool
index daa5ccc5fbffe5ea3713d04b9ee09def21f58d9c..1fe6604e03e7c8e3fdff618470a9ba1466c82fee 100644 (file)
@@ -27,8 +27,8 @@
 #define reclaimable_start   __section_mark(bssreclaim, start)
 #define reclaimable_end     __section_mark(bssreclaim, end)
 
 #define reclaimable_start   __section_mark(bssreclaim, start)
 #define reclaimable_end     __section_mark(bssreclaim, end)
 
-#define boot_start          __section_mark(kboot, start)
-#define boot_end            __section_mark(kboot, end)
+#define bootsec_start       __section_mark(kboot, start)
+#define bootsec_end         __section_mark(kboot, end)
 
 #define kernel_start        __section_mark(kexec, start)
 #define kernel_load_end     __section_mark(kexec, end)
 
 #define kernel_start        __section_mark(kexec, start)
 #define kernel_load_end     __section_mark(kexec, end)
index 1b9778f79b2a783e09b2509ab908a9a2bdbb637b..3884f2a47edcfcaaeb05657e714a52657ee998e3 100644 (file)
@@ -5,9 +5,9 @@
 
 #ifndef __ASM__
 
 
 #ifndef __ASM__
 
-#define SYSCALL_ESTATUS(errno) -((errno) != 0)
+#include <lunaix/compiler.h>
 
 
-#define asmlinkage __attribute__((regparm(0)))
+#define SYSCALL_ESTATUS(errno) -((errno) != 0)
 
 #define __PARAM_MAP1(t1, p1) t1 p1
 #define __PARAM_MAP2(t1, p1, ...) t1 p1, __PARAM_MAP1(__VA_ARGS__)
 
 #define __PARAM_MAP1(t1, p1) t1 p1
 #define __PARAM_MAP2(t1, p1, ...) t1 p1, __PARAM_MAP1(__VA_ARGS__)
index 77b332081adb652ea71f6f46508ac9fd977499d0..f5c46751d541a17ce288f094eb3831554ad6c2a9 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <asm/abi.h>
 #include <asm/mm_defs.h>
 
 #include <asm/abi.h>
 #include <asm/mm_defs.h>
-#include <sys/trace.h>
 
 #include <klibc/string.h>
 
 
 #include <klibc/string.h>
 
index e1983df04f74830678baac8e42eddb6d2546e694..ba8f8049bedbab65b0b66dfbebbccf5d987517c2 100644 (file)
@@ -5,6 +5,8 @@
 #include <lunaix/trace.h>
 #include <lunaix/failsafe.h>
 
 #include <lunaix/trace.h>
 #include <lunaix/failsafe.h>
 
+#include <asm/cpu.h>
+
 LOG_MODULE("spike")
 
 void noret
 LOG_MODULE("spike")
 
 void noret