Build cleanup and implemented support for qemu debug logging

This commit is contained in:
Ali Mashtizadeh 2014-07-02 14:06:00 -07:00
parent c6e56a25f6
commit 00cf512522
5 changed files with 72 additions and 9 deletions

View File

@ -19,14 +19,16 @@ src_amd64 = [
"amd64/lapic.c",
"amd64/ioapic.c",
"dev/x86/vgacons.c",
"dev/ahci.c",
"dev/pci.c",
"dev/x86/debugcons.c",
]
src_common = [
"kern/libc.c",
"kern/palloc.c",
"kern/printf.c",
"dev/ahci.c",
"dev/console.c",
"dev/pci.c",
]
if (env["ARCH"] == "amd64"):

28
sys/dev/console.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdint.h>
#include "console.h"
#include "x86/vgacons.h"
#include "x86/debugcons.h"
void
Console_Init()
{
VGA_Init();
DebugConsole_Init();
}
void
Console_Putc(char ch)
{
VGA_Putc(ch);
DebugConsole_Putc(ch);
}
void
Console_Puts(const char *str)
{
VGA_Puts(str);
DebugConsole_Puts(str);
}

View File

@ -2,13 +2,9 @@
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
#include "x86/vgacons.h"
// Placeholder until a proper console driver is made
#define Console_Init VGA_Init
#define Console_Putc VGA_Putc
#define Console_Puts VGA_Puts
void Console_Init();
void Console_Putc(char ch);
void Console_Puts(const char *str);
#endif /* __CONSOLE_H__ */

28
sys/dev/x86/debugcons.c Normal file
View File

@ -0,0 +1,28 @@
/*
* Debug Console for QEmu compatible port 0xe9
*/
#include <stdint.h>
#include <cdefs.h>
#include "../../amd64/amd64.h"
#include "../../amd64/amd64op.h"
void DebugConsole_Init()
{
}
void DebugConsole_Putc(short c)
{
outb(0xe9, (uint8_t)c);
}
void DebugConsole_Puts(const char *str)
{
const char *p = str;
while (*p != '\0')
DebugConsole_Putc(*p++);
}

9
sys/dev/x86/debugcons.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __DEBUGCONS_H__
#define __DEBUGCONS_H__
void DebugConsole_Init(void);
void DebugConsole_Putc(char ch);
void DebugConsole_Puts(const char *str);
#endif /* __DEBUGCONS_H__ */