Working kernel written on C and userspace-ready #1
@@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
static inline void IOAddressWrite32(UInt64 address, UInt32 value) {
|
static inline void IOAddressWrite32(Address address, UInt32 value) {
|
||||||
__asm__ volatile ("dsb sy" ::: "memory"); // wait till all previous writes are finished physically
|
__asm__ volatile ("dsb sy" ::: "memory"); // wait till all previous writes are finished physically
|
||||||
*(volatile UInt32*)address = value;
|
*(volatile UInt32*)address = value;
|
||||||
__asm__ volatile ("dsb sy" ::: "memory"); // wait till my write is finished physically
|
__asm__ volatile ("dsb sy" ::: "memory"); // wait till my write is finished physically
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UInt32 IOAddressRead32(UInt64 address) {
|
static inline UInt32 IOAddressRead32(Address address) {
|
||||||
UInt32 value = *(volatile UInt32*)address;
|
UInt32 value = *(volatile UInt32*)address;
|
||||||
__asm__ volatile ("dsb ld" ::: "memory"); // wait till my read is finished physically
|
__asm__ volatile ("dsb ld" ::: "memory"); // wait till my read is finished physically
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <Arch/Exceptions.h>
|
#include <Arch/Exceptions.h>
|
||||||
#include <Arch/CPU.h>
|
#include <Arch/CPU.h>
|
||||||
#include <IO/IOSerial.h>
|
#include <IO/Serial.h>
|
||||||
|
|
||||||
void ExceptionsHandler(ExceptionsContext* context, ExceptionsType type) {
|
void ExceptionsHandler(ExceptionsContext* context, ExceptionsType type) {
|
||||||
IOSerialPutString("Exception occurred");
|
IOSerialPutString("Exception occurred");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <IO/IOSerial.h>
|
#include <IO/Serial.h>
|
||||||
#include <Arch/IO.h>
|
#include <Arch/IO.h>
|
||||||
#include <Arch/CPU.h>
|
#include <Arch/CPU.h>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <IO/IOSerial.h>
|
#include <IO/Serial.h>
|
||||||
|
|
||||||
void KernelMain(void) {
|
void KernelMain(void) {
|
||||||
IOSerialPutString("Meow nya!!\n");
|
IOSerialPutString("Meow nya!!\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user