VOID DumpExclusiveNode( PVOID ExclusiveNodeSplayLinks, ULONG Indent ) /*++ Purpose: Dump an exclusive lock node Arguments: ExclusiveNodeSplayLinks - splay links of an exclusive node Indent - indent level to use Return: None --*/ { EX_LOCK ExLock, *pExLock; pExLock = ExLockAddress(ExclusiveNodeSplayLinks); if (!ReadAtAddress(pExLock, &ExLock, sizeof(EX_LOCK), &pExLock)) { return; } MakeSpace(Indent); dprintf("%sLock @ %08x (" "P = %08x R = %08x L = %08x)\n", Space, pExLock, ExLockAddress(DbgRtlParent(ExLock.Links)), ExLockAddress(DbgRtlRightChild(ExLock.Links)), ExLockAddress(DbgRtlLeftChild(ExLock.Links))); RestoreSpace(Indent); DumpFileLockInfo(&ExLock.LockInfo, Indent); }
VOID DumpFileLockInfo( PFILE_LOCK_INFO pFileLockInfo, ULONG Indent ) /*++ Purpose: Dump the local internal FILE_LOCK_INFO structure Arguments: pFileLock - debugger address of FILE_LOCK_INFO to dump Return: None --*/ { MakeSpace(Indent); dprintf("%sStart = %x%08x Length = %x%08x End = %x%08x (%s)\n" "%sKey = %08x FileOb = %08x ProcId = %08x\n", Space, SplitLI(pFileLockInfo->StartingByte), SplitLI(pFileLockInfo->Length), SplitLI(pFileLockInfo->EndingByte), pFileLockInfo->ExclusiveLock ? "Ex":"Sh", Space, pFileLockInfo->Key, pFileLockInfo->FileObject, pFileLockInfo->ProcessId); RestoreSpace(Indent); }
/* * .KB_C_FN_DEFINITION_START * void ParseCommand(char *) * This private function executes matching functions. * .KB_C_FN_DEFINITION_END */ static void ParseCommand(char *buffer) { int argc, i; if ((argc = BreakCommand(buffer)) < 1) return; switch (StringToCommand(argv[0])) { case COMMAND_COPY: { // "c <to> <from> <size in bytes>" // copy memory char *to, *from; unsigned size; if (argc > 3) { to = (char *)p_ASCIIToHex(argv[1]); from = (char *)p_ASCIIToHex(argv[2]); size = p_ASCIIToHex(argv[3]); memcpy(to, from, size); } break; } case COMMAND_DUMP: // display boot commands DumpBootCommands(); break; case COMMAND_EXEC: { // "e <address>" // execute at address void (*execAddr)(unsigned, unsigned, unsigned); if (argc > 1) { /* in future, include machtypes (MACH_KB9200 = 612) */ execAddr = (void (*)(unsigned, unsigned, unsigned)) p_ASCIIToHex(argv[1]); (*execAddr)(0, 612, tagAddress); } break; } case COMMAND_TFTP: { // "tftp <local_dest_addr filename>" // tftp download unsigned address = 0; if (argc > 2) address = p_ASCIIToHex(argv[1]); TFTP_Download(address, argv[2]); break; } case COMMAND_SERVER_IP: // "server_ip <server IP 192 200 1 20>" // set download server address if (argc > 4) SetServerIPAddress(BuildIP()); break; case COMMAND_HELP: // dump command info printf("Commands:\n" "\tc\n" "\td\n" "\te\n" "\tip\n" "\tserver_ip\n" "\tm\n" "\ttftp\n" "\ts\n" #ifdef SUPPORT_TAG_LIST "\tt\n" #endif "\tw\n" "\tx\n"); break; case COMMAND_LOCAL_IP: // "local_ip <local IP 192 200 1 21> // set ip of this module if (argc > 4) SetLocalIPAddress(BuildIP()); break; case COMMAND_MAC: { // "m <mac address 12 34 56 78 9a bc> // set mac address using 6 byte values unsigned char mac[6]; if (argc > 6) { for (i = 0; i < 6; i++) mac[i] = p_ASCIIToHex(argv[i + 1]); EMAC_SetMACAddress(mac); } break; } case COMMAND_SET: { // s <index> <new boot command> // set the boot command at index (0-based) unsigned index; if (argc > 1) { RestoreSpace(2); index = p_ASCIIToHex(argv[1]); SetBootCommand(index, argv[2]); } break; } #ifdef SUPPORT_TAG_LIST case COMMAND_TAG: // t <address> <boot command line> // create tag-list for linux boot if (argc > 2) { RestoreSpace(2); tagAddress = p_ASCIIToHex(argv[1]); InitTagList(argv[2], (void*)tagAddress); } break; #endif case COMMAND_WRITE: // write the command table to non-volatile WriteCommandTable(); break; case COMMAND_XMODEM: { // "x <address>" // download X-modem record at address if (argc > 1) xmodem_rx((char *)p_ASCIIToHex(argv[1])); break; } default: break; } printf("\n"); }
VOID DumpSharedNode( PVOID SharedNodeSplayLinks, ULONG Indent ) /*++ Purpose: Dump a shared lock node Arguments: SharedNodeSplayLinks - splay links of an exclusive node Indent - indent level to use Return: None --*/ { LOCKTREE_NODE LockTreeNode, *pLockTreeNode; SH_LOCK ShLock, *pShLock; SINGLE_LIST_ENTRY *pLink; pLockTreeNode = LockTreeAddress(SharedNodeSplayLinks); if (!ReadAtAddress(pLockTreeNode, &LockTreeNode, sizeof(LOCKTREE_NODE), &pLockTreeNode)) { return; } MakeSpace(Indent); dprintf("%sLockTreeNode @ %08x (" "P = %08x R = %08x L = %08x)\n", Space, pLockTreeNode, LockTreeAddress(DbgRtlParent(LockTreeNode.Links)), LockTreeAddress(DbgRtlRightChild(LockTreeNode.Links)), LockTreeAddress(DbgRtlLeftChild(LockTreeNode.Links))); RestoreSpace(Indent); for (pLink = LockTreeNode.Locks.Next; pLink; pLink = ShLock.Link.Next) { CheckForBreak(); pShLock = CONTAINING_RECORD( pLink, SH_LOCK, Link ); if (!ReadAtAddress(pShLock, &ShLock, sizeof(SH_LOCK), &pShLock)) { return; } MakeSpace(Indent); dprintf("%sLock @ %08x\n", Space, pShLock); RestoreSpace(Indent); DumpFileLockInfo(&ShLock.LockInfo, Indent); } }