mirror of https://gitlab.com/nakst/essence
reduce kernel stack size
This commit is contained in:
parent
1eb2dfe549
commit
03cc2a7f25
|
@ -405,12 +405,12 @@ Thread *Scheduler::SpawnThread(const char *cName, uintptr_t startAddress, uintpt
|
||||||
|
|
||||||
// Allocate the thread's stacks.
|
// Allocate the thread's stacks.
|
||||||
#if defined(ES_BITS_64)
|
#if defined(ES_BITS_64)
|
||||||
uintptr_t kernelStackSize = userland ? 0x4000 /* 16KB */ : 0x10000 /* 64KB */;
|
uintptr_t kernelStackSize = 0x5000 /* 20KB */;
|
||||||
#elif defined(ES_BITS_32)
|
#elif defined(ES_BITS_32)
|
||||||
uintptr_t kernelStackSize = userland ? 0x3000 /* 12KB */ : 0x8000 /* 32KB */;
|
uintptr_t kernelStackSize = 0x4000 /* 16KB */;
|
||||||
#endif
|
#endif
|
||||||
uintptr_t userStackReserve = userland ? 0x400000 /* 4MB */ : kernelStackSize;
|
uintptr_t userStackReserve = userland ? 0x400000 /* 4MB */ : kernelStackSize;
|
||||||
uintptr_t userStackCommit = userland ? 0x20000 /* 128KB */ : 0;
|
uintptr_t userStackCommit = userland ? 0x10000 /* 64KB */ : 0;
|
||||||
uintptr_t stack = 0, kernelStack = 0;
|
uintptr_t stack = 0, kernelStack = 0;
|
||||||
|
|
||||||
if (flags & SPAWN_THREAD_IDLE) goto skipStackAllocation;
|
if (flags & SPAWN_THREAD_IDLE) goto skipStackAllocation;
|
||||||
|
|
|
@ -1621,15 +1621,39 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_DEVICE_CONTROL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSCALL_IMPLEMENT(ES_SYSCALL_DEBUG_COMMAND) {
|
SYSCALL_IMPLEMENT(ES_SYSCALL_DEBUG_COMMAND) {
|
||||||
|
SYSCALL_PERMISSION(ES_PERMISSION_TAKE_SYSTEM_SNAPSHOT);
|
||||||
|
|
||||||
|
// TODO Temporary: moved out of the DEBUG_BUILD block.
|
||||||
|
|
||||||
if (argument0 == 3) {
|
if (argument0 == 3) {
|
||||||
SYSCALL_PERMISSION(ES_PERMISSION_TAKE_SYSTEM_SNAPSHOT);
|
|
||||||
// TODO Temporary: moved out of the DEBUG_BUILD block.
|
|
||||||
extern char kernelLog[];
|
extern char kernelLog[];
|
||||||
extern uintptr_t kernelLogPosition;
|
extern uintptr_t kernelLogPosition;
|
||||||
size_t bytes = kernelLogPosition;
|
size_t bytes = kernelLogPosition;
|
||||||
if (argument2 < bytes) bytes = argument2;
|
if (argument2 < bytes) bytes = argument2;
|
||||||
EsMemoryCopy((void *) argument1, kernelLog, bytes);
|
EsMemoryCopy((void *) argument1, kernelLog, bytes);
|
||||||
SYSCALL_RETURN(bytes, false);
|
SYSCALL_RETURN(bytes, false);
|
||||||
|
} else if (argument0 == 12) {
|
||||||
|
EsMemoryStatistics statistics;
|
||||||
|
EsMemoryZero(&statistics, sizeof(statistics));
|
||||||
|
statistics.fixedHeapAllocationCount = K_FIXED->allocationsCount;
|
||||||
|
statistics.fixedHeapTotalSize = K_FIXED->size;
|
||||||
|
statistics.coreHeapAllocationCount = K_CORE->allocationsCount;
|
||||||
|
statistics.coreHeapTotalSize = K_CORE->size;
|
||||||
|
statistics.cachedNodes = fs.bootFileSystem->cachedNodes.count;
|
||||||
|
statistics.cachedDirectoryEntries = fs.bootFileSystem->cachedDirectoryEntries.count;
|
||||||
|
statistics.totalSurfaceBytes = graphics.totalSurfaceBytes;
|
||||||
|
statistics.commitPageable = pmm.commitPageable;
|
||||||
|
statistics.commitFixed = pmm.commitFixed;
|
||||||
|
statistics.commitLimit = pmm.commitLimit;
|
||||||
|
statistics.commitFixedLimit = pmm.commitFixedLimit;
|
||||||
|
statistics.commitRemaining = MM_REMAINING_COMMIT();
|
||||||
|
statistics.maximumObjectCachePages = MM_OBJECT_CACHE_PAGES_MAXIMUM();
|
||||||
|
statistics.approximateObjectCacheSize = pmm.approximateTotalObjectCacheBytes;
|
||||||
|
statistics.countZeroedPages = pmm.countZeroedPages;
|
||||||
|
statistics.countFreePages = pmm.countFreePages;
|
||||||
|
statistics.countStandbyPages = pmm.countStandbyPages;
|
||||||
|
statistics.countActivePages = pmm.countActivePages;
|
||||||
|
SYSCALL_WRITE(argument1, &statistics, sizeof(statistics));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_BUILD
|
#ifdef DEBUG_BUILD
|
||||||
|
@ -1668,28 +1692,6 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_DEBUG_COMMAND) {
|
||||||
KEventWait(&event, 1000);
|
KEventWait(&event, 1000);
|
||||||
EsHeapFree(scheduler.threadEventLog, 0, K_FIXED);
|
EsHeapFree(scheduler.threadEventLog, 0, K_FIXED);
|
||||||
scheduler.threadEventLog = nullptr;
|
scheduler.threadEventLog = nullptr;
|
||||||
} else if (argument0 == 12) {
|
|
||||||
EsMemoryStatistics statistics;
|
|
||||||
EsMemoryZero(&statistics, sizeof(statistics));
|
|
||||||
statistics.fixedHeapAllocationCount = K_FIXED->allocationsCount;
|
|
||||||
statistics.fixedHeapTotalSize = K_FIXED->size;
|
|
||||||
statistics.coreHeapAllocationCount = K_CORE->allocationsCount;
|
|
||||||
statistics.coreHeapTotalSize = K_CORE->size;
|
|
||||||
statistics.cachedNodes = fs.bootFileSystem->cachedNodes.count;
|
|
||||||
statistics.cachedDirectoryEntries = fs.bootFileSystem->cachedDirectoryEntries.count;
|
|
||||||
statistics.totalSurfaceBytes = graphics.totalSurfaceBytes;
|
|
||||||
statistics.commitPageable = pmm.commitPageable;
|
|
||||||
statistics.commitFixed = pmm.commitFixed;
|
|
||||||
statistics.commitLimit = pmm.commitLimit;
|
|
||||||
statistics.commitFixedLimit = pmm.commitFixedLimit;
|
|
||||||
statistics.commitRemaining = MM_REMAINING_COMMIT();
|
|
||||||
statistics.maximumObjectCachePages = MM_OBJECT_CACHE_PAGES_MAXIMUM();
|
|
||||||
statistics.approximateObjectCacheSize = pmm.approximateTotalObjectCacheBytes;
|
|
||||||
statistics.countZeroedPages = pmm.countZeroedPages;
|
|
||||||
statistics.countFreePages = pmm.countFreePages;
|
|
||||||
statistics.countStandbyPages = pmm.countStandbyPages;
|
|
||||||
statistics.countActivePages = pmm.countActivePages;
|
|
||||||
SYSCALL_WRITE(argument1, &statistics, sizeof(statistics));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue