|
From: <bob...@us...> - 2006-12-27 09:40:13
|
Revision: 716
http://svn.sourceforge.net/hackndev/?rev=716&view=rev
Author: bobofdoom
Date: 2006-12-27 01:40:10 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
Added simple and very dodgy memory map dump command.
Modified Paths:
--------------
cocoboot/trunk/include/cocoboot.rcp
cocoboot/trunk/include/cocoboot_r.h
cocoboot/trunk/m68k/mainform.c
Modified: cocoboot/trunk/include/cocoboot.rcp
===================================================================
--- cocoboot/trunk/include/cocoboot.rcp 2006-12-26 23:57:02 UTC (rev 715)
+++ cocoboot/trunk/include/cocoboot.rcp 2006-12-27 09:40:10 UTC (rev 716)
@@ -26,6 +26,7 @@
MENUITEM "LCD registers (PXA only)" MenuItemLCD
MENUITEM "LCD test (PXA only)" MenuItemLCDTest
MENUITEM "Boot Linux" MenuItemBootLinux
+ MENUITEM "Dump MMU" MenuItemDumpMMU
END
END
Modified: cocoboot/trunk/include/cocoboot_r.h
===================================================================
--- cocoboot/trunk/include/cocoboot_r.h 2006-12-26 23:57:02 UTC (rev 715)
+++ cocoboot/trunk/include/cocoboot_r.h 2006-12-27 09:40:10 UTC (rev 716)
@@ -14,6 +14,7 @@
#define MenuItemLCD 1002
#define MenuItemLCDTest 1003
#define MenuItemBootLinux 1004
+#define MenuItemDumpMMU 1005
#define ErrorAlert 1000
#define InfoAlert 1001
Modified: cocoboot/trunk/m68k/mainform.c
===================================================================
--- cocoboot/trunk/m68k/mainform.c 2006-12-26 23:57:02 UTC (rev 715)
+++ cocoboot/trunk/m68k/mainform.c 2006-12-27 09:40:10 UTC (rev 716)
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <DataMgr.h>
+#include <VFSMgr.h>
UInt32 reg(UInt32 addr);
int use_initrd;
@@ -100,7 +101,49 @@
}
+void dump_mmu()
+{
+ UInt16 volref;
+ UInt32 voliter = vfsIteratorStart;
+ FileRef file;
+ Err err = VFSVolumeEnumerate(&volref, &voliter);
+ char msg[255];
+ UInt32 addr, phys, lastphys=0xffff, lastvirt=0xffff, startphys=0xffff, startvirt=0xffff;
+ if (err != errNone) {
+ FrmCustomAlert(InfoAlert, "Memory card not found.", " ", " ");
+ return;
+ }
+
+ if (VFSFileOpen(volref, "/memorymap.txt", vfsModeWrite | vfsModeCreate, &file) != errNone) {
+ FrmCustomAlert(InfoAlert, "Can't open memorymap.txt for writing", " ", " ");
+ return;
+ }
+
+ addr = 0;
+ while (1) {
+ phys = virt_to_phys(addr);
+ if (phys != lastphys + 0x00100000) {
+ if (startphys && startphys!=0xffff) {
+ sprintf(msg, "%08lx-%08lx -> %08lx-%08lx\n", startvirt, lastvirt, startphys, lastphys);
+ VFSFileWrite(file, StrLen(msg), msg, NULL);
+ }
+ startphys = phys;
+ startvirt = addr;
+ }
+ lastphys = phys;
+ lastvirt = addr;
+ addr += 0x00100000;
+ if (addr >= 0xff000000) break;
+ }
+ sprintf(msg, "%08lx-%08lx -> %08lx-%08lx\n", startvirt, lastvirt, startphys, lastphys);
+ VFSFileWrite(file, StrLen(msg), msg, NULL);
+ VFSFileClose(file);
+
+ FrmCustomAlert(InfoAlert, "/memorymap.txt created", " ", " ");
+}
+
+
void cpu_info()
{
char msg[255];
@@ -280,6 +323,10 @@
case MenuItemMem:
mem_info();
return true;
+ case MenuItemDumpMMU:
+ dump_mmu();
+ return true;
+
}
return false;
}
@@ -330,7 +377,7 @@
cmdline_p = FrmGetObjectPtr(form, FrmGetObjectIndex(form, CommandLine));
cmdline_th = MemHandleNew(size);
cmdline_tp = MemHandleLock(cmdline_th);
- StrCopy(cmdline_tp, "init=/linuxrc"); /* default value */
+ StrCopy(cmdline_tp, "init=/linuxrc root=/dev/mmcblk0p2"); /* default value */
//PrefGetAppPreferences ('CcBt', 1, cmdline_tp, &size, true);
MemHandleUnlock(cmdline_th);
FldSetTextHandle(cmdline_p, cmdline_th);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|