mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
Add a Console device and start refactoring screen output.
This commit is contained in:
parent
d5ec18027e
commit
a70bfb87d5
5 changed files with 95 additions and 13 deletions
40
Kernel/Console.cpp
Normal file
40
Kernel/Console.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include "Console.h"
|
||||
#include "VGA.h"
|
||||
|
||||
static Console* s_the;
|
||||
|
||||
Console& Console::the()
|
||||
{
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
Console::Console()
|
||||
{
|
||||
s_the = this;
|
||||
}
|
||||
|
||||
Console::~Console()
|
||||
{
|
||||
}
|
||||
|
||||
ssize_t Console::read(byte* buffer, size_t bufferSize)
|
||||
{
|
||||
// FIXME: Implement reading from the console.
|
||||
// Maybe we could use a ring buffer for this device?
|
||||
// A generalized ring buffer would probably be useful.
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int kprintfFromConsole(const char*, ...);
|
||||
|
||||
ssize_t Console::write(const byte* data, size_t size)
|
||||
{
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
kprintfFromConsole("%c", data[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue