Merge branch 'acpi' into pci
This commit is contained in:
commit
0f62dbb43b
|
@ -52,7 +52,7 @@ BtHeader:
|
||||||
|
|
||||||
[section .joke]
|
[section .joke]
|
||||||
;; MAGNIFICENT MULTIBOOT HEADER FOR OUR OS BINARY --------------------------- ;;
|
;; 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]
|
[section .text]
|
||||||
;;MULTIBOOT POINT ENTRY FOR GRUB -------------------------------------------- ;;
|
;;MULTIBOOT POINT ENTRY FOR GRUB -------------------------------------------- ;;
|
||||||
|
|
|
@ -257,6 +257,8 @@ error_t MmMapPageFrame(ulong id, void *virtAddr, ulong flags)
|
||||||
assert(id);
|
assert(id);
|
||||||
AllocatedPage_t *busyPage = &busyPagesList;
|
AllocatedPage_t *busyPage = &busyPagesList;
|
||||||
|
|
||||||
|
void *virtAddrBegin = virtAddr;
|
||||||
|
|
||||||
while(busyPage->next) {
|
while(busyPage->next) {
|
||||||
busyPage = 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;
|
return EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,5 +300,7 @@ error_t MmUnmapPageFrame(ulong id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugLog("Page frame id %d unmapped\n", id);
|
||||||
|
|
||||||
return EOK;
|
return EOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,62 @@ error_t CmdDmesg(int argc, char **argv, char *cmdline)
|
||||||
return EOK;
|
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)
|
error_t CmdHelp(int argc, char **argv, char *cmdline)
|
||||||
{
|
{
|
||||||
uint i, count = 0;
|
uint i, count = 0;
|
||||||
|
@ -233,6 +289,7 @@ Command_t shcmdtable[] =
|
||||||
{ "exit", CmdQuit, "Initiate shutdown" },
|
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||||
{ "help", CmdHelp, "Show this message" },
|
{ "help", CmdHelp, "Show this message" },
|
||||||
{ "march", CmdStarWars, "Play the Imperial March" },
|
{ "march", CmdStarWars, "Play the Imperial March" },
|
||||||
|
{ "memdump", CmdDumpMem, "Dump memory starting from addr to end"},
|
||||||
{ "mmap", CmdMemMap, "Show memory map" },
|
{ "mmap", CmdMemMap, "Show memory map" },
|
||||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||||
{ "prompt", CmdPrompt, "Change shell prompt" },
|
{ "prompt", CmdPrompt, "Change shell prompt" },
|
||||||
|
|
|
@ -111,41 +111,6 @@ error_t CmdDumpATASect(int argc, char **argv, char *cmdline)
|
||||||
return EOK;
|
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)
|
error_t CmdFloatDiv(int argc, char **argv, char *cmdline)
|
||||||
{
|
{
|
||||||
double a = (double)atoi(argv[1]);
|
double a = (double)atoi(argv[1]);
|
||||||
|
@ -352,7 +317,6 @@ static Command_t testcmdtable[] =
|
||||||
{ "args", CmdArgs, "Print command line" },
|
{ "args", CmdArgs, "Print command line" },
|
||||||
{ "atoi", CmdAtoi, "Print command line atoised" },
|
{ "atoi", CmdAtoi, "Print command line atoised" },
|
||||||
{ "dmpsec", CmdDumpATASect, "Dump an ATA sector on screen" },
|
{ "dmpsec", CmdDumpATASect, "Dump an ATA sector on screen" },
|
||||||
{ "dmp", CmdDumpMem, "Dump 1MB of memory starting from addr"},
|
|
||||||
{ "help", CmdHelpTest, "Show this message" },
|
{ "help", CmdHelpTest, "Show this message" },
|
||||||
{ "div", CmdFloatDiv, "Float div. Usage : div a b. Returns a/b"},
|
{ "div", CmdFloatDiv, "Float div. Usage : div a b. Returns a/b"},
|
||||||
{ "transvtp", CmdPageTranslateVirtToPhy, "Translate a virtual to"
|
{ "transvtp", CmdPageTranslateVirtToPhy, "Translate a virtual to"
|
||||||
|
|
|
@ -39,9 +39,8 @@ int strcmp(const char *str1, const char *str2)
|
||||||
//
|
//
|
||||||
int strncmp(const char *str1, const char *str2, size_t n)
|
int strncmp(const char *str1, const char *str2, size_t n)
|
||||||
{
|
{
|
||||||
size_t it = 0;
|
while (n && *str1 && *str1 == *str2) str1++, str2++, n--;
|
||||||
|
if (!n) return 0;
|
||||||
while (*str1 == *str2 && *str2 && it < n) str1++, str2++, it++;
|
|
||||||
|
|
||||||
return *(uchar *)str1 - *(uchar *)str2;
|
return *(uchar *)str1 - *(uchar *)str2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue