clang-format in src/

This commit is contained in:
Jasmine Iwanek
2022-09-18 17:11:43 -04:00
parent 2267153edd
commit e6dbaefeb1
35 changed files with 7113 additions and 7387 deletions

View File

@@ -28,32 +28,28 @@
#include <86box/mem.h>
#include <86box/chipset.h>
typedef struct {
uint8_t dummy;
} ioapic_t;
#ifdef ENABLE_IOAPIC_LOG
int ioapic_do_log = ENABLE_IOAPIC_LOG;
static void
ioapic_log(const char *fmt, ...)
{
va_list ap;
if (ioapic_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
#define ioapic_log(fmt, ...)
# define ioapic_log(fmt, ...)
#endif
static void
ioapic_write(uint16_t port, uint8_t val, void *priv)
{
@@ -61,50 +57,47 @@ ioapic_write(uint16_t port, uint8_t val, void *priv)
/* target POST FF, issued by Award before jumping to the bootloader */
if (val != 0xff)
return;
return;
ioapic_log("IOAPIC: Caught POST %02X\n", val);
/* The _MP_ table must be located in the BIOS area, the EBDA, or the last 1k of conventional
memory; at a 16-byte boundary in all cases. Award writes both tables to the BIOS area. */
for (addr = 0xf0000; addr <= 0xfffff; addr += 16) {
/* check signature for the _MP_ table (Floating Point Structure) */
if (mem_readl_phys(addr) != 0x5f504d5f) /* ASCII "_MP_" */
continue;
/* check signature for the _MP_ table (Floating Point Structure) */
if (mem_readl_phys(addr) != 0x5f504d5f) /* ASCII "_MP_" */
continue;
/* read and check pointer to the PCMP table (Configuration Table) */
pcmp = mem_readl_phys(addr + 4);
if ((pcmp < 0xf0000) || (pcmp > 0xfffff) || (mem_readl_phys(pcmp) != 0x504d4350)) /* ASCII "PCMP" */
continue;
/* read and check pointer to the PCMP table (Configuration Table) */
pcmp = mem_readl_phys(addr + 4);
if ((pcmp < 0xf0000) || (pcmp > 0xfffff) || (mem_readl_phys(pcmp) != 0x504d4350)) /* ASCII "PCMP" */
continue;
/* patch over the signature on both tables */
ioapic_log("IOAPIC: Patching _MP_ [%08x] and PCMP [%08x] tables\n", addr, pcmp);
ram[addr] = ram[addr + 1] = ram[addr + 2] = ram[addr + 3] = 0xff;
ram[pcmp] = ram[pcmp + 1] = ram[pcmp + 2] = ram[pcmp + 3] = 0xff;
/* patch over the signature on both tables */
ioapic_log("IOAPIC: Patching _MP_ [%08x] and PCMP [%08x] tables\n", addr, pcmp);
ram[addr] = ram[addr + 1] = ram[addr + 2] = ram[addr + 3] = 0xff;
ram[pcmp] = ram[pcmp + 1] = ram[pcmp + 2] = ram[pcmp + 3] = 0xff;
break;
break;
}
}
static void
ioapic_reset(ioapic_t *dev)
{
}
static void
ioapic_close(void *priv)
{
ioapic_t *dev = (ioapic_t *) priv;
io_removehandler(0x80, 1,
NULL, NULL, NULL, ioapic_write, NULL, NULL, NULL);
NULL, NULL, NULL, ioapic_write, NULL, NULL, NULL);
free(dev);
}
static void *
ioapic_init(const device_t *info)
{
@@ -114,22 +107,21 @@ ioapic_init(const device_t *info)
ioapic_reset(dev);
io_sethandler(0x80, 1,
NULL, NULL, NULL, ioapic_write, NULL, NULL, NULL);
NULL, NULL, NULL, ioapic_write, NULL, NULL, NULL);
return dev;
}
const device_t ioapic_device = {
.name = "I/O Advanced Programmable Interrupt Controller",
.name = "I/O Advanced Programmable Interrupt Controller",
.internal_name = "ioapic",
.flags = DEVICE_AT,
.local = 0,
.init = ioapic_init,
.close = ioapic_close,
.reset = NULL,
.flags = DEVICE_AT,
.local = 0,
.init = ioapic_init,
.close = ioapic_close,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
.force_redraw = NULL,
.config = NULL
};