]> Joshua Wise's Git repositories - netwatch.git/blame_incremental - tools/frob-rls.c
Merge branch 'master' of /storage/git/netwatch
[netwatch.git] / tools / frob-rls.c
... / ...
CommitLineData
1#include <sys/io.h>
2#include <reg-82801b.h>
3#include <string.h>
4#include <stdint.h>
5#include <stdlib.h>
6
7static uint16_t _get_PMBASE()
8{
9 static long pmbase = -1;
10
11 if (pmbase == -1)
12 pmbase = pci_read32(ICH2_LPC_BUS, ICH2_LPC_DEV, ICH2_LPC_FN, ICH2_LPC_PCI_PMBASE) & ICH2_PMBASE_MASK;
13
14 return pmbase;
15}
16
17typedef struct {
18 uint32_t signature;
19 uint32_t type;
20 uint8_t data[];
21} packet_t;
22
23extern unsigned int poke(unsigned long addr, unsigned long * value);
24
25int main(int argc, char **argv)
26{
27 unsigned int res;
28 packet_t * packet = (packet_t *)memalign(4096, sizeof(packet_t));
29
30 packet->signature = 0x1BADD00D;
31 packet->type = 0xAA;
32 strcpy(packet->data, "hello, world!");
33
34 if (iopl(3) < 0)
35 {
36 perror("iopl");
37 return 1;
38 }
39
40 res = poke(_get_PMBASE() + 0x04, (void *)packet);
41 printf("returned %p\n", res);
42
43 if (res == 42) {
44 int i;
45 for (i = 0; i < 96; i++)
46 printf("%s\n", packet->data + i * 41);
47 }
48}
This page took 0.026114 seconds and 4 git commands to generate.