- smramc = pci_read8(0, 0, 0, 0x70);
- pci_write8(0, 0, 0, 0x70, (smramc & 0xF0) | 0x04);
- load_elf(wee->mods[0].mod_start, wee->mods[0].mod_end - wee->mods[0].mod_start);
- pci_write8(0, 0, 0, 0x70, smramc);
- outb(0x830, inb(0x830) | 0x41); /* turn on the SMIs we want */
-
+
+
+ /* Open the SMRAM aperture and load our ELF. */
+ smram_state_t old_smramc = smram_save_state();
+
+ if (smram_aseg_set_state(SMRAM_ASEG_OPEN) != 0)
+ panic("Opening SMRAM failed; cannot load ELF.");
+
+ load_elf(mods[0].mod_start, mods[0].mod_end - mods[0].mod_start);
+
+ struct info_section * info = (struct info_section *)0x10000;
+ if (info->signature != INFO_SIGNATURE)
+ {
+ smram_restore_state(old_smramc); /* Restore so that video ram is touchable again. */
+ panic("Info section signature mismatch.");
+ }
+
+ info->firstrun();
+ smram_restore_state(old_smramc);
+