Separate out ram shadow code and permit more code to write to bios.

Extract shadow code from rombios32.c to its own file - shadow.c.
Reorg post.c so that shadow enable happens early and ram lock happens
    late in boot process.
Also, improve some comments in post.c and reorg code slightly.
diff --git a/src/post.c b/src/post.c
index 4b56551..9b54953 100644
--- a/src/post.c
+++ b/src/post.c
@@ -151,6 +151,7 @@
     }
 }
 
+// Execute a given option rom.
 static void
 callrom(u16 seg, u16 offset)
 {
@@ -163,6 +164,7 @@
     call16(&br);
 }
 
+// Find and run any "option roms" found in the given address range.
 static void
 rom_scan(u32 start, u32 end)
 {
@@ -211,11 +213,10 @@
     }
 }
 
+// Main setup code.
 static void
 post()
 {
-    dprintf(1, "Start bios\n");
-
     dprintf(3, "init bda\n");
     init_bda();
     init_ebda();
@@ -239,10 +240,6 @@
 
     printf("BIOS - begin\n\n");
 
-    // clear bss section -- XXX - shouldn't use globals
-    extern char __bss_start[], __bss_end[];
-    memset(__bss_start, 0, __bss_end - __bss_start);
-
     dprintf(3, "rombios32 init\n");
     rombios32_init();
 
@@ -256,20 +253,18 @@
 
     dprintf(1, "Scan for option roms\n");
     rom_scan(0xc8000, 0xe0000);
-
-    interactive_bootmenu();
-
-    // reset the memory (some boot loaders such as syslinux suppose
-    // that the memory is set to zero)
-    memset((void*)0x40000, 0, 0x40000); // XXX - shouldn't use globals
-
-    // Invoke int 19 to start boot process.
-    dprintf(3, "Jump to int19\n");
-    struct bregs br;
-    memset(&br, 0, sizeof(br));
-    call16_int(0x19, &br);
 }
 
+// Clear .bss section for C code.
+static void
+clear_bss()
+{
+    dprintf(3, "clearing .bss section\n");
+    extern char __bss_start[], __bss_end[];
+    memset(__bss_start, 0, __bss_end - __bss_start);
+}
+
+// Reset DMA controller
 static void
 init_dma()
 {
@@ -282,6 +277,7 @@
     outb(0x00, PORT_DMA2_MASK_REG);
 }
 
+// Check if the machine was setup with a special restart vector.
 static void
 check_restart_status()
 {
@@ -308,13 +304,34 @@
     call16(&br);
 }
 
+// 32-bit entry point.
 void VISIBLE32
 _start()
 {
     init_dma();
     check_restart_status();
 
+    dprintf(1, "Start bios\n");
+
+    // Setup for .bss and .data sections
+    clear_bss();
+    make_bios_writable();
+
+    // Perform main setup code.
     post();
+
+    // Present the user with a bootup menu.
+    interactive_bootmenu();
+
+    // Prep for boot process.
+    make_bios_readonly();
+    clear_bss();
+
+    // Invoke int 19 to start boot process.
+    dprintf(3, "Jump to int19\n");
+    struct bregs br;
+    memset(&br, 0, sizeof(br));
+    call16_int(0x19, &br);
 }
 
 // Externally visible 32bit entry point.