]> Joshua Wise's Git repositories - netwatch.git/blobdiff - aseg-paging/pagingstub.c
Enable DHCP.
[netwatch.git] / aseg-paging / pagingstub.c
index 849c6dc3a01eb1d4c89de7ef6ec301a747162b3e..0115713bf93d29e4e990243aade030bb27a22a36 100644 (file)
@@ -5,11 +5,12 @@
 #include <smi.h>
 #include <pci-bother.h>
 #include <serial.h>
 #include <smi.h>
 #include <pci-bother.h>
 #include <serial.h>
+#include "traps.h"
 #include "../net/net.h"
 #include "vga-overlay.h"
 
 #include "../net/net.h"
 #include "vga-overlay.h"
 
+extern void smi_init();
 #include "vm_flags.h"
 #include "vm_flags.h"
-#include "pagetable.h"
 
 void set_cr0(unsigned int);
 void ps_switch_stack (void (*call)(), int stack);
 
 void set_cr0(unsigned int);
 void ps_switch_stack (void (*call)(), int stack);
@@ -105,28 +106,36 @@ void c_entry(void)
        unsigned char *bp;
 
        outb(0x80, 0x41);
        unsigned char *bp;
 
        outb(0x80, 0x41);
-       char * pagedir = pt_setup(0xA0000, 0x1FF80000, 0x80000);
-       outb(0x80, 0x43);
-       set_cr3((int)pagedir);
-       outb(0x80, 0xA5);
-
-       /* Turn paging on */
+       if (!entry_initialized)
+               pt_setup(0xA0000, 0x1FF80000, 0x80000);
+               
+       /* Enable paging. */
+       outb(0x80, 0x42);
+       set_cr3(0x1FF80000);
        set_cr0(get_cr0() | CR0_PG);
        set_cr0(get_cr0() | CR0_PG);
-       serial_init();
-       serial_tx('A');
-       outb(0x80, 0xAA);
-
        
        
+       outb(0x80, 0x43);
+
        if (!entry_initialized) {
        if (!entry_initialized) {
-               serial_tx('B');
-               outb(0x80, 0xAB);
+               
+               /* If needed, copy in data. */
                for (bp = (void *)0x200000; (void *)bp < (void *)&_bss; bp++)
                        *bp = *(bp + 0x100000);
                for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++)
                        *bp = 0;
                for (bp = (void *)0x200000; (void *)bp < (void *)&_bss; bp++)
                        *bp = *(bp + 0x100000);
                for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++)
                        *bp = 0;
+               serial_init();
+               dolog("Paging enabled.");
+       }
+
+       traps_install();
+
+       if (!entry_initialized) {
+               smi_init();
+               
+               entry_initialized = 1;
        }
 
        }
 
-       outb(0x80, 0xAC);
-       ps_switch_stack(smi_entry, 0x2FF000);
+       outb(0x80, 0x44);
+       ps_switch_stack(smi_entry, 0x270000);
        outb(0x80, 0xFA);
 }
        outb(0x80, 0xFA);
 }
This page took 0.027809 seconds and 4 git commands to generate.