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 // We assume tabs are 4 characters long for now
else if (ch == '\t') { else if (ch == '\t') {
rc = bputc(buf, ' '); rc = bputc(buf, ' ');
if (rc > 0) return rc;
while (buf->lastLF % 4 > 0) { while (buf->lastLF % 4 > 0) {
rc = bputc(buf, ' '); 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 // 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); assert(buf->lastLF < buf->lineLen);
while (buf->lastLF > 0) { while (buf->lastLF > 0) {
rc = bputc(buf, ' '); rc = bputc(buf, ' ');
if (rc > 0) return rc;
} }
if (rc > 0) return rc;
} }
// Just a regular character // Just a regular character

View File

@ -145,12 +145,10 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
MmInitHeap(); MmInitHeap();
PsInitSched(); PsInitSched();
Buffer_t *buf = BOpenLineBuf(NULL, BS_WRONLY, 80, 24, 1, NULL); //Buffer_t *buf = BOpenLineBuf(NULL, BS_WRONLY, 80, 24, 1, NULL);
//error_t rc = BPrintOnBuf(buf, "%+#05x", 0xcafeb00b);
error_t rc = BPrintOnBuf(buf, "%+#05x", 0xcafeb00b); //if(rc)KernLog("error\n");
if(rc)KernLog("error\n"); //KernLog((char*)buf->buf);
KernLog((char*)buf->buf);
// We're out // We're out
PsFiniSched(); PsFiniSched();

View File

@ -44,14 +44,16 @@ void MmInitHeap(void)
// Get the first available zone address // Get the first available zone address
_heap_start = MmGetFirstAvailZone((void*)0); _heap_start = MmGetFirstAvailZone((void*)0);
// Align it // Align it
while ((size_t)_heap_start % alignof(QWORD)) { _heap_start = (void *)_ALIGN_UP((size_t)_heap_start, alignof(QWORD));
_heap_start++;
}
// Initialize the heap // Initialize the heap
_heap_end = _heap_start; _heap_end = _heap_start;
_heap_max = lmin(8 * MB, MmGetAvailZoneSize(_heap_end)); _heap_max = MmGetAvailZoneSize(_heap_end);
KernLog("[InitHeap] Start address : %p, Max length : %u Mio\n\n", _heap_start, _heap_max / MB);
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 (rc) {
if ((flags & M_CANFAIL) != 0) if ((flags & M_CANFAIL) != 0)
return rc; return rc;
KeStartPanic("Out of memory"); KeStartPanic("KalAllocMemory: Out of memory");
} }
if (flags & M_ZEROED) { if (flags & M_ZEROED) {