mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Heap fix
This commit is contained in:
parent
6e4528e78c
commit
f67e1baa25
@ -69,12 +69,11 @@ error_t bputc(Buffer_t *buf, uchar ch)
|
||||
// We assume tabs are 4 characters long for now
|
||||
else if (ch == '\t') {
|
||||
rc = bputc(buf, ' ');
|
||||
if (rc > 0) return rc;
|
||||
|
||||
while (buf->lastLF % 4 > 0) {
|
||||
rc = bputc(buf, ' ');
|
||||
if (rc > 0) return rc;
|
||||
}
|
||||
if (rc > 0) return rc;
|
||||
}
|
||||
|
||||
// Deal with line feeds by filling the rest of the line with spaces
|
||||
@ -83,8 +82,8 @@ error_t bputc(Buffer_t *buf, uchar ch)
|
||||
assert(buf->lastLF < buf->lineLen);
|
||||
while (buf->lastLF > 0) {
|
||||
rc = bputc(buf, ' ');
|
||||
if (rc > 0) return rc;
|
||||
}
|
||||
if (rc > 0) return rc;
|
||||
}
|
||||
|
||||
// Just a regular character
|
||||
|
@ -145,12 +145,10 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
|
||||
MmInitHeap();
|
||||
PsInitSched();
|
||||
|
||||
Buffer_t *buf = BOpenLineBuf(NULL, BS_WRONLY, 80, 24, 1, NULL);
|
||||
|
||||
error_t rc = BPrintOnBuf(buf, "%+#05x", 0xcafeb00b);
|
||||
if(rc)KernLog("error\n");
|
||||
|
||||
KernLog((char*)buf->buf);
|
||||
//Buffer_t *buf = BOpenLineBuf(NULL, BS_WRONLY, 80, 24, 1, NULL);
|
||||
//error_t rc = BPrintOnBuf(buf, "%+#05x", 0xcafeb00b);
|
||||
//if(rc)KernLog("error\n");
|
||||
//KernLog((char*)buf->buf);
|
||||
|
||||
// We're out
|
||||
PsFiniSched();
|
||||
|
@ -44,14 +44,16 @@ void MmInitHeap(void)
|
||||
|
||||
// Get the first available zone address
|
||||
_heap_start = MmGetFirstAvailZone((void*)0);
|
||||
|
||||
// Align it
|
||||
while ((size_t)_heap_start % alignof(QWORD)) {
|
||||
_heap_start++;
|
||||
}
|
||||
_heap_start = (void *)_ALIGN_UP((size_t)_heap_start, alignof(QWORD));
|
||||
|
||||
// Initialize the heap
|
||||
_heap_end = _heap_start;
|
||||
_heap_max = lmin(8 * MB, MmGetAvailZoneSize(_heap_end));
|
||||
KernLog("[InitHeap] Start address : %p, Max length : %u Mio\n\n", _heap_start, _heap_max / MB);
|
||||
_heap_max = MmGetAvailZoneSize(_heap_end);
|
||||
|
||||
KernLog("[InitHeap] Start address : %p, Max length : %u Mio\n\n",
|
||||
_heap_start, _heap_max / MB);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -49,7 +49,7 @@ error_t KalAllocMemory(void **ptr, size_t req, int flags, size_t align)
|
||||
if (rc) {
|
||||
if ((flags & M_CANFAIL) != 0)
|
||||
return rc;
|
||||
KeStartPanic("Out of memory");
|
||||
KeStartPanic("KalAllocMemory: Out of memory");
|
||||
}
|
||||
|
||||
if (flags & M_ZEROED) {
|
||||
|
Loading…
Reference in New Issue
Block a user