summaryrefslogtreecommitdiff
path: root/bios
diff options
context:
space:
mode:
authorsshwarts <sshwarts>2008-12-04 18:42:32 +0000
committersshwarts <sshwarts>2008-12-04 18:42:32 +0000
commita5a4315b8da32215ec30f0a48e32bd06e7eeafde (patch)
treed69709aad216bd839c0354e7e87217885704e70f /bios
parent13d71d42060e230ad60dfd9eaba618761ae66443 (diff)
Preserve memory content during SMM iniT.
Patch by Gleb Natapov
Diffstat (limited to 'bios')
-rw-r--r--bios/BIOS-bochs-latestbin131042 -> 131042 bytes
-rw-r--r--bios/rombios32.c10
2 files changed, 8 insertions, 2 deletions
diff --git a/bios/BIOS-bochs-latest b/bios/BIOS-bochs-latest
index abadd7ff..f588e7a8 100644
--- a/bios/BIOS-bochs-latest
+++ b/bios/BIOS-bochs-latest
Binary files differ
diff --git a/bios/rombios32.c b/bios/rombios32.c
index 19ee2166..4871884d 100644
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -731,6 +731,12 @@ static void smm_init(PCIDevice *d)
value = pci_config_readl(d, 0x58);
if ((value & (1 << 25)) == 0) {
+ /* enable the SMM memory window */
+ pci_config_writeb(&i440_pcidev, 0x72, 0x02 | 0x48);
+
+ /* save original memory content */
+ memcpy((void *)0xa8000, (void *)0x38000, 0x8000);
+
/* copy the SMM relocation code */
memcpy((void *)0x38000, &smm_relocation_start,
&smm_relocation_end - &smm_relocation_start);
@@ -747,8 +753,8 @@ static void smm_init(PCIDevice *d)
/* wait until SMM code executed */
while (inb(0xb3) != 0x00);
- /* enable the SMM memory window */
- pci_config_writeb(&i440_pcidev, 0x72, 0x02 | 0x48);
+ /* restore original memory content */
+ memcpy((void *)0x38000, (void *)0xa8000, 0x8000);
/* copy the SMM code */
memcpy((void *)0xa8000, &smm_code_start,