Fixed SMM, now it works correctly, and is now also operating on all CPU's from 386 onwards.

This commit is contained in:
OBattler
2020-03-29 18:12:43 +02:00
parent 0092500af9
commit 66e159e0bf
17 changed files with 597 additions and 404 deletions

View File

@@ -14,6 +14,7 @@
*
* Copyright 2019 Miran Grca.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@@ -24,13 +25,7 @@
#include "cpu.h"
#include "device.h"
#include "86box_io.h"
typedef struct
{
uint8_t cmd,
stat;
} apm_t;
#include "apm.h"
#ifdef ENABLE_APM_LOG
@@ -53,6 +48,13 @@ apm_log(const char *fmt, ...)
#endif
void
apm_set_do_smi(apm_t *apm, uint8_t do_smi)
{
apm->do_smi = do_smi;
}
static void
apm_out(uint16_t port, uint8_t val, void *p)
{
@@ -64,34 +66,8 @@ apm_out(uint16_t port, uint8_t val, void *p)
if (port == 0x0000) {
apm->cmd = val;
switch (apm->cmd) {
case 0x07: /* Set Power State */
if (CH == 0x00) switch (CX) {
case 0x0000:
#ifdef ENABLE_APM_LOG
apm_log("APM Set Power State: APM Enabled\n");
#endif
break;
case 0x0001:
#ifdef ENABLE_APM_LOG
apm_log("APM Set Power State: Standby\n");
#endif
break;
case 0x0002:
#ifdef ENABLE_APM_LOG
apm_log("APM Set Power State: Suspend\n");
#endif
break;
case 0x0003: /* Off */
#ifdef ENABLE_APM_LOG
apm_log("APM Set Power State: Off\n");
#endif
exit(-1);
break;
}
break;
}
if (apm->do_smi)
smi_line = 1;
} else
apm->stat = val;
}