From d5cffad757d05610d796476603aaff266e6c8f50 Mon Sep 17 00:00:00 2001 From: Jacob Potter Date: Thu, 25 Sep 2008 23:29:38 -0400 Subject: [PATCH] add dump-buffer command --- aseg/counter.c | 7 ++++++- aseg/vga-overlay.c | 6 +++++- include/vga-overlay.h | 2 ++ tools/poke-rls.c | 10 +++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/aseg/counter.c b/aseg/counter.c index 7b34f3a..6ef4cf9 100644 --- a/aseg/counter.c +++ b/aseg/counter.c @@ -81,7 +81,12 @@ void gbl_rls_handler(smi_event_t ev) dologf("Got packet: type %08x", packet->type); - *(unsigned long*)0xAFFD4 = 0x2BADD00D; + if (packet->type == 42) { + dump_log((char *)packet->data); + *(unsigned long*)0xAFFD4 = 42; + } else { + *(unsigned long*)0xAFFD4 = 0x2BADD00D; + } } void smi_entry(void) diff --git a/aseg/vga-overlay.c b/aseg/vga-overlay.c index ca0e8a5..7aa8b41 100644 --- a/aseg/vga-overlay.c +++ b/aseg/vga-overlay.c @@ -35,7 +35,7 @@ void strblit(char *src, int row, int col) smram_state_t old_state = smram_save_state(); smram_aseg_set_state(SMRAM_ASEG_SMMCODE); - + while (*src) { *(destp++) = *(src++); @@ -84,3 +84,7 @@ void dologf(const char *fmt, ...) va_end(va); } void (*outputf)(const char *s, ...) = dologf; + +void dump_log (char * target) { + memcpy(target, logents, sizeof(logents)); +} diff --git a/include/vga-overlay.h b/include/vga-overlay.h index 890f353..f338d49 100644 --- a/include/vga-overlay.h +++ b/include/vga-overlay.h @@ -7,4 +7,6 @@ void dolog(char *s); void dologf(char *s, ...); void outlog(); +void dump_log(char *buffer); + #endif diff --git a/tools/poke-rls.c b/tools/poke-rls.c index 6946fb7..03c4fb1 100644 --- a/tools/poke-rls.c +++ b/tools/poke-rls.c @@ -28,7 +28,8 @@ int main(int argc, char **argv) packet_t * packet = (packet_t *)memalign(4096, sizeof(packet_t)); packet->signature = 0x1BADD00D; - packet->type = 0xF00FC7C8; + packet->type = 42; + strcpy(packet->data, "hello, world!"); if (iopl(3) < 0) { @@ -38,4 +39,11 @@ int main(int argc, char **argv) res = poke(_get_PMBASE() + 0x04, (void *)packet); printf("returned %p\n", res); + + if (res == 42) { + printf("%s\n", packet->data); + printf("%s\n", packet->data+41); + printf("%s\n", packet->data+82); + printf("%s\n", packet->data+123); + } } -- 2.43.0