CC=gcc
CFLAGS=-I../include -I../include/raw -nostdlib -nostdinc -fno-builtin -D__RAW__ -Wall -Werror -pedantic -ansi -std=gnu99
-OBJS=counter.o firstrun.o ../pci/pci-raw.o ../lib/minilib.o ../lib/console.o ../ich2/smram-ich2.o ../ich2/smi.o vga-overlay.o
+OBJS=counter.o firstrun.o ../pci/pci-raw.o ../lib/minilib.o ../lib/console.o ../ich2/smram-ich2.o ../ich2/smi.o vga-overlay.o ../lib/sprintf.o ../lib/doprnt.o
all: aseg.elf
case 0x20000:
{
unsigned char b;
- strcpy(s, "READxxxxxxxxxxxxxxxx");
- tohex(s+4, cts);
b = inb(cts & 0xFFFF);
- tohex(s+12, b);
+ dologf("READ: %08x (%02x)", cts, b);
if ((cts & 0xFFFF) == 0x64)
curdev = (b & 0x20) ? 1 : 0;
if ((curdev == 0) && ((cts & 0xFFFF) == 0x60) && (b == 0x01))
outb(0xCF9, 0x4);
- dolog(s);
*(unsigned char*)0xAFFD0 /* EAX */ = b;
break;
}
outl(0x840, 0x0100);
}
if (inl(0x834) & ~(0x4160))
- {
- char s[40];
- strcpy(s, "Unknown: xxxxxxxx");
- tohex(s + 9, inl(0x834) & ~(0x140));
- dolog(s);
- }
-
+ dologf("Unknown: %08x", inl(0x834) & ~(0x140));
outlog();
#include <smram.h>
#include <video_defines.h>
#include <minilib.h>
+#include <stdarg.h>
static char logents[4][41] = {{0}};
{
return (char *) (
TEXT_CONSOLE_BASE
- | (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 9)
- | (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 1)
+ + (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 9)
+ + (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 1)
);
}
}
smram_restore_state(old_state);
-
+
for (y = 0; y < 4; y++)
strblit(logents[y], y, 40);
}
memmove(logents[0], logents[1], sizeof(logents[0])*3);
strcpy(logents[3], s);
}
+
+void dologf(char *fmt, ...)
+{
+ va_list va;
+
+ memmove(logents[0], logents[1], sizeof(logents[0])*3);
+ va_start(va, fmt);
+ vsnprintf(logents[3], 40, fmt, va);
+ va_end(va);
+}
void strblit(char *src, int row, int col);
void dolog(char *s);
+void dologf(char *s, ...);
void outlog();
#endif
uint16_t _get_PMBASE()
{
- return pci_read32(0, 0, 0, 0x40) & 0xFF80;
+ return pci_read32(0, 21, 0, 0x40) & 0xFF80;
}
void smi_disable()
#ifndef MINILIB_H
#define MINILIB_H
-void memmove(void *dest, void *src, int bytes);
-int strcmp(const char *a2, const char *a1);
-void strcpy(char *a2, const char *a1);
-void tohex(char *s, unsigned long l);
+#include <stdarg.h>
+
+extern void memcpy(void *dest, void *src, int bytes);
+extern void memmove(void *dest, void *src, int bytes);
+extern int memcmp(const char *a2, const char *a1, int bytes);
+extern int strcmp(const char *a2, const char *a1);
+extern int strlen(char *c);
+extern void strcpy(char *a2, const char *a1);
+extern void puts(char *c);
+extern void tohex(char *s, unsigned long l);
+extern void puthex(unsigned long l);
+extern int vsprintf(char *s, const char *fmt, va_list args);
+extern int vsnprintf(char *s, int size, const char *fmt, va_list args);
+extern int sprintf(char *s, const char *fmt, ...);
+extern int snprintf(char *s, int size, const char *fmt, ...);
#endif
tohex(d, l);
puts(d);
}
-
-