Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
cmake-build-debug
cmake-build-debug
.qemu.pid
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ practices while remaining approachable to contributors and learners alike.

### Foundation

- [ ] Serial output
- [x] Serial output
- [ ] Framebuffer abstraction + character output
- [ ] Panic functions + Assertion system
- [ ] Logging system (both visual + serial)
Expand Down
51 changes: 51 additions & 0 deletions include/core/regs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* regs.h
* As part of the Avery project
* Created by Max Van den Eynde in 2026
* --------------------------------------
* Description: Register functions
* Copyright (c) 2026 Max Van den Eynde
*/

#ifndef AVERY_REGS_H
#define AVERY_REGS_H

#include <types.h>

namespace regs {
inline u64 read_cr0() {
u64 val;
asm volatile(
"mov %%cr0, %0"
: "=r"(val)
);

return val;
}

inline void write_cr0(u64 val) {
asm volatile(
"mov %0, %%cr0" : : "r"(val) : "memory"
);
}

inline u64 read_cr4() {
u64 val;
asm volatile(
"mov %%cr4, %0"
: "=r"(val));

return val;
}

inline void write_cr4(u64 val) {
asm volatile(
"mov %0, %%cr4" : : "r"(val) : "memory"
);
}

void enableSSE();
}


#endif //AVERY_REGS_H
76 changes: 76 additions & 0 deletions include/graphics/framebuffer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* framebuffer.h
* As part of the Avery project
* Created by Max Van den Eynde in 2026
* --------------------------------------
* Description: Framebuffer features
* Copyright (c) 2026 Max Van den Eynde
*/

#ifndef AVERY_FRAMEBUFFER_H
#define AVERY_FRAMEBUFFER_H
#include "graphicsTypes.h"
#include "../types.h"

struct limine_framebuffer_request;
struct limine_framebuffer;

class Framebuffer {
public:
static Framebuffer createFromLimineRequest(volatile limine_framebuffer_request& request);

void setColor(Tuple<u64> position, Color color) const;
void paintRectangle(Tuple<u64> start, Tuple<u64> end, Color color) const;
void drawCharacter(Tuple<u64> pos, Color fg, Color bg, char c, float scaleBy = 1.0) const;
void copyRect(Tuple<u64> src, Tuple<u64> dst, Tuple<u64> size) const;

[[nodiscard]] Color getColor(Tuple<u64> pos) const;

[[nodiscard]] u64 width() const;
[[nodiscard]] u64 height() const;

private:
volatile u32* fb_ptr = nullptr;
limine_framebuffer* fb = nullptr;
};

class FramebufferConsole {
public:
FramebufferConsole(
const Framebuffer& framebuffer,
Color foreground,
Color background,
float scale = 1.0
);

void clear();
void putChar(char c);
void write(string str);
void writeLn(string str);
void newline();
void backspace();

void setColor(Color fg, Color bg);
void setCursor(u64 x, u64 y);

private:
void drawCursor();
void eraseCursor();
void scroll();
void drawCell(u64 pixelX, u64 y, char c);

const Framebuffer& framebuffer;

Color fg;
Color bg;

float scale;

u64 cursorX = 0;
u64 cursorY = 0;

u64 rows;
bool cursorVisible = true;
};

#endif //AVERY_FRAMEBUFFER_H
92 changes: 92 additions & 0 deletions include/graphics/graphicsTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* types.h
* As part of the Avery project
* Created by Max Van den Eynde in 2026
* --------------------------------------
* Description: ${FILE_DESCRIPTION}
* Copyright (c) 2026 Max Van den Eynde
*/

#ifndef AVERY_GRAPHICSTYPES_H
#define AVERY_GRAPHICSTYPES_H

struct Color {
int r; // from 0-255
int g;
int b;
int a;

constexpr Color() : r(0), g(0), b(0), a(255) {
}

constexpr Color(int r_, int g_, int b_, int a_ = 255) : r(r_), g(g_), b(b_), a(a_) {
}

static const Color red;
static const Color green;
static const Color blue;
static const Color yellow;
static const Color magenta;
static const Color cyan;
static const Color white;
static const Color black;
static const Color orange;
static const Color purple;
static const Color brown;
static const Color gray;
static const Color lightGray;
static const Color darkGray;
static const Color pink;
static const Color lime;
static const Color navy;
static const Color teal;
static const Color olive;
static const Color maroon;
static const Color silver;
static const Color gold;
static const Color skyBlue;
static const Color lavender;
static const Color coral;
static const Color beige;
static const Color mint;
static const Color ochre;
static const Color indigo;
static const Color sienna;
static const Color turquoise;
static const Color khaki;
};

