CC=gcc
SMRAM_ICH2_OBJS=smram-linux-tool.o ../pci/pci-linux.o ../ich2/smram-ich2.noraw.o
PCI_OBJS=pci.o ../pci/pci-linux.o
+POKE_RLS_OBJS=poke-rls.o poke-rls-asm.o ../pci/pci-linux.o
-all: smram-ich2 port pci
+all: smram-ich2 port pci poke-rls
%.noraw.o: %.c
gcc $(CFLAGS) -c -o $@ $<
pci: $(PCI_OBJS)
gcc $(CFLAGS) -o pci $(PCI_OBJS)
+poke-rls: $(POKE_RLS_OBJS)
+ gcc $(CFLAGS) -o poke-rls $(POKE_RLS_OBJS)
+
clean:
rm -f $(SMRAM_ICH2_OBJS) smram-ich2
+
+poke:
--- /dev/null
+.global poke
+poke:
+ # Preload registers: $0x1BADD00D
+ mov $0x1BADD00D, %ecx
+
+ # Parameter: I/O port to set bit 2 of
+ mov 4(%esp), %dx
+ inl %dx, %eax
+ or $4, %eax
+ outl %eax, %dx
+
+ # Count down for a while
+ mov $0x10000, %edx
+loop:
+ dec %edx
+ jz loop
+
+ # Maybe SMM poked something?
+ mov %ecx, %eax
+ ret
--- /dev/null
+#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);
+}