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 ../lib/sprintf.o ../lib/doprnt.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 packet.o ../lib/sprintf.o ../lib/doprnt.o
all: aseg.elf
#include <minilib.h>
#include <smi.h>
#include "vga-overlay.h"
+#include "packet.h"
unsigned int counter = 0;
unsigned long pcisave;
unsigned long ecx;
ecx = *(unsigned long*)0xAFFD4;
- dologf("ECX was %08x", ecx);
+
+ packet_t * packet = check_packet(ecx);
+ if (!packet)
+ {
+ dologf("WARN: bad packet at %08x", ecx);
+ return;
+ }
+
+ dologf("Got packet: type %08x", packet->type);
+
*(unsigned long*)0xAFFD4 = 0x2BADD00D;
}
smram-ich2
+port
+pci
+poke-rls
.global poke
poke:
- # Preload registers: $0x1BADD00D
- mov $0x1BADD00D, %ecx
+ mov 8(%esp), %ecx
# Parameter: I/O port to set bit 2 of
mov 4(%esp), %edx
return pmbase;
}
+typedef struct {
+ uint32_t signature;
+ uint32_t type;
+ uint8_t data[];
+} packet_t;
-extern unsigned int poke(unsigned long addr);
+extern unsigned int poke(unsigned long addr, unsigned long * value);
int main(int argc, char **argv)
{
unsigned int res;
+ packet_t * packet = (packet_t *)memalign(4096, sizeof(packet_t));
+
+ packet->signature = 0x1BADD00D;
+ packet->type = 0xF00FC7C8;
if (iopl(3) < 0)
{
return 1;
}
- res = poke(_get_PMBASE() + 0x04);
- printf("found %p\n", res);
+ res = poke(_get_PMBASE() + 0x04, (void *)packet);
+ printf("returned %p\n", res);
}