From: <bob...@us...> - 2007-07-13 13:29:19
|
Revision: 1140 http://svn.sourceforge.net/hackndev/?rev=1140&view=rev Author: bobofdoom Date: 2007-07-13 06:29:16 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Cocoboot: Added simple memory dumping and writing commands to USB console. Modified Paths: -------------- cocoboot/trunk/m68k/cocoboot.c Modified: cocoboot/trunk/m68k/cocoboot.c =================================================================== --- cocoboot/trunk/m68k/cocoboot.c 2007-07-13 13:07:24 UTC (rev 1139) +++ cocoboot/trunk/m68k/cocoboot.c 2007-07-13 13:29:16 UTC (rev 1140) @@ -21,6 +21,7 @@ #include <MemoryMgr.h> //#include <string.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <VFSMgr.h> @@ -216,11 +217,71 @@ void console_help(void) { sendf("Available commands:\r\n"); - sendf(" exit close the console\r\n"); - sendf(" help show this help\r\n"); - sendf(" ping [text] reply with pong text\r\n"); + sendf(" exit close the console\r\n"); + sendf(" help show this help\r\n"); + sendf(" mb addr [n] [filler] dump or fill n 8-bit values starting at addr\r\n"); + sendf(" mh addr [n] [filler] dump or fill n 16-bit values starting at addr\r\n"); + sendf(" mw addr [n] [filler] dump or fill n 32-bit values starting at addr\r\n"); + sendf(" ping [text] reply with pong text\r\n"); } +void console_mw(char *args) { + char *next = NULL; + UInt32 addr = strtol(args, &next, 0); + UInt32 count = 1; + UInt32 fill = 0, fill_value = 0; + if (next && *next) { + count = strtol(next, &next, 0); + } + if (next && *next) { + fill_value = strtol(next, &next, 0); + fill = 1; + } + while (count--) { + if (fill) *((UInt32*)addr) = fill_value; + sendf("%08lx: %lx\r\n", addr, *((UInt32*)addr)); + addr += 4; + } +} + +void console_mh(char *args) { + char *next = NULL; + UInt32 addr = strtol(args, &next, 0); + UInt32 count = 1; + UInt32 fill = 0, fill_value = 0; + if (next && *next) { + count = strtol(next, &next, 0); + } + if (next && *next) { + fill_value = strtol(next, &next, 0); + fill = 1; + } + while (count--) { + if (fill) *((UInt16*)addr) = fill_value; + sendf("%08lx: %x\r\n", addr, *((UInt16*)addr)); + addr += 2; + } +} + +void console_mb(char *args) { + char *next = NULL; + UInt32 addr = strtol(args, &next, 0); + UInt32 count = 1; + UInt32 fill = 0, fill_value = 0; + if (next && *next) { + count = strtol(next, &next, 0); + } + if (next && *next) { + fill_value = strtol(next, &next, 0); + fill = 1; + } + while (count--) { + if (fill) *((UInt8*)addr) = fill_value; + sendf("%08lx: %x\r\n", addr, *((UInt8*)addr)); + addr += 1; + } +} + /* index(3) - locate character in string */ char *index(const char *s, int c) { @@ -246,6 +307,12 @@ console_help(); } else if (!strcmp(cmd, "exit")) { close_console(); + } else if (!strcmp(cmd, "mb")) { + console_mb(args); + } else if (!strcmp(cmd, "mh")) { + console_mh(args); + } else if (!strcmp(cmd, "mw")) { + console_mw(args); } else { sendf("Unknown command '%s'. Type 'help' for help.\r\n", cmd); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bob...@us...> - 2007-07-15 08:02:16
|
Revision: 1150 http://svn.sourceforge.net/hackndev/?rev=1150&view=rev Author: bobofdoom Date: 2007-07-15 01:02:12 -0700 (Sun, 15 Jul 2007) Log Message: ----------- Cocoboot: Fixed endian of console commands. Modified Paths: -------------- cocoboot/trunk/m68k/cocoboot.c Modified: cocoboot/trunk/m68k/cocoboot.c =================================================================== --- cocoboot/trunk/m68k/cocoboot.c 2007-07-15 06:33:49 UTC (rev 1149) +++ cocoboot/trunk/m68k/cocoboot.c 2007-07-15 08:02:12 UTC (rev 1150) @@ -208,9 +208,9 @@ Err err; char *exit_text = "[Cocoboot exiting]\r\n"; if (usb_port) { - SrmSend(usb_port, exit_text, strlen(exit_text), &err), - SrmClose(usb_port); - usb_port = 0; + SrmSend(usb_port, exit_text, strlen(exit_text), &err); + //SrmClose(usb_port); + //usb_port = 0; } } @@ -227,57 +227,57 @@ void console_mw(char *args) { char *next = NULL; - UInt32 addr = strtol(args, &next, 0); + UInt32 addr = strtoul(args, &next, 0); UInt32 count = 1; UInt32 fill = 0, fill_value = 0; if (next && *next) { - count = strtol(next, &next, 0); + count = strtoul(next, &next, 0); } if (next && *next) { - fill_value = strtol(next, &next, 0); + fill_value = strtoul(next, &next, 0); fill = 1; } while (count--) { - if (fill) *((UInt32*)addr) = fill_value; - sendf("%08lx: %lx\r\n", addr, *((UInt32*)addr)); + if (fill) *((UInt32*)addr) = EndianFix32(fill_value); + sendf("%08lx: %08lx\r\n", addr, EndianFix32(*((UInt32*)addr))); addr += 4; } } void console_mh(char *args) { char *next = NULL; - UInt32 addr = strtol(args, &next, 0); + UInt32 addr = strtoul(args, &next, 0); UInt32 count = 1; UInt32 fill = 0, fill_value = 0; if (next && *next) { - count = strtol(next, &next, 0); + count = strtoul(next, &next, 0); } if (next && *next) { - fill_value = strtol(next, &next, 0); + fill_value = strtoul(next, &next, 0); fill = 1; } while (count--) { - if (fill) *((UInt16*)addr) = fill_value; - sendf("%08lx: %x\r\n", addr, *((UInt16*)addr)); + if (fill) *((UInt16*)addr) = EndianFix16(fill_value); + sendf("%08lx: %04x\r\n", addr, EndianFix16(*((UInt16*)addr))); addr += 2; } } void console_mb(char *args) { char *next = NULL; - UInt32 addr = strtol(args, &next, 0); + UInt32 addr = strtoul(args, &next, 0); UInt32 count = 1; UInt32 fill = 0, fill_value = 0; if (next && *next) { - count = strtol(next, &next, 0); + count = strtoul(next, &next, 0); } if (next && *next) { - fill_value = strtol(next, &next, 0); + fill_value = strtoul(next, &next, 0); fill = 1; } while (count--) { if (fill) *((UInt8*)addr) = fill_value; - sendf("%08lx: %x\r\n", addr, *((UInt8*)addr)); + sendf("%08lx: %02x\r\n", addr, *((UInt8*)addr)); addr += 1; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bob...@us...> - 2007-07-17 10:26:10
|
Revision: 1173 http://svn.sourceforge.net/hackndev/?rev=1173&view=rev Author: bobofdoom Date: 2007-07-17 03:26:05 -0700 (Tue, 17 Jul 2007) Log Message: ----------- Cocoboot: Added missing endian swapping around tt_offset. This should fix 'Returned c01d' error on LD, TX etc. Modified Paths: -------------- cocoboot/trunk/m68k/cocoboot.c Modified: cocoboot/trunk/m68k/cocoboot.c =================================================================== --- cocoboot/trunk/m68k/cocoboot.c 2007-07-17 09:05:42 UTC (rev 1172) +++ cocoboot/trunk/m68k/cocoboot.c 2007-07-17 10:26:05 UTC (rev 1173) @@ -140,7 +140,7 @@ arm_globals.ram_base = EndianFix32(get_ram_base()); arm_globals.ram_size = EndianFix32(get_ram_size()); arm_globals.mach_num = EndianFix32(835); - arm_globals.tt_offset = get_tt_offset(); + arm_globals.tt_offset = EndianFix32(get_tt_offset()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |