]> Joshua Wise's Git repositories - netwatch.git/blobdiff - tools/poke-rls.c
add poke-rls tool
[netwatch.git] / tools / poke-rls.c
diff --git a/tools/poke-rls.c b/tools/poke-rls.c
new file mode 100644 (file)
index 0000000..c6db7bc
--- /dev/null
@@ -0,0 +1,31 @@
+#include <sys/io.h>
+#include <reg-82801b.h>
+#include <string.h>
+#include <stdint.h>
+
+static uint16_t _get_PMBASE()
+{
+       static long pmbase = -1;
+
+       if (pmbase == -1) 
+               pmbase = pci_read32(ICH2_LPC_BUS, ICH2_LPC_DEV, ICH2_LPC_FN, ICH2_LPC_PCI_PMBASE) & ICH2_PMBASE_MASK;
+
+       return pmbase;
+}
+
+
+extern unsigned int poke(short addr);
+
+int main(int argc, char **argv)
+{
+       unsigned int res;
+
+       if (iopl(3) < 0)
+       {
+               perror("iopl");
+               return 1;
+       }
+
+       res = poke(_get_PMBASE() + 0x04);
+       printf("found %p\n", res);
+}
This page took 0.0236 seconds and 4 git commands to generate.