Some updates
This commit is contained in:
parent
f30031e1d9
commit
12bdcbf19c
|
@ -52,7 +52,7 @@ BtHeader:
|
|||
|
||||
[section .joke]
|
||||
;; MAGNIFICENT MULTIBOOT HEADER FOR OUR OS BINARY --------------------------- ;;
|
||||
db "This program cannot be run in Win32 mode, or DOS mode, or in any operating system mode that owns your fantasy. KTHXBYE",0
|
||||
db "This program cannot be run in Win32 mode, or DOS mode, or in any operating system mode that owns your fantasy.",0
|
||||
|
||||
[section .text]
|
||||
;;MULTIBOOT POINT ENTRY FOR GRUB -------------------------------------------- ;;
|
||||
|
|
|
@ -257,6 +257,8 @@ error_t MmMapPageFrame(ulong id, void *virtAddr, ulong flags)
|
|||
assert(id);
|
||||
AllocatedPage_t *busyPage = &busyPagesList;
|
||||
|
||||
void *virtAddrBegin = virtAddr;
|
||||
|
||||
while(busyPage->next) {
|
||||
busyPage = busyPage->next;
|
||||
|
||||
|
@ -272,6 +274,9 @@ error_t MmMapPageFrame(ulong id, void *virtAddr, ulong flags)
|
|||
}
|
||||
}
|
||||
|
||||
DebugLog("Page frame id %d mapped from %p to %p\n",
|
||||
id, virtAddrBegin, virtAddr);
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
|
@ -295,5 +300,7 @@ error_t MmUnmapPageFrame(ulong id)
|
|||
}
|
||||
}
|
||||
|
||||
DebugLog("Page frame id %d unmapped\n", id);
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
|
|
@ -130,6 +130,62 @@ error_t CmdDmesg(int argc, char **argv, char *cmdline)
|
|||
return EOK;
|
||||
}
|
||||
|
||||
error_t CmdDumpMem(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
if (argc < 2 || argc > 3) {
|
||||
KernLog("Invalid argument : argc = %d\n", argc);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
char sector[8192] = {0};
|
||||
int maximum = 0;
|
||||
int x = 0;
|
||||
int step = 8;
|
||||
char *address = (char*)strtoul(argv[1], NULL, 16);
|
||||
char *end = (char*)(strtoul(argv[1], NULL, 16) + step);
|
||||
|
||||
if (argc >= 3) {
|
||||
end = (char*)(strtoul(argv[2], NULL, 16) + step);
|
||||
}
|
||||
|
||||
maximum = (int)(end - address);
|
||||
|
||||
if (address > end) {
|
||||
KernLog("Invalid argument\n");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
//KernLog("Address begin: %p\tAddress end: %p\n", address, end);
|
||||
|
||||
for (int i = 0; i < 8192 && i < maximum; i++) {
|
||||
sector[i] = *(address+i);
|
||||
}
|
||||
|
||||
for (x = 0; x < maximum; x += step) {
|
||||
|
||||
KernLog("%C", shcol);
|
||||
KernLog("[%p] ", (ulong)address + (ulong)x);
|
||||
|
||||
for (int i = 0; i < step; i++) {
|
||||
KernLog("%02x ", (uchar)sector[i+x]);
|
||||
}
|
||||
|
||||
KernLog(" %C ", VGA_COLOR_LIGHT_BLUE);
|
||||
|
||||
for (int i = 0; i < step; i++) {
|
||||
if (isprint(sector[i+x]))
|
||||
KernLog("%c",
|
||||
sector[i+x]
|
||||
);
|
||||
else
|
||||
KernLog("%c", 0);
|
||||
}
|
||||
|
||||
KernLog("\n");
|
||||
}
|
||||
return EOK;
|
||||
}
|
||||
|
||||
error_t CmdHelp(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
uint i, count = 0;
|
||||
|
@ -233,6 +289,7 @@ Command_t shcmdtable[] =
|
|||
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||
{ "help", CmdHelp, "Show this message" },
|
||||
{ "march", CmdStarWars, "Play the Imperial March" },
|
||||
{ "memdump", CmdDumpMem, "Dump memory starting from addr to end"},
|
||||
{ "mmap", CmdMemMap, "Show memory map" },
|
||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||
{ "prompt", CmdPrompt, "Change shell prompt" },
|
||||
|
|
|
@ -111,41 +111,6 @@ error_t CmdDumpATASect(int argc, char **argv, char *cmdline)
|
|||
return EOK;
|
||||
}
|
||||
|
||||
error_t CmdDumpMem(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
char sector[8] = {0};
|
||||
char *address = (char*)strtoul(argv[1], NULL, 16);
|
||||
int nb = 1; //atoi(argv[2]);
|
||||
int x = 0;
|
||||
int step = 8;
|
||||
|
||||
KernLog("Address begin: %p\n", address);
|
||||
|
||||
for (int i = 0; i < 8*nb; i++) {
|
||||
sector[i] = *address++;
|
||||
}
|
||||
|
||||
while(x < 8*nb) {
|
||||
KernLog("%C", shcol);
|
||||
for (int i = 0; i < step; i++) {
|
||||
KernLog("%02x ", (uchar)sector[i+x]);
|
||||
}
|
||||
KernLog(" %C ", VGA_COLOR_LIGHT_BLUE);
|
||||
for (int i = 0; i < step; i++) {
|
||||
if (isprint(sector[i+x]))
|
||||
KernLog("%c",
|
||||
sector[i+x]
|
||||
);
|
||||
else
|
||||
KernLog("%c", 0);
|
||||
}
|
||||
KernLog("\n");
|
||||
x += step;
|
||||
}
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
error_t CmdFloatDiv(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
double a = (double)atoi(argv[1]);
|
||||
|
@ -352,7 +317,6 @@ static Command_t testcmdtable[] =
|
|||
{ "args", CmdArgs, "Print command line" },
|
||||
{ "atoi", CmdAtoi, "Print command line atoised" },
|
||||
{ "dmpsec", CmdDumpATASect, "Dump an ATA sector on screen" },
|
||||
{ "dmp", CmdDumpMem, "Dump 1MB of memory starting from addr"},
|
||||
{ "help", CmdHelpTest, "Show this message" },
|
||||
{ "div", CmdFloatDiv, "Float div. Usage : div a b. Returns a/b"},
|
||||
{ "transvtp", CmdPageTranslateVirtToPhy, "Translate a virtual to"
|
||||
|
|
Loading…
Reference in New Issue