X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/0889f342f13f65b875e67f78a27ad078f3f55736..HEAD:/tools/poke-rls.c diff --git a/tools/poke-rls.c b/tools/poke-rls.c index c6db7bc..557e7a9 100644 --- a/tools/poke-rls.c +++ b/tools/poke-rls.c @@ -1,7 +1,18 @@ +/* poke-rls.c + * Linux-side communication packet utility + * NetWatch system management mode administration console + * + * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved. + * This program is free software; you can redistribute and/or modify it under + * the terms found in the file LICENSE in the root of this source tree. + * + */ + #include #include #include #include +#include static uint16_t _get_PMBASE() { @@ -13,19 +24,35 @@ static uint16_t _get_PMBASE() return pmbase; } +typedef struct { + uint32_t signature; + uint32_t type; + uint8_t data[]; +} packet_t; -extern unsigned int poke(short 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 = 42; + strcpy(packet->data, "hello, world!"); if (iopl(3) < 0) { perror("iopl"); return 1; } - - res = poke(_get_PMBASE() + 0x04); - printf("found %p\n", res); + + res = poke(_get_PMBASE() + 0x04, (void *)packet); + printf("returned %p\n", res); + + if (res == 42) { + int i; + for (i = 0; i < 96; i++) + printf("%s\n", packet->data + i * 41); + } }