This commit is contained in:
Julian Barathieu 2019-03-26 10:34:36 +01:00
parent 6e4528e78c
commit f67e1baa25
4 changed files with 14 additions and 15 deletions

View File

@ -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

View File

@ -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();

View File

@ -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);
}
//

View File

@ -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) {