]> Joshua Wise's Git repositories - netwatch.git/commitdiff
add some more structured packet handling
authorJacob Potter <jdpotter@andrew.cmu.edu>
Fri, 26 Sep 2008 02:48:21 +0000 (22:48 -0400)
committerJacob Potter <jdpotter@andrew.cmu.edu>
Fri, 26 Sep 2008 02:48:21 +0000 (22:48 -0400)
aseg/Makefile
aseg/counter.c
tools/.gitignore
tools/poke-rls-asm.S
tools/poke-rls.c

index 359759cc45448b6feb490752ab4ed30c99df2c8f..80ef8595764ec90f17ae70a1110380be0471eb64 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 ../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
 
index 88915dcfabae8e3f00c0e2c180563576aabf9e5c..7b34f3a299719f11b78bb94038f5a83b3c788657 100644 (file)
@@ -4,6 +4,7 @@
 #include <minilib.h>
 #include <smi.h>
 #include "vga-overlay.h"
+#include "packet.h"
 
 unsigned int counter = 0;
 unsigned long pcisave;
@@ -70,7 +71,16 @@ void gbl_rls_handler(smi_event_t ev)
        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;
 }
 
index e2ec8c1c593af9da1d51d19ec6d9f2ad6326f325..4e3fe9d5a0f74e6d49421b183662d0732b3ad94a 100644 (file)
@@ -1 +1,4 @@
 smram-ich2
+port
+pci
+poke-rls
index 980b4bf48dbae1824f3c906abe4ed2e37d08284e..2273169c16374fddb2cef3cfb8f6b09dc2466d0a 100644 (file)
@@ -1,7 +1,6 @@
 .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
index 01de181bf1e5497ca8e248a8fd7277bef32cf0a3..6946fb75fbe42d480670abb10c1f1c41e82190ca 100644 (file)
@@ -14,12 +14,21 @@ static uint16_t _get_PMBASE()
        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)
        {
@@ -27,6 +36,6 @@ int main(int argc, char **argv)
                return 1;
        }
        
-       res = poke(_get_PMBASE() + 0x04);
-       printf("found %p\n", res);
+       res = poke(_get_PMBASE() + 0x04, (void *)packet);
+       printf("returned %p\n", res);
 }
This page took 0.033053 seconds and 4 git commands to generate.