]> Joshua Wise's Git repositories - netwatch.git/commitdiff
add printf/dologf
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 19 Sep 2008 20:52:19 +0000 (16:52 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 19 Sep 2008 20:52:19 +0000 (16:52 -0400)
aseg/Makefile
aseg/counter.c
aseg/vga-overlay.c
aseg/vga-overlay.h
ich2/smi.c
include/minilib.h
lib/minilib.c

index 5806bd198994e7a59731342021d937ce55bf2e26..359759cc45448b6feb490752ab4ed30c99df2c8f 100644 (file)
@@ -1,6 +1,6 @@
 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
 
index d52316843f1c2f41b4459ff3b33548c251a91d8f..104d809dbdac0a3d5a6ddbd30d587d5db09ffcdd 100644 (file)
@@ -25,15 +25,12 @@ void pci_dump() {
        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;
        }
@@ -97,13 +94,7 @@ void __start (void)
                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();
        
index e5414cadaad81a953a7a045be2e6a96e32743c38..d205656f65eb72cf079711f5cc4025f47daa41fc 100644 (file)
@@ -2,6 +2,7 @@
 #include <smram.h>
 #include <video_defines.h>
 #include <minilib.h>
+#include <stdarg.h>
 
 static char logents[4][41] = {{0}};
 
@@ -22,8 +23,8 @@ static char * vga_base()
 {
        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)
        );
 }
 
@@ -60,7 +61,7 @@ void outlog()
                }
 
        smram_restore_state(old_state);
-
+       
        for (y = 0; y < 4; y++)
                strblit(logents[y], y, 40);
 }
@@ -70,3 +71,13 @@ void dolog(char *s)
        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);
+}
index f79e6da3b9c7b750ec63cdfde3e96177f511fdf0..890f3537f1c71e64e4f5be4fc82b68fa491a7ea5 100644 (file)
@@ -4,6 +4,7 @@
 void strblit(char *src, int row, int col);
 
 void dolog(char *s);
+void dologf(char *s, ...);
 void outlog();
 
 #endif
index 59f14b604ca90071880e1f2625370bac0a0b6121..e790e40bd8319fe180f20828deb1ba6404f9d621 100644 (file)
@@ -5,7 +5,7 @@
 
 uint16_t _get_PMBASE()
 {
-       return pci_read32(0, 0, 0, 0x40) & 0xFF80;
+       return pci_read32(0, 21, 0, 0x40) & 0xFF80;
 }
 
 void smi_disable()
index 747b2aa71dc4a4d5db7f608e4e6d6b3a656f418d..0f5edff26ca37725b4f72321860cb03e159882ac 100644 (file)
@@ -1,9 +1,20 @@
 #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
index 232878b8478743c4a70d6574ef2785768d9e01e7..595341e192a18fa981bbeebe03eef3abd1954700 100644 (file)
@@ -81,5 +81,3 @@ void puthex(unsigned long l)
        tohex(d, l);
        puts(d);
 }
-
-
This page took 0.023522 seconds and 4 git commands to generate.