inline const Color Color::red = Color(255, 0, 0, 255);
inline const Color Color::green = Color(0, 255, 0, 255);
inline const Color Color::blue = Color(0, 0, 255, 255);
inline const Color Color::yellow = Color(255, 255, 0, 255);
inline const Color Color::magenta = Color(255, 0, 255, 255);
inline const Color Color::cyan = Color(0, 255, 255, 255);
inline const Color Color::white = Color(255, 255, 255, 255);
inline const Color Color::black = Color(0, 0, 0, 255);
inline const Color Color::orange = Color(255, 165, 0, 255);
inline const Color Color::purple = Color(128, 0, 128, 255);
inline const Color Color::brown = Color(165, 42, 42, 255);
inline const Color Color::gray = Color(128, 128, 128, 255);
inline const Color Color::lightGray = Color(211, 211, 211, 255);
inline const Color Color::darkGray = Color(64, 64, 64, 255);
inline const Color Color::pink = Color(255, 192, 203, 255);
inline const Color Color::lime = Color(191, 255, 0, 255);
inline const Color Color::navy = Color(0, 0, 128, 255);
inline const Color Color::teal = Color(0, 128, 128, 255);
inline const Color Color::olive = Color(128, 128, 0, 255);
inline const Color Color::maroon = Color(128, 0, 0, 255);
inline const Color Color::silver = Color(192, 192, 192, 255);
inline const Color Color::gold = Color(255, 215, 0, 255);
inline const Color Color::skyBlue = Color(135, 206, 235, 255);
inline const Color Color::lavender = Color(230, 230, 250, 255);
inline const Color Color::coral = Color(255, 127, 80, 255);
inline const Color Color::beige = Color(245, 245, 220, 255);
inline const Color Color::mint = Color(189, 252, 201, 255);
inline const Color Color::ochre = Color(204, 119, 34, 255);
inline const Color Color::indigo = Color(75, 0, 130, 255);
inline const Color Color::sienna = Color(160, 82, 45, 255);
inline const Color Color::turquoise = Color(64, 224, 208, 255);
inline const Color Color::khaki = Color(240, 230, 140, 255);

#endif //AVERY_GRAPHICSTYPES_H
105 changes: 105 additions & 0 deletions include/graphics/vgaFont.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#pragma once
#include <stdint.h>

#define FONT_WIDTH 8
#define FONT_HEIGHT 16
#define FONT_FIRST 32
#define FONT_LAST 126

static const uint8_t font8x16[95][16] = {
/* 32 ' ' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 33 '!' */ { 0x00, 0x00, 0x60, 0xF0, 0xF0, 0xF0, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
/* 34 '"' */ { 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 35 '#' */ { 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 36 '$' */ { 0x00, 0x00, 0x18, 0x18, 0x7C, 0xC6, 0xC2, 0xC0, 0x7C, 0x06, 0x06, 0x86, 0xC6, 0x7C, 0x18, 0x18 },
/* 37 '%' */ { 0x00, 0x00, 0xC2, 0xC6, 0x0C, 0x18, 0x30, 0x60, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 38 '&' */ { 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 },
/* 39 '\'' */ { 0x00, 0x00, 0x60, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 40 '(' */ { 0x00, 0x00, 0x30, 0x60, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
/* 41 ')' */ { 0x00, 0x00, 0xC0, 0x60, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 },
/* 42 '*' */ { 0x00, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 43 '+' */ { 0x00, 0x00, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 44 ',' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0xC0, 0x00, 0x00 },
/* 45 '-' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 46 '.' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00 },
/* 47 '/' */ { 0x00, 0x00, 0x02, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 48 '0' */ { 0x00, 0x00, 0x3C, 0x66, 0xC3, 0xC3, 0xDB, 0xDB, 0xC3, 0xC3, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 },
/* 49 '1' */ { 0x00, 0x00, 0x30, 0x70, 0xF0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00 },
/* 50 '2' */ { 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00 },
/* 51 '3' */ { 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 52 '4' */ { 0x00, 0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00 },
/* 53 '5' */ { 0x00, 0x00, 0xFE, 0xC0, 0xC0, 0xC0, 0xFC, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 54 '6' */ { 0x00, 0x00, 0x38, 0x60, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 55 '7' */ { 0x00, 0x00, 0xFE, 0xC6, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
/* 56 '8' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 57 '9' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x0C, 0x78, 0x00, 0x00, 0x00, 0x00 },
/* 58 ':' */ { 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 59 ';' */ { 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 },
/* 60 '<' */ { 0x00, 0x00, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 61 '=' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 62 '>' */ { 0x00, 0x00, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 63 '?' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x0C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
/* 64 '@' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xDE, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 65 'A' */ { 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 },
/* 66 'B' */ { 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00 },
/* 67 'C' */ { 0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 },
/* 68 'D' */ { 0x00, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00 },
/* 69 'E' */ { 0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 },
/* 70 'F' */ { 0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 71 'G' */ { 0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xDE, 0xC6, 0xC6, 0x66, 0x3A, 0x00, 0x00, 0x00, 0x00 },
/* 72 'H' */ { 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 },
/* 73 'I' */ { 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 74 'J' */ { 0x00, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00 },
/* 75 'K' */ { 0x00, 0x00, 0xE6, 0x66, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 },
/* 76 'L' */ { 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 },
/* 77 'M' */ { 0x00, 0x00, 0xC3, 0xE7, 0xFF, 0xFF, 0xDB, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00 },
/* 78 'N' */ { 0x00, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 },
/* 79 'O' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 80 'P' */ { 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 81 'Q' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xDE, 0x7C, 0x0C, 0x0E, 0x00, 0x00 },
/* 82 'R' */ { 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 },
/* 83 'S' */ { 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x60, 0x38, 0x0C, 0x06, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 84 'T' */ { 0x00, 0x00, 0xFF, 0xDB, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 },
/* 85 'U' */ { 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 86 'V' */ { 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00 },
/* 87 'W' */ { 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xDB, 0xDB, 0xFF, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
/* 88 'X' */ { 0x00, 0x00, 0xC3, 0xC3, 0x66, 0x3C, 0x18, 0x18, 0x3C, 0x66, 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00 },
/* 89 'Y' */ { 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 },
/* 90 'Z' */ { 0x00, 0x00, 0xFF, 0xC3, 0x86, 0x0C, 0x18, 0x30, 0x60, 0xC1, 0xC3, 0xFF, 0x00, 0x00, 0x00, 0x00 },
/* 91 '[' */ { 0x00, 0x00, 0xF0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 92 '\\' */ { 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 93 ']' */ { 0x00, 0x00, 0xF0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 94 '^' */ { 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 95 '_' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00 },
/* 96 '`' */ { 0x00, 0x00, 0xC0, 0xC0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
/* 97 'a' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 },
/* 98 'b' */ { 0x00, 0x00, 0xE0, 0x60, 0x60, 0x78, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 99 'c' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 100 'd' */ { 0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x3C, 0x6C, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 },
/* 101 'e' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 102 'f' */ { 0x00, 0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 103 'g' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xCC, 0x78, 0x00 },
/* 104 'h' */ { 0x00, 0x00, 0xE0, 0x60, 0x60, 0x6C, 0x76, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 },
/* 105 'i' */ { 0x00, 0x00, 0x60, 0x60, 0x00, 0xE0, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 106 'j' */ { 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00 },
/* 107 'k' */ { 0x00, 0x00, 0xE0, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 },
/* 108 'l' */ { 0x00, 0x00, 0xE0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 109 'm' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0x00, 0x00, 0x00, 0x00 },
/* 110 'n' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
/* 111 'o' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 112 'p' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00 },
/* 113 'q' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00 },
/* 114 'r' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x76, 0x66, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 },
/* 115 's' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 },
/* 116 't' */ { 0x00, 0x00, 0x10, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00 },
/* 117 'u' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 },
/* 118 'v' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00 },
/* 119 'w' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xDB, 0xDB, 0xFF, 0x66, 0x00, 0x00, 0x00, 0x00 },
/* 120 'x' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0xC3, 0x00, 0x00, 0x00, 0x00 },
/* 121 'y' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00 },
/* 122 'z' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xCC, 0x18, 0x30, 0x60, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00 },
/* 123 '{' */ { 0x00, 0x00, 0x1C, 0x30, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x30, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00 },
/* 124 '|' */ { 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00 },
/* 125 '}' */ { 0x00, 0x00, 0xE0, 0x30, 0x30, 0x30, 0x1C, 0x30, 0x30, 0x30, 0x30, 0xE0, 0x00, 0x00, 0x00, 0x00 },
/* 126 '~' */ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
};
1 change: 0 additions & 1 deletion include/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ namespace io {
return val;
}
}

#endif //AVERY_IO_H
15 changes: 15 additions & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,20 @@ using i64 = long long;

using string = const char*;

template <typename T>
struct Tuple {
T a;
T b;

Tuple<T>(T a, T b) : a(a), b(b) {
}

T first() { return a; }
T second() { return b; }
};

template <typename T>
Tuple(T, T) -> Tuple<T>;


#endif //AVERY_TYPES_H
28 changes: 28 additions & 0 deletions kernel/core/regs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* regs.cpp
* As part of the Avery project
* Created by Max Van den Eynde in 2026
* --------------------------------------
* Description:
* Copyright (c) 2026 Max Van den Eynde
*/

#include <core/regs.h>

void regs::enableSSE() {
u64 cr0 = read_cr0();

cr0 &= ~(1ull << 2);
cr0 |= (1ull << 1);

write_cr0(cr0);

u64 cr4 = read_cr4();

cr4 |= (1ull << 9);
cr4 |= (1ull << 10);

write_cr4(cr4);

asm volatile("fninit");
}
Loading
Loading