bputc() fix
This commit is contained in:
parent
5c931641ad
commit
c34221071d
|
@ -58,8 +58,28 @@ error_t bputc(Buffer_t *buf, uchar ch)
|
||||||
// That should change; there should be a flag for it
|
// That should change; there should be a flag for it
|
||||||
if (buf->flags & BF_LINE) {
|
if (buf->flags & BF_LINE) {
|
||||||
|
|
||||||
|
// Deal with line feeds by filling the rest of the line with spaces
|
||||||
|
// We need a field for choosing a different filler, e.g. '\0'
|
||||||
|
if (ch == '\n') {
|
||||||
|
assert(buf->lastLF < buf->lineLen);
|
||||||
|
|
||||||
|
// Make sure double \n's have effect
|
||||||
|
//if (buf->lastLF == 0) {
|
||||||
|
// buf->lastLF = buf->lineLen;
|
||||||
|
//}
|
||||||
|
|
||||||
|
int off = buf->lineLen - buf->lastLF;
|
||||||
|
while (off > 0) {
|
||||||
|
*buf->wp++ = ' ';
|
||||||
|
off--;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf->lastLF = 0;
|
||||||
|
if (buf->flusher) buf->flusher(buf);
|
||||||
|
}
|
||||||
|
|
||||||
// Deal with carriage returns
|
// Deal with carriage returns
|
||||||
if (ch == '\r') {
|
else if (ch == '\r') {
|
||||||
buf->wp -= buf->lastLF;
|
buf->wp -= buf->lastLF;
|
||||||
buf->lastLF = 0;
|
buf->lastLF = 0;
|
||||||
assert(buf->wp >= buf->buf);
|
assert(buf->wp >= buf->buf);
|
||||||
|
@ -76,17 +96,6 @@ error_t bputc(Buffer_t *buf, uchar ch)
|
||||||
if (rc > 0) return rc;
|
if (rc > 0) return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal with line feeds by filling the rest of the line with spaces
|
|
||||||
// We need a field for choosing a different filler, e.g. '\0'
|
|
||||||
else if (ch == '\n') {
|
|
||||||
assert(buf->lastLF < buf->lineLen);
|
|
||||||
while (buf->lastLF > 0) {
|
|
||||||
rc = bputc(buf, ' ');
|
|
||||||
}
|
|
||||||
if (rc > 0) return rc;
|
|
||||||
if (buf->flusher) buf->flusher(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just a regular character
|
// Just a regular character
|
||||||
else {
|
else {
|
||||||
// Do we have to scroll up?
|
// Do we have to scroll up?
|
||||||
|
@ -113,7 +122,7 @@ error_t bputc(Buffer_t *buf, uchar ch)
|
||||||
else {
|
else {
|
||||||
memcpy(buf->buf, buf->buf + bufSize,
|
memcpy(buf->buf, buf->buf + bufSize,
|
||||||
buf->size - bufSize);
|
buf->size - bufSize);
|
||||||
buf->wp -= buf->lineLen;
|
buf->wp -= bufSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,40 +121,37 @@ extern error_t IoInitVGABuffer(void);
|
||||||
//
|
//
|
||||||
noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
|
noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
|
||||||
{
|
{
|
||||||
|
int tmp;
|
||||||
|
|
||||||
// We're not ready to deal with interrupts
|
// We're not ready to deal with interrupts
|
||||||
KeDisableIRQs();
|
KeDisableIRQs();
|
||||||
|
|
||||||
// Initialize the BootInfo_t structure
|
// Initialize the BootInfo_t structure
|
||||||
BtInitBootInfo(mbInfo);
|
BtInitBootInfo(mbInfo);
|
||||||
|
|
||||||
|
|
||||||
// Get ready to print things
|
// Get ready to print things
|
||||||
IoInitVGABuffer();
|
IoInitVGABuffer();
|
||||||
|
|
||||||
BARRIER();
|
|
||||||
|
|
||||||
// Hello world
|
// Hello world
|
||||||
KernLog("%c%c%c OS/K\n\n", 219, 219, 219);
|
KernLog("%c%c%c OS/K\n\n", 219, 219, 219);
|
||||||
|
|
||||||
KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC);
|
KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC);
|
||||||
|
|
||||||
|
tmp = (BtGetBootInfo(btldr).kernelEndAddr
|
||||||
|
- BtGetBootInfo(btldr).kernelAddr) / KB;
|
||||||
KernLog("[Init] Kernel successfully loaded at %p with %x magic\n"
|
KernLog("[Init] Kernel successfully loaded at %p with %x magic\n"
|
||||||
" and it uses %d Kio\n\n",
|
" and it uses %d Kio\n\n",
|
||||||
BtGetBootInfo(btldr).kernelAddr,
|
BtGetBootInfo(btldr).kernelAddr,
|
||||||
mbMagic,
|
mbMagic,tmp);
|
||||||
(BtGetBootInfo(btldr).kernelEndAddr - BtGetBootInfo(btldr).kernelAddr)
|
|
||||||
/ KB
|
|
||||||
);
|
|
||||||
|
|
||||||
//Memory mapping
|
//Memory mapping
|
||||||
MmInitMemoryMap();
|
MmInitMemoryMap();
|
||||||
|
|
||||||
MmInitHeap();
|
MmInitHeap();
|
||||||
|
|
||||||
BARRIER();
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(i < 517) { KernLog("%d\n", i++);}
|
while(i < 512) { KernLog("%d\n", i++);}
|
||||||
|
|
||||||
PsInitSched();
|
PsInitSched();
|
||||||
|
|
||||||
// We're out
|
// We're out
|
||||||
|
|
|
@ -44,6 +44,8 @@ error_t bvgaflusher(Buffer_t *buf)
|
||||||
ushort *fbp = BtGetBootInfo(video).framebufferAddr;
|
ushort *fbp = BtGetBootInfo(video).framebufferAddr;
|
||||||
const uchar color = 0xf;
|
const uchar color = 0xf;
|
||||||
|
|
||||||
|
assert(buf->lastLF == 0);
|
||||||
|
|
||||||
uchar *currentLine = buf->wp - buf->lineLen;
|
uchar *currentLine = buf->wp - buf->lineLen;
|
||||||
uchar *ptr = (uchar *)lmax((size_t)buf->buf,
|
uchar *ptr = (uchar *)lmax((size_t)buf->buf,
|
||||||
(size_t)currentLine
|
(size_t)currentLine
|
||||||
|
|
634184
kaleid32_disasm.asm
634184
kaleid32_disasm.asm
File diff suppressed because it is too large
Load Diff
630816
kaleid64_disasm.asm
630816
kaleid64_disasm.asm
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue