1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:07:34 +00:00

Add the basic character devices to kernel.

This commit is contained in:
Andreas Kling 2018-10-16 14:33:16 +02:00
parent 12e515735b
commit aec8ab0a60
13 changed files with 52 additions and 58 deletions

View file

@ -3,6 +3,7 @@
#include "types.h"
#include "DataBuffer.h"
#include "RefPtr.h"
#include <AK/StdLib.h>
/* IPC message types. There will be moar. */
#define MSG_INTERRUPT 0x00000001

View file

@ -22,7 +22,12 @@ KERNEL_OBJS = \
IDEDiskDevice.o
VFS_OBJS = \
../VirtualFileSystem/DiskDevice.o
../VirtualFileSystem/DiskDevice.o \
../VirtualFileSystem/CharacterDevice.o \
../VirtualFileSystem/NullDevice.o \
../VirtualFileSystem/FullDevice.o \
../VirtualFileSystem/ZeroDevice.o \
../VirtualFileSystem/RandomDevice.o
OBJS = $(KERNEL_OBJS) $(VFS_OBJS)

View file

@ -1,5 +1,5 @@
#include "String.h"
#include "StdLib.h"
#include <AK/StdLib.h>
String::String()
{

View file

@ -15,6 +15,11 @@
#include "FileSystem.h"
#include "Userspace.h"
#include "IDEDiskDevice.h"
#include <VirtualFileSystem/NullDevice.h>
#include <VirtualFileSystem/ZeroDevice.h>
#include <VirtualFileSystem/FullDevice.h>
#include <VirtualFileSystem/RandomDevice.h>
#include <AK/OwnPtr.h>
#if 0
/* Keyboard LED disco task ;^) */
@ -124,7 +129,11 @@ void init()
Disk::initialize();
FileSystem::initialize();
auto hd0 = IDEDiskDevice::create();
auto dev_hd0 = IDEDiskDevice::create();
auto dev_null = make<NullDevice>();
auto dev_full = make<FullDevice>();
auto dev_zero = make<ZeroDevice>();
auto dev_random = make<RandomDevice>();
// new Task(motd_main, "motd", IPC::Handle::MotdTask, Task::Ring0);
new Task(user_main, "user", IPC::Handle::UserTask, Task::Ring3);

3
Kernel/kstdio.h Normal file
View file

@ -0,0 +1,3 @@
#pragma once
#include "VGA.h"

View file

@ -6,48 +6,6 @@
#define PUBLIC
#define PRIVATE static
template <typename T>
T&& move(T& arg)
{
return static_cast<T&&>(arg);
}
template<typename T>
T min(T a, T b)
{
return (a < b) ? a : b;
}
template<typename T>
T max(T a, T b)
{
return (a > b) ? a : b;
}
template<typename T, typename U>
void swap(T& a, U& b)
{
U tmp = move((U&)a);
a = (T&&)move(b);
b = move(tmp);
}
template<typename T>
struct identity {
typedef T type;
};
template<typename T>
T&& forward(typename identity<T>::type&& param)
{ return static_cast<typename identity<T>::type&&>(param); }
template<typename T, typename U>
T exchange(T& a, U&& b)
{
T tmp = move(a);
a = move(b);
return tmp;
}
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int DWORD;