feat: partial PCIe support (MCFG table parsing)
[lunaix-os.git] / lunaix-os / kernel / proc0.c
index cece3687e4abd30e0c9949d87e34ccedf49498a9..92d3fd3df34478c42da249d81649b43414902e0d 100644 (file)
@@ -14,6 +14,7 @@
 #include <hal/acpi/acpi.h>
 #include <hal/apic.h>
 #include <hal/ioapic.h>
+#include <hal/pci.h>
 
 LOG_MODULE("PROC0")
 
@@ -32,13 +33,38 @@ unlock_reserved_memory();
 void
 __do_reserved_memory(int unlock);
 
+//#define USE_DEMO
+#define DEMO_SIGNAL
+
+extern void
+_pconsole_main();
+
+extern void
+_signal_demo_main();
+
+extern void
+_lxinit_main();
+
 void __USER__
 __proc0_usr()
 {
+    pid_t p;
     if (!fork()) {
-        asm("jmp _lxinit_main");
+        _pconsole_main();
     }
 
+    if (!(p = fork())) {
+#ifndef USE_DEMO
+        _exit(0);
+#elif defined DEMO_SIGNAL
+        _signal_demo_main();
+#else
+        _lxinit_main();
+#endif
+    }
+
+    waitpid(p, 0, 0);
+
     while (1) {
         yield();
     }
@@ -104,6 +130,8 @@ init_platform()
     timer_init(SYS_TIMER_FREQUENCY_HZ);
     clock_init();
     ps2_kbd_init();
+    pci_init();
+    pci_print_device();
 
     syscall_install();