mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Fixes
This commit is contained in:
parent
8f4fd73de3
commit
0abbf67bc2
@ -35,6 +35,10 @@
|
||||
#define CHAR_BIT 8
|
||||
#define BITS_IN(T) (sizeof(T) * CHAR_BIT)
|
||||
|
||||
#define _ADDR_TO_MB(x) ((x)>>20)
|
||||
#define _ADDR_TO_KB(x) (((x)>>10)&(KB-1))
|
||||
#define _ADDR_TO_B(x) ((x)&(KB-1))
|
||||
|
||||
/* XXX find a generic way */
|
||||
#define BYTES_TO_WORDS(B) ((B) >> 1)
|
||||
#define BYTES_TO_DWORDS(B) ((B) >> 2)
|
||||
|
@ -193,10 +193,11 @@ void MmPrintMemoryMap(void) {
|
||||
default:;
|
||||
}
|
||||
|
||||
KernLog("Mem zone : %lp\t%s\twith length: %d Kio\n",
|
||||
memoryMap.entry[i].addr,
|
||||
avStr,
|
||||
memoryMap.entry[i].length / KB
|
||||
ulong len = memoryMap.entry[i].length;
|
||||
|
||||
KernLog("Mem zone : %lp\t%s\twith length: %luMB + %luKB + %luB\n",
|
||||
memoryMap.entry[i].addr, avStr,
|
||||
_ADDR_TO_MB(len), _ADDR_TO_KB(len), _ADDR_TO_B(len)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,9 @@ void pstest(void)
|
||||
|
||||
int tick = 0;
|
||||
|
||||
while (tick < 14) {
|
||||
KernLog("\n");
|
||||
|
||||
while (tick < 100) {
|
||||
//if (tick%25==0)ClearTerm(StdOut);
|
||||
if (tick > 0 && tick != 50 && tick % 10 == 0) {
|
||||
KernLog("Blocking current process\n");
|
||||
|
@ -24,18 +24,6 @@
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
Command_t cmdtable[] =
|
||||
{
|
||||
{ "beep", CmdBeep, "Make a beep" },
|
||||
{ "date", CmdDate, "Print date" },
|
||||
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||
{ "help", CmdHelp, "Show this message" },
|
||||
{ "mmap", CmdMemMap, "Show memory map" },
|
||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||
{ "quit", CmdQuit, "Alias for 'exit'" },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
error_t CmdBeep(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
if (rand() % 64 == 0 || (argc > 1 && !strcmp(argv[1], "starwars"))) {
|
||||
@ -81,10 +69,6 @@ error_t CmdMemMap(int argc, char **argv, char *cmdline)
|
||||
return EOK;
|
||||
}
|
||||
|
||||
#define ADDR_TO_MB(x) ((x)>>20)
|
||||
#define ADDR_TO_KB(x) (((x)>>10)&(KB-1))
|
||||
#define ADDR_TO_B(x) ((x)&(KB-1))
|
||||
|
||||
error_t CmdMemUsage(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
size_t start, end;
|
||||
@ -101,34 +85,50 @@ error_t CmdMemUsage(int argc, char **argv, char *cmdline)
|
||||
diff = (size_t)end - (size_t)start;
|
||||
|
||||
KernLog("Heap start:\t\t%p (%luMB + %luKB + %luB)\n",
|
||||
start, ADDR_TO_MB(start),
|
||||
ADDR_TO_KB(start),
|
||||
ADDR_TO_B(start));
|
||||
start, _ADDR_TO_MB(start),
|
||||
_ADDR_TO_KB(start),
|
||||
_ADDR_TO_B(start));
|
||||
|
||||
KernLog("Heap end:\t\t%p (%luMB + %luKB + %luB)\n",
|
||||
end, ADDR_TO_MB(end),
|
||||
ADDR_TO_KB(end),
|
||||
ADDR_TO_B(end));
|
||||
end, _ADDR_TO_MB(end),
|
||||
_ADDR_TO_KB(end),
|
||||
_ADDR_TO_B(end));
|
||||
|
||||
KernLog("Heap size:\t\t%p (%luMB + %luKB + %luB)\n",
|
||||
diff, ADDR_TO_MB(diff),
|
||||
ADDR_TO_KB(diff),
|
||||
ADDR_TO_B(diff));
|
||||
KernLog("Heap size:\t\t%luMB + %luKB + %luB (%#lx)\n",
|
||||
_ADDR_TO_MB(diff),
|
||||
_ADDR_TO_KB(diff),
|
||||
_ADDR_TO_B(diff),
|
||||
diff);
|
||||
|
||||
KernLog("Max heap size:\t%luMB + %luKB + %luB\n",
|
||||
ADDR_TO_MB(max),
|
||||
ADDR_TO_KB(max),
|
||||
ADDR_TO_B(max));
|
||||
KernLog("Max heap size:\t%luMB + %luKB + %luB (%#lx)\n",
|
||||
_ADDR_TO_MB(max),
|
||||
_ADDR_TO_KB(max),
|
||||
_ADDR_TO_B(max),
|
||||
max);
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
extern void pstest(void);
|
||||
|
||||
error_t CmdPsTest(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
pstest();
|
||||
return EOK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Command_t cmdtable[] =
|
||||
{
|
||||
{ "beep", CmdBeep, "Make a beep" },
|
||||
{ "date", CmdDate, "Print date" },
|
||||
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||
{ "help", CmdHelp, "Show this message" },
|
||||
{ "mmap", CmdMemMap, "Show memory map" },
|
||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||
{ "pstest", CmdPsTest, "Scheduler test routine" },
|
||||
{ "quit", CmdQuit, "Alias for 'exit'" },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -33,6 +33,9 @@ void ExecuteCommand(char *cmdbuf)
|
||||
error_t rc;
|
||||
Command_t *cmd;
|
||||
bool found = false;
|
||||
|
||||
if (!cmdbuf || !*cmdbuf)
|
||||
return;
|
||||
|
||||
memzero(*shargv, ARG_MAX);
|
||||
rc = KalCmdLineToArgVec(cmdbuf, &shargc, shargv);
|
||||
|
@ -51,14 +51,5 @@ struct Command_t
|
||||
const char *help;
|
||||
};
|
||||
|
||||
#define DEC_CMD(name) error_t Cmd##name(int, char **, char *)
|
||||
|
||||
DEC_CMD(Beep);
|
||||
DEC_CMD(Quit);
|
||||
DEC_CMD(Help);
|
||||
DEC_CMD(Date);
|
||||
DEC_CMD(MemMap);
|
||||
DEC_CMD(MemUsage);
|
||||
|
||||
extern Command_t cmdtable[];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user