Compare commits
65 Commits
33cb3dfa30
...
main
Author | SHA1 | Date | |
---|---|---|---|
44f5d687b0 | |||
1f5a358b19 | |||
e15f0af292 | |||
8e2017bd29 | |||
11125325ca | |||
81c54647d2 | |||
fc79a47957 | |||
6c8c158a1f | |||
65f08e3887 | |||
a14cc5df28 | |||
2e09db2dd1 | |||
5e561bfa15 | |||
8dd5373e7f | |||
3b798e5daa | |||
70739744ac | |||
1e981755de | |||
3766464c47 | |||
a9ed5947a8 | |||
db4ed04dd6 | |||
7b7cc86999 | |||
18486a6705 | |||
c9a92819b4 | |||
f75e121251 | |||
9c89433db5 | |||
69686a2c91 | |||
1ca8c68cf5 | |||
e60969b37a | |||
dbdf851dd2 | |||
d7626df19c | |||
95fec015f2 | |||
dc84d5856b | |||
19eea56a7e | |||
8c63eac00e | |||
d4db6acf61 | |||
540226fb0f | |||
2d6b24842e | |||
494a0f425c | |||
2ba4037af2 | |||
7ba3eead14 | |||
35b73e8004 | |||
4ec1a4962d | |||
24c7ea8b19 | |||
d2f7a3ce26 | |||
57ce3c792d | |||
d889a251ef | |||
b3be29246e | |||
2fe4ac5ad5 | |||
fa3ef311ad | |||
02c3d72a4b | |||
b9691b1948 | |||
916e8b6f19 | |||
bab3069152 | |||
61debdcb85 | |||
4028372475 | |||
6bdba0cb4f | |||
4a99b82e15 | |||
77928aca4b | |||
dda9c8a1ef | |||
3b0b090430 | |||
917ccf0465 | |||
2edc92bbcc | |||
5383c4eced | |||
903b303322 | |||
db596a9212 | |||
99e2d7053b |
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ obj
|
||||
.*
|
||||
compile_commands.json
|
||||
tags
|
||||
base_fonts
|
||||
*.log
|
||||
|
20
Makefile
20
Makefile
@ -1,9 +1,9 @@
|
||||
NAME := bozOS
|
||||
|
||||
AS := i386-elf-as
|
||||
ASFLAGS :=
|
||||
ASFLAGS := -g
|
||||
CC := i386-elf-gcc
|
||||
CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -fstack-protector-all -g
|
||||
CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -fstack-protector-all -g3
|
||||
LD := $(CC)
|
||||
LDFLAGS := -T boot/linker.ld -ffreestanding -nostdlib
|
||||
LIBS := -L libbozo/build/ -lbozo -lgcc
|
||||
@ -40,11 +40,21 @@ iso: $(NAME)
|
||||
grub-mkrescue -o build/$(NAME).iso --compress=xz --locales=en@quot --themes= isodir
|
||||
rm -rf isodir
|
||||
|
||||
fast-iso: $(NAME)
|
||||
mkdir -p isodir/boot/grub
|
||||
cp build/$(NAME).bin isodir/boot/$(NAME).bin
|
||||
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
||||
grub-mkrescue -o build/$(NAME).iso --themes= isodir
|
||||
rm -rf isodir
|
||||
|
||||
run-iso: iso
|
||||
qemu-system-i386 -cdrom build/$(NAME).iso -vga std
|
||||
|
||||
debug: iso
|
||||
qemu-system-i386 -s -S build/$(NAME).iso -vga std
|
||||
fast-run-iso: fast-iso
|
||||
qemu-system-i386 -cdrom build/$(NAME).iso -vga std
|
||||
|
||||
debug: fast-iso
|
||||
qemu-system-i386 -s -S -cdrom build/$(NAME).iso -vga std -D qemu.log -d in_asm,int -M smm=off
|
||||
|
||||
clean:
|
||||
make -C libbozo clean
|
||||
@ -59,5 +69,5 @@ re:
|
||||
$(MAKE) fclean
|
||||
$(MAKE) all
|
||||
|
||||
.PHONY: all clean fclean re run iso run-iso
|
||||
.PHONY: all clean fclean re run iso run-iso fast-iso fast-run-iso
|
||||
-include $(DEP)
|
||||
|
@ -1,9 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
// boolean types
|
||||
#include <stdbool.h>
|
||||
|
||||
// size_t, already in libft.h but for readability
|
||||
#include <stddef.h>
|
||||
|
||||
// Remove this and replace it with <assert.h> header
|
||||
@ -64,8 +61,8 @@ typedef struct Zone {
|
||||
* For TINY and SMALL, the zone will be divided in blocks.
|
||||
* For LARGE, it will be entire page(s).
|
||||
*/
|
||||
extern Zone *vzones[3];
|
||||
extern Zone *kzones[3];
|
||||
extern Zone *zones[3];
|
||||
|
||||
/*----------- UTILS ----------*/
|
||||
block_type_t get_type(size_t size);
|
||||
@ -74,17 +71,17 @@ size_t align_mem(size_t addr);
|
||||
/*----------------------------*/
|
||||
|
||||
/*-------- ALLOCATOR ---------*/
|
||||
int new_kzone(block_type_t type, size_t size);
|
||||
int new_vzone(block_type_t type, size_t size);
|
||||
int new_kzone(block_type_t type, size_t size);
|
||||
/*----------------------------*/
|
||||
|
||||
void *kmalloc(size_t size);
|
||||
void kfree(void *ptr);
|
||||
void *krealloc(void *ptr, size_t size);
|
||||
void *vmalloc(size_t size);
|
||||
void vfree(void *ptr);
|
||||
void *vrealloc(void *ptr, size_t size);
|
||||
void show_kalloc_mem(void);
|
||||
void show_valloc_mem(void);
|
||||
size_t ksize(void *virt_addr);
|
||||
size_t vsize(void *virt_addr);
|
||||
void *kmalloc(size_t size);
|
||||
void kfree(void *ptr);
|
||||
void *krealloc(void *ptr, size_t size);
|
||||
void show_kalloc_mem(void);
|
||||
size_t ksize(void *phys_addr);
|
||||
|
@ -10,3 +10,4 @@ void reboot_cmd(char* arg);
|
||||
void heap_cmd(char *arg);
|
||||
void clear_cmd(char *arg);
|
||||
void merdella_cmd(char *arg);
|
||||
void layout_cmd(char *arg);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRINT_PTR(X) kprintf("%s:%u %s: %p\n", __FILE__, __LINE__, #X, X)
|
||||
|
@ -6,4 +6,4 @@
|
||||
|
||||
void load_drivers(void);
|
||||
void keyboard_handler(struct registers *regs);
|
||||
void clock_handler(struct registers *regs);
|
||||
void clock_init(struct registers *regs);
|
||||
|
@ -5,5 +5,6 @@
|
||||
struct font {
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t yoffset;
|
||||
char *bitmap;
|
||||
};
|
||||
|
878
headers/fonts/consolas_regular_13.h
Normal file
878
headers/fonts/consolas_regular_13.h
Normal file
@ -0,0 +1,878 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "font.h"
|
||||
|
||||
struct font consolas_regular_13_font[] = {
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.yoffset = 12,
|
||||
.bitmap = " ",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = "## ## ## ## ## ## ## ## ## ## #########",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 5,
|
||||
.yoffset = 0,
|
||||
.bitmap = "##############################",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
" ## ## ## ## ## ## #################### ## ## ## "
|
||||
"## #################### ## ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 15,
|
||||
.yoffset = 0,
|
||||
.bitmap =
|
||||
" ### ## ##### ###### ## ## ## ## ##### ###### "
|
||||
" ##### ### ## ### ######### ###### ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ### ## ##### ### ## ## ## ## ## ## ######## ### "
|
||||
"## ## ###### ####### ## ## ## ### ## "
|
||||
"## ## ##### ## ### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = " #### ###### ## ## ## ## ###### "
|
||||
"#### #### ## ###### ## ## ##### ## #### ## "
|
||||
"#### ######## #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 5,
|
||||
.yoffset = 0,
|
||||
.bitmap = "###############",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = " # ### ## ## ## ## ## ## ## ## ## ## "
|
||||
" ## ## ### # ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = " # ### ## ## ## ## ## ## ## ## ## ## "
|
||||
" ## ## ### # ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 8,
|
||||
.yoffset = 0,
|
||||
.bitmap =
|
||||
" ## # ## # ######## ###### ###### ######## # ## # ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 8,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
" ## ## ## ################ ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 6,
|
||||
.yoffset = 10,
|
||||
.bitmap = " ### #### ### ####### ### ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 2,
|
||||
.yoffset = 7,
|
||||
.bitmap = "############",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 3,
|
||||
.yoffset = 10,
|
||||
.bitmap = " ## ########",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 15,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ## ## ### ## ### ## "
|
||||
"### ## ## ### ## ### ## "
|
||||
"### ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ###### ## ## ## ##### ###### ########## "
|
||||
"###### ##### ## ## ## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " ## #### ##### ## ## ## ## ## "
|
||||
"## ## ## ################",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ###### # ## ## ## ### ## "
|
||||
"### ### ### ################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "##### ####### ## ## ## ##### ##### ## "
|
||||
" ## ######## ##### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
" ### ### #### ##### ## ## ### ## ### "
|
||||
"## ## ## #################### ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "###### ###### ## ## ##### ###### ## ## "
|
||||
" ## ######### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ##### ## ## ###### ####### ## #### "
|
||||
" #### ##### ### ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "################ ### ## ### ## ### "
|
||||
"## ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ######### #### ##### ### ###### ###### ### "
|
||||
" ##### #### ######### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ###### ### ##### #### #### ## ####### "
|
||||
"###### ## ## ##### #### ",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = "######### #########",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 12,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
" ### ### ### ### #### ### ####### ### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 10,
|
||||
.yoffset = 3,
|
||||
.bitmap = " # ### ### #### #### #### #### ### "
|
||||
"### # ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 5,
|
||||
.yoffset = 6,
|
||||
.bitmap = "################ ################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 10,
|
||||
.yoffset = 3,
|
||||
.bitmap = " # ### ### #### #### #### #### ### ### "
|
||||
" # ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = "### ##### ### ## ## ##### #### ## ## ## "
|
||||
" ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap =
|
||||
" #### ####### ## ## ## ## ## ##################### "
|
||||
"######## ######## ######## ############## ## ###### ## "
|
||||
"## ## ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " ### #### #### ###### ## ## "
|
||||
" ## ## ### ### ######## ######## ### ### "
|
||||
" ## ## ### ###",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "###### ########## #### #### ########## ####### ## "
|
||||
" #### #### ######### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ###### ## ### ## ## ## ## "
|
||||
" ## ## # ####### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "##### ####### ## ## ## #### #### #### #### "
|
||||
" #### ##### ## ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "################ ## ## ################ ## "
|
||||
" ## ##############",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "################ ## ## ################ ## "
|
||||
" ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ###### ## #### ## ## ###### ###### "
|
||||
" #### ## ## ## ####### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "## #### #### #### #### #################### "
|
||||
" #### #### #### #### ##",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "################ ## ## ## ## ## "
|
||||
"## ## ## ################",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "############ ## ## ## ## ## ## ### "
|
||||
"####### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
"## ### ## ### ## ### ## ### ##### #### #### "
|
||||
" ##### ## ### ## ### ## ### ## ### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "## ## ## ## ## ## ## ## ## "
|
||||
" ## ##############",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "### ####### ######## ######## "
|
||||
"############################## ###### ## ###### ###### "
|
||||
" ###### ###### ###",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "### ##### ###### ###### ###### #### ## #### ## #### "
|
||||
"###### ###### ###### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
" #### ######## ## ## ### #### #### #### "
|
||||
" #### #### ### ## ## ######## #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "###### ####### ## ##### #### #### ########## "
|
||||
"###### ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 15,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ####### ## ## ## #### #### #### "
|
||||
" #### #### ## ## ## ####### ##### ## # "
|
||||
" ##### ### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "##### ####### ## ## ## ## ## ## ###### ##### ## "
|
||||
"### ## ### ## ### ## ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " #### ###### ## # ## ### ##### ##### "
|
||||
" ### #### ######### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "################ ## ## ## ## ## "
|
||||
"## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "## #### #### #### #### #### #### #### "
|
||||
" #### #### ### ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "### ### ### ## ### ### ## ## ### ### "
|
||||
" ### ### ## ## ###### ###### #### "
|
||||
" #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
" ## # ## ## ## ## ## ## ## ## ## ## ## ## "
|
||||
"######## ######## ######## ######## ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
"### ### ## ## ### ### ###### #### #### "
|
||||
"#### #### ###### ### ### ### ### ### ###",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
"## ##### ### ## ## ## ## ###### #### "
|
||||
"#### ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = "################ ## ### ## ### ### "
|
||||
"### ### ## ################",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = "############ ## ## ## ## ## ## ## ## ## "
|
||||
"## ## ##########",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 15,
|
||||
.yoffset = 0,
|
||||
.bitmap = "## ### ## ### ## ### ## "
|
||||
" ## ### ## ### ## ### "
|
||||
" ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = "########## ## ## ## ## ## ## ## ## ## "
|
||||
"## ## ############",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 6,
|
||||
.yoffset = 1,
|
||||
.bitmap =
|
||||
" ## #### ###### ## ## ## ## ### ###",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 2,
|
||||
.yoffset = 14,
|
||||
.bitmap = "####################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 5,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ### ### ## ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
" #### ###### # ## ############## #### ########## ######",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = "## ## ## ## ###### ####### ### #### "
|
||||
" #### #### #### ########## ##### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
" #### ######### ### ## ## ### # ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ## ## ## ## ###### ########## #### "
|
||||
" #### #### #### ### ####### ### ##",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = " #### ###### ### #################### ### "
|
||||
"####### ######",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap =
|
||||
" #### ##### ## ## ## ####### ####### "
|
||||
"## ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 4,
|
||||
.bitmap = " ################ ## ## ## ####### ###### ## "
|
||||
"####### ########## ########## ##### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = "## ## ## ## ###### ########## #### #### "
|
||||
" #### #### #### #### ##",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ### ### ### ##### ##### ## "
|
||||
"## ## ## ## ################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ### ### ### ############## ## ## "
|
||||
" ## ## ## ## ### ######## #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = "## ## ## ## ## ### ## ### ##### "
|
||||
" #### #### ##### ## ### ## ### ## ### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.yoffset = 0,
|
||||
.bitmap = "##### ##### ## ## ## ## ## "
|
||||
"## ## ## ## ################",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = "#### ## ################## ## #### ## #### ## #### ## #### "
|
||||
"## #### ## ##",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
"###### ########## #### #### #### #### #### #### ##",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = " #### ###### ### ##### #### #### ##### ### "
|
||||
"###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 4,
|
||||
.bitmap = "###### ####### ### #### #### #### #### "
|
||||
"########## ###### ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.yoffset = 4,
|
||||
.bitmap = " ###### ########## #### #### #### #### ### "
|
||||
"####### ###### ## ## ##",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
"###### ########## #### #### ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
" ##### ###### ## #### ##### #### ############### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 12,
|
||||
.yoffset = 1,
|
||||
.bitmap = " # ## ## ################## ## ## "
|
||||
" ## ## ## ###### #####",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
"## #### #### #### #### #### #### ########## ######",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = "### ### ## ## ### ### ## ## ## ## ###### "
|
||||
" #### #### ## ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = "### ### ## ## ## ## ## ## ## ## ######## ######## "
|
||||
" ######## ### #### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap = " ### ### ### ### ### ### ##### #### "
|
||||
"#### ###### ###### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
"### ### ### ## ### ### ## ## ###### ##### "
|
||||
"#### ### ## ### ##### #### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.yoffset = 4,
|
||||
.bitmap =
|
||||
"############## ## ## ### ## ### ##############",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = " ### #### ## ## ## ## ## ### "
|
||||
"#### ## ## ## ## ## ##### ####",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 18,
|
||||
.yoffset = -2,
|
||||
.bitmap = "####################################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 16,
|
||||
.yoffset = 0,
|
||||
.bitmap = "### #### ## ## ## ## ## ### "
|
||||
"#### ## ## ## ## ## ##### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 4,
|
||||
.yoffset = 6,
|
||||
.bitmap = " ### ######## #### ######## #### ",
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
};
|
770
headers/fonts/eating_pasta_regular_13.h
Normal file
770
headers/fonts/eating_pasta_regular_13.h
Normal file
@ -0,0 +1,770 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "font.h"
|
||||
|
||||
struct font eating_pasta_regular_13_font[] = {
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.bitmap = " ",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 13,
|
||||
.bitmap = "####### ### ### ### ### ### ### ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 5,
|
||||
.bitmap = " ## ##### ##### ## ## ## # ",
|
||||
},
|
||||
{
|
||||
.width = 13,
|
||||
.height = 12,
|
||||
.bitmap = " ### ### #### #### #### #### "
|
||||
"############ ############ #### #### ############ "
|
||||
"############ ### ### ### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 15,
|
||||
.bitmap = " # #### ###### ####### #### #### #### "
|
||||
" ####### ###### # ### # ### ######## ####### "
|
||||
"####### # ",
|
||||
},
|
||||
{
|
||||
.width = 16,
|
||||
.height = 13,
|
||||
.bitmap = " #### ### ##### #### ### ## ### ### ## #### "
|
||||
" ##### ### ### #### #### ### ###### "
|
||||
"### ## ## #### ## ## ### ## ### #### ##### "
|
||||
" #### #### ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = " #### ###### ### ## ### ### ###### "
|
||||
"##### ### #### ### ######## ######## ### #### "
|
||||
"######### ##### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 5,
|
||||
.bitmap = " ######## ## # ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 15,
|
||||
.bitmap = " # ### #### ### #### ### ### ### ### ### ### ### "
|
||||
"#### #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 16,
|
||||
.bitmap = " ## #### ### #### ### ### #### #### #### "
|
||||
"#### ### ### #### #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 6,
|
||||
.bitmap = " # # # # ##### ##### ##### # ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 9,
|
||||
.bitmap = " ### ### ### ######################## ### "
|
||||
"### ## ",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 5,
|
||||
.bitmap = " ## ### ### ### ## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 3,
|
||||
.bitmap = "########################",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 4,
|
||||
.bitmap = " ## ####### ###",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 14,
|
||||
.bitmap = " ### ### ### ### ### ### ### ### "
|
||||
"#### ### ### #### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### ###### ######## ### ### ### ### ## ### ## "
|
||||
"## ### ## ### ### ### ### ######## ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 13,
|
||||
.bitmap = " ### #### ################# ### ### ### ### "
|
||||
"### ### ### ###",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ###### ######## ### #### ### #### "
|
||||
"### #### #### #### ####### ##################",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = " #### ####### ######## # ### ## #### "
|
||||
" #### # ### ### ## ### ######## ######## "
|
||||
" ##### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" #### ##### ##### ###### ### ### ####### ### "
|
||||
"#### ############################# # #### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 14,
|
||||
.bitmap = " ##### ####### ####### ### ### ###### ####### "
|
||||
"######## #### #### ########### ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### #### ### #### ###### ######## ### "
|
||||
"####### ### ### ### ### ### ######## ###### ## ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 13,
|
||||
.bitmap = "############## ###### ### #### ### ### #### "
|
||||
"### ### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = " ##### ####### ######## ### ### ### ## ####### "
|
||||
" ###### ######## ### ## ### #### ######## ######## "
|
||||
" ###### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" #### ####### ######## ## ###### ###### ### ######## "
|
||||
"######## ###### ### #### #### ## ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 10,
|
||||
.bitmap = " ### #### #### ### ## ### #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 12,
|
||||
.bitmap =
|
||||
" # ### #### ### ## ## ### ### ## ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.bitmap =
|
||||
" # ### #### ##### ### ###### ##### ### ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 7,
|
||||
.bitmap = " #### ###### ###### ###### ###### ######",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 9,
|
||||
.bitmap =
|
||||
" # ### #### ##### ### ###### ##### ### # ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.bitmap = " #### ###### ###### ### ###### ## ### ##### "
|
||||
"#### ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 14,
|
||||
.height = 14,
|
||||
.bitmap = " ###### ######## ########## #### ### "
|
||||
"### ######### ######### ### ## ### # #### ## ### ##### "
|
||||
"############ ### ### ### #### ######### "
|
||||
"######## ####### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 12,
|
||||
.bitmap = " ##### ##### ###### ## ### ### ### "
|
||||
"### ### ### ## ######### ######### ### ### ### "
|
||||
"####### ####",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 12,
|
||||
.bitmap = "####### ######## ### ####### ############ ####### "
|
||||
"######## ### ### ### #################### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### ###### #### ### ### ### ### #### #### "
|
||||
" #### ### ## ### ### ######## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 12,
|
||||
.bitmap = "##### ####### ####### ### #### ## ### ### ## ### "
|
||||
"###### ####### #### ####### ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"######## ######## ######## ### ### #### ####### "
|
||||
"###### ### ### ######## ######## ######## ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.bitmap = "########################### ### ####### ####### "
|
||||
"####### ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ###### ######## ### ### ### #### #### "
|
||||
" #### #### ### #### ### ## ######## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = "### ###### ###### ###### ###### "
|
||||
"##################################### ####### ####### "
|
||||
"####### ####### ####",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 12,
|
||||
.bitmap = "####################################",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ### ### ### ### "
|
||||
"###### ###### ######## ### ######## ####### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = "### ### ### ### ### ### ### ### #### ####### "
|
||||
"###### ###### ####### ### #### ### #### ### ### "
|
||||
"### # ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ### ### ### ### ### "
|
||||
"### ### ### ####### ####### #######",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## #### #### ##### #### ##### ##### ##### "
|
||||
"##### ########### ########### ### ### ### ### ### ### ### "
|
||||
"# ### ### ### ### ### ### ###",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = "#### ####### ######## ######## ######## ######### "
|
||||
"###### ## ###### ######### ######### ######## ######## "
|
||||
"####### ####",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ##### ####### ######### ### #### ### ###### ###### "
|
||||
" ###### ### ### ### ### #### ######## ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.bitmap = "### ###### ####### ### ###### ###### ###### "
|
||||
"########### ###### #### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 15,
|
||||
.bitmap = " ##### ####### ######### ### #### ### ###### "
|
||||
"###### ###### ####### ##### ### ##### ######## "
|
||||
"####### ####### ## # ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = "### ###### ####### ### ### ### ### ### ### ### "
|
||||
"#### ####### ###### ###### ### ### ### ####### # ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ##### ###### ####### #### #### #### ####### "
|
||||
" ##### #### ### ######## ####### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.bitmap = "################ ### ### ### ### ### "
|
||||
"### ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ### ### ### ### ### ### ## ### ## ### ## ### ### "
|
||||
" ### ### ### ### ### ### ### ######## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"### ###### ### ### #### ### ### ### ### ### ### ### "
|
||||
"### ###### ###### ###### ###### ##### #### ",
|
||||
},
|
||||
{
|
||||
.width = 14,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"### #### ###### #### ####### #### ### ### #### ### ### "
|
||||
"##### ### ############ ############ ###### ##### ##### ##### "
|
||||
"##### ##### #### #### #### #### #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = " ### ## #### #### ######## ###### ###### #### "
|
||||
" #### ##### ###### ####### ### #### #### ### "
|
||||
"### ####",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "#### ####### ### #### #### #### ### ####### "
|
||||
"##### #### ### ### ### ### "
|
||||
" ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.bitmap = " ####### ####### ## #### ### ### ### ### "
|
||||
"### ### ### ###### ################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 16,
|
||||
.bitmap = " ####################### ### ### ### ### ### "
|
||||
" ### ### ### #### ############## ######",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 14,
|
||||
.bitmap = "### ### #### ### ### #### ### ### "
|
||||
"#### ### ### ### #### ###",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 16,
|
||||
.bitmap = "###### ############## #### ### ### ### ### "
|
||||
"### ### ### ### ################# ###### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 7,
|
||||
.bitmap = " ### #### #### ##### ###### ## ### ### ###",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 3,
|
||||
.bitmap = "###########################",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 3,
|
||||
.bitmap = " ## ### # ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 12,
|
||||
.bitmap = " #### ##### ###### ## ### ### ### "
|
||||
"### ### ### ### ######### ######### ### ### #### "
|
||||
"####### ###",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 12,
|
||||
.bitmap = "###### ######## ### ####### ############ ####### "
|
||||
"######## ### ### ### #################### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### ###### #### ### ### ### ### #### #### "
|
||||
" #### #### ## ### ### ######## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 12,
|
||||
.bitmap =
|
||||
" ##### ###### ####### ## #### ## ### ## ## ## "
|
||||
" ### ### ### ### #### ####### ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ######## ######## ######## ### ### #### ###### "
|
||||
"###### ### ### ######## ######## ########",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.bitmap = "####################### ### ### ####### ####### "
|
||||
"####### ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ###### ######## ### ### ### #### #### "
|
||||
" #### ######## #### ### ### ######## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = "### ###### ###### ####### ####### "
|
||||
"##################################### ####### ####### "
|
||||
"####### ####### ####",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 12,
|
||||
.bitmap = "####################################",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ### ### ### ### "
|
||||
"###### ###### ######## ############ ####### #### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ### ### ### ### ### ### #### "
|
||||
"####### ###### ###### ####### ### #### ### "
|
||||
"#### ### #### ### # ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ### ### ### ### ### "
|
||||
"### ### ### ####### ####### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## #### #### ##### #### ##### ##### ##### "
|
||||
"##### ########### ########### ### ### ### ### ### ### ### "
|
||||
"# ### ### ### ### ### ### ###",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = "#### ####### ####### ######## ######## ######### "
|
||||
"###### ## ## ### ##### ### ##### ### #### ### #### ### "
|
||||
"### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ##### ####### ######### ### #### ### ###### ###### "
|
||||
" ###### ####### ### ### #### ######## ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ###### ####### ### ### ### ### ### ### ### "
|
||||
"#### ####### ###### #### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 15,
|
||||
.bitmap = " ##### ####### ######### ### #### ### ###### "
|
||||
"###### ###### ####### ##### ### ##### ######## "
|
||||
"####### ####### ### # ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ### ###### ####### ### ### ### ### ### ### ### "
|
||||
"#### ####### ###### ###### ### ### ### #### ### # ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ##### ###### ####### #### #### #### ####### "
|
||||
" ##### #### ### ######## ####### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 12,
|
||||
.bitmap = "################ ### ### ### ### ### "
|
||||
"### ### ### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ### ### ### ### ## ###### ###### ###### ### ## "
|
||||
" ### ### ### ### ### ### ### ######## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"### ####### ### ### #### ### ### ### ### ### ### ### "
|
||||
"### ###### ###### ###### ###### ##### #### ",
|
||||
},
|
||||
{
|
||||
.width = 14,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"### #### ###### #### ###### #### ### ### #### ### ### "
|
||||
"######### ############ ############ ##### ##### ##### ##### "
|
||||
"##### ##### #### #### #### #### #### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = " ### ## #### #### ######## ###### ###### #### "
|
||||
" #### ##### ###### ####### ### #### #### ### "
|
||||
"### ####",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "#### ####### ### #### #### ### ### ####### "
|
||||
"##### ##### ### ### ### ### "
|
||||
" ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 8,
|
||||
.height = 13,
|
||||
.bitmap = " ####### ####### ## #### ### ### ### ### "
|
||||
"### ### ### ###### ################",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 17,
|
||||
.bitmap = " # ### #### #### ### ### ### ### #### ### "
|
||||
" #### #### #### #### #### #### # ",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 17,
|
||||
.bitmap = " ###########################################################"
|
||||
"########",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 17,
|
||||
.bitmap = " ## ### ##### #### ### ### ### #### ### "
|
||||
"#### ### ### ### #### ##### ### ## ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 5,
|
||||
.bitmap = " ## #### # ########## ######### #### ",
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
};
|
File diff suppressed because it is too large
Load Diff
765
headers/fonts/minecraft_medium_13.h
Normal file
765
headers/fonts/minecraft_medium_13.h
Normal file
@ -0,0 +1,765 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "font.h"
|
||||
|
||||
struct font minecraft_medium_13_font[] = {
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
{
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.bitmap = " ",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 13,
|
||||
.bitmap = "#################### ####",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 7,
|
||||
.bitmap =
|
||||
" ## ### ## ### ## ### ## ############## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = " ## ### ## ### ## ### "
|
||||
"################################# ## ### ## ### "
|
||||
"###################### ## ### ## ### ## ### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 15,
|
||||
.bitmap = " ## ## ####### ################## ## "
|
||||
" ## ## ## ## ################## "
|
||||
" ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 13,
|
||||
.height = 13,
|
||||
.bitmap = " ## # # # # # # # # # ## # # "
|
||||
"## # # ## ## ## # ## # # # "
|
||||
" # # # # # # # # # # ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## ## ### ## ### ######### "
|
||||
"#### ### #### ##### ### ## ### ## ### ## "
|
||||
"### #### ### #### ###",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 5,
|
||||
.bitmap = "##########",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 13,
|
||||
.bitmap = " #### ###### ## ## ## ## ## ## ## "
|
||||
"## #### ####",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 13,
|
||||
.bitmap = "#### #### ## ## ## ## ## ## ## "
|
||||
"## ###### #### ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 7,
|
||||
.bitmap = "## #### ## #### #### ######## #### ##",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 9,
|
||||
.bitmap = " ## ## ## ## ################## ## "
|
||||
" ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 4,
|
||||
.bitmap = "#### ## ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 2,
|
||||
.bitmap = "##########",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 2,
|
||||
.bitmap = "####",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## # # # # # "
|
||||
" # # # # # # ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### #### ## ##### ###### ###### ###### ## "
|
||||
"##### ## ###### ###### ##### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## #### #### #### ## ## ## ## ## "
|
||||
" ## ############",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### #### ## ##### ##### ##### ## "
|
||||
"## ## ## ## ## ##################",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### #### ## ##### ##### ### ### "
|
||||
"## ## ##### ##### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ### ### ##### ##### ####### ## ### ## "
|
||||
"### ## ### ## ### #################### ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "######### ######### ## ## ## ## "
|
||||
" ## ####### ####### # #### "
|
||||
"### ######## ######## ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" ##### ##### ## ## #### ## ## "
|
||||
" ####### ####### ## ##### ### ##### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = "#################### ##### ##### ##### ## "
|
||||
"## ## ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
" #### #### ## ##### ##### ##### ### #### "
|
||||
"#### ## ##### ##### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### #### ## ##### ##### ##### ##### "
|
||||
"### ####### ####### ### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 10,
|
||||
.bitmap = "###### ####",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 12,
|
||||
.bitmap = "###### #### ## ",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 9,
|
||||
.bitmap = " ## ## #### ## ## ## ## ## ##",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 7,
|
||||
.bitmap =
|
||||
"########################### ##################",
|
||||
},
|
||||
{
|
||||
.width = 6,
|
||||
.height = 9,
|
||||
.bitmap = "## ## #### ## ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " #### #### ## ##### ##### ### ### "
|
||||
"## ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 15,
|
||||
.height = 16,
|
||||
.bitmap =
|
||||
" ########### ############# ## #### #### "
|
||||
"###### #### ###### #### ###### #### ## ## #### ## "
|
||||
"## #### ## ## #### ## ## #### ############# ######### "
|
||||
"## ## ############# ########### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = " ##### ##### ## ##### "
|
||||
"################################### ##### ##### "
|
||||
"##### ##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "######### ######### ## ##### ##### ##### "
|
||||
" ############ ######### ## ##### ##### "
|
||||
"############ ######### ",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 13,
|
||||
.bitmap = " ######### ######### ## #### #### "
|
||||
"#### ## ## ## ## "
|
||||
"#### ## ######### ######### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "######### ######### ## ##### ##### ##### "
|
||||
" ##### ##### ##### ##### ##### "
|
||||
"############ ######### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "######################## ## ##### "
|
||||
"##### ##### ## ## ## ## "
|
||||
" ######################",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = "###################### ## ###### ###### "
|
||||
"###### ## ## ## ## ## "
|
||||
"## ",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 13,
|
||||
.bitmap = " ########## ############ ## ## "
|
||||
"####### ####### ####### #### #### "
|
||||
" #### ## ######## ######## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ##### ##### ##### ##### ##### "
|
||||
" ########################### ##### ##### "
|
||||
"##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 13,
|
||||
.bitmap = "######## ## ## ## ## ## ## ## ## ## ########",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## ## ## ## ## ## ## "
|
||||
" #### #### ## ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"## ## ##### ##### ## ## ## ## ## ##### "
|
||||
" ##### ## ## ## ## ## ##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"## ## ## ## ## ## ## "
|
||||
" ## ## ## ## ####################",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ##### ####### ######### ################## "
|
||||
"## ##### ## ##### ##### ##### ##### "
|
||||
"##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ####### ####### ##### ## ##### ## ##### "
|
||||
"## ##### ####### ####### ##### ##### "
|
||||
"##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 13,
|
||||
.height = 13,
|
||||
.bitmap = " ######### ######### ## #### #### "
|
||||
" #### #### #### #### #### "
|
||||
" #### ## ######### ######### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "######### ######### ## ##### "
|
||||
"####################### ######### ## ## "
|
||||
"## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 13,
|
||||
.height = 13,
|
||||
.bitmap = " ######### ######### ## #### #### "
|
||||
" #### #### #### #### #### "
|
||||
" #### ### ## ######### ###########",
|
||||
},
|
||||
{
|
||||
.width = 13,
|
||||
.height = 13,
|
||||
.bitmap = "########## ########## ## ## ## ## "
|
||||
"############ ########## ########## ## ### ## "
|
||||
"### ## ### ## ### ## #### ##",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap = " ######## ########## ## ####### ##### "
|
||||
" ##### ### ### ### ########## "
|
||||
"####### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "###################### ## ## ## "
|
||||
"## ## ## ## ## ## "
|
||||
" ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"## ##### ##### ##### ##### ##### ##### "
|
||||
" ##### ##### ##### ##### ### ###### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ##### ##### ##### ##### ##### "
|
||||
" ### ## ### ## ### ## ### ## ## "
|
||||
" ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ##### ##### ##### ##### ##### "
|
||||
" ##### ##### ## ##### ## ####### ######### "
|
||||
"####### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ##### ### ## ### ## ### ####### "
|
||||
"## ## ## ### ## ### ## ##### "
|
||||
"##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ##### ### ## ### ## ### ####### "
|
||||
"## ## ## ## ## ## "
|
||||
" ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "###################### ### ### ##### "
|
||||
" ### ### ## ## ## ## "
|
||||
" ######################",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 16,
|
||||
.bitmap =
|
||||
"########## ## ## ## ## ## ## ## ## ## ## ## ########",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = "# # # # # # # "
|
||||
" # # # # # ##",
|
||||
},
|
||||
{
|
||||
.width = 4,
|
||||
.height = 16,
|
||||
.bitmap =
|
||||
"######## ## ## ## ## ## ## ## ## ## ## ## ##########",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 7,
|
||||
.bitmap =
|
||||
" ## ## ## ## ## ## ### ##### ### ##",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 1,
|
||||
.bitmap = "##########",
|
||||
},
|
||||
{
|
||||
.width = 3,
|
||||
.height = 3,
|
||||
.bitmap = "# # #",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 10,
|
||||
.bitmap = "####### ####### ####### ### ######## "
|
||||
"########## ##### ### ######## ########",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 13,
|
||||
.bitmap = "## ## ## ## ## ##### ## "
|
||||
"##### ## ##### #### ####### ##### ##### "
|
||||
"############ ######### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 10,
|
||||
.bitmap = " ##### ##### ##### ## ##### ##### "
|
||||
"## ##### ### ##### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ### ####### ####### ######### "
|
||||
"##### ##### ##### ##### #####################",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 10,
|
||||
.bitmap = " ####### ####### ######### ################## ## "
|
||||
" ## ### ####### #######",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ##### ##### ## ########################### ## "
|
||||
" ## ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 14,
|
||||
.bitmap =
|
||||
" ####### ####### ######### ##### ### ####### ####### "
|
||||
" ### ### ##### ##### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = "## ## ## ## ## ## ## ## ## "
|
||||
"## #### ####### ##### ##### ##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 13,
|
||||
.bitmap = "#### ####################",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 13,
|
||||
.bitmap = " ## ## ## ## ## ## ## "
|
||||
" #### #### ## ### ### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = "## ## ## ##### ##### ####### ## ## "
|
||||
"## #### #### ## ## ## ## ## ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 13,
|
||||
.bitmap = "##########################",
|
||||
},
|
||||
{
|
||||
.width = 15,
|
||||
.height = 10,
|
||||
.bitmap = "###### ##### ###### ##### ###### ##### ## ### "
|
||||
"#### ### #### ### #### ### #### ### "
|
||||
"#### ### #### ### ##",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 10,
|
||||
.bitmap = "####### ####### ####### ## ##### ##### "
|
||||
"##### ##### ##### ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 10,
|
||||
.bitmap = " #### #### #### ## ##### ##### ##### "
|
||||
"##### ### #### #### ",
|
||||
},
|
||||
{
|
||||
.width = 10,
|
||||
.height = 13,
|
||||
.bitmap =
|
||||
"## ### ## ### ## ### #### ####### ##### ##### "
|
||||
" ########## ####### ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 13,
|
||||
.bitmap = " ### ### ####### ######### ###### ##### ##### "
|
||||
"##### ### ####### ####### ### ### ###",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 10,
|
||||
.bitmap = "## ### ################# ### ## ## ## ## "
|
||||
" ## ",
|
||||
},
|
||||
{
|
||||
.width = 7,
|
||||
.height = 11,
|
||||
.bitmap = " ##### ############## ## ### ### ## "
|
||||
" ####### ##### ",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 12,
|
||||
.bitmap =
|
||||
" ## ## #### #### #### ## ## ## ## ## ## ##",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 10,
|
||||
.bitmap = "## ##### ##### ##### ##### ##### ##### "
|
||||
"##### ### ####### #######",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 7,
|
||||
.bitmap = "## ##### ##### ### ## ### ## ### "
|
||||
"## ## ",
|
||||
},
|
||||
{
|
||||
.width = 12,
|
||||
.height = 9,
|
||||
.bitmap = "## #### #### #### #### ## "
|
||||
"#### ## #### ## ## ########## ##########",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 11,
|
||||
.bitmap =
|
||||
"## ##### ####### ##### ## ### ## ### ## "
|
||||
" ## ## ### ## ### ## ##### ###",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 12,
|
||||
.bitmap = "## ##### ##### ##### ##### ##### ### "
|
||||
"####### ####### ### ######### ###### ",
|
||||
},
|
||||
{
|
||||
.width = 9,
|
||||
.height = 11,
|
||||
.bitmap = "########################### ## ## ## ## "
|
||||
" ## ## ##################",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 17,
|
||||
.bitmap = " ## ## ## ## ## ## ## ## ## ## ## ## "
|
||||
" ## ## ## ## ##",
|
||||
},
|
||||
{
|
||||
.width = 2,
|
||||
.height = 17,
|
||||
.bitmap = "##################################",
|
||||
},
|
||||
{
|
||||
.width = 5,
|
||||
.height = 17,
|
||||
.bitmap = "## ## ## ## ## ## ## ## ## ## ## ## "
|
||||
" ## ## ## ## ## ",
|
||||
},
|
||||
{
|
||||
.width = 11,
|
||||
.height = 2,
|
||||
.bitmap = " ### ##### #### ",
|
||||
},
|
||||
{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.bitmap = NULL,
|
||||
},
|
||||
};
|
@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "tss.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define GDT_ADDRESS 0xC0105040
|
||||
#define GDT_SIZE 7
|
||||
#define GDT_SIZE 8
|
||||
|
||||
// https://wiki.osdev.org/Global_Descriptor_Table#GDTR
|
||||
struct gdt_descriptor {
|
||||
@ -11,6 +12,8 @@ struct gdt_descriptor {
|
||||
uint32_t base;
|
||||
} __attribute__((packed));
|
||||
|
||||
extern struct tss TSS;
|
||||
|
||||
void init_gdt();
|
||||
|
||||
#define GDT_FLAG_64BIT_MODE 0b0010
|
||||
@ -39,3 +42,4 @@ extern uint8_t gdt_entries[GDT_SIZE * 8];
|
||||
#define GDT_OFFSET_USER_CODE 0x20
|
||||
#define GDT_OFFSET_USER_DATA 0x28
|
||||
#define GDT_OFFSET_USER_STACK 0x30
|
||||
#define GDT_OFFSET_TSS 0x38
|
||||
|
57865
headers/icons/image.h
57865
headers/icons/image.h
File diff suppressed because one or more lines are too long
@ -18,3 +18,14 @@ typedef void (*isr_t)(struct registers *);
|
||||
void isr_handler(struct registers *regs);
|
||||
void pic_send_eoi(uint8_t irq);
|
||||
void register_interrupt_handler(int index, isr_t handler);
|
||||
|
||||
static inline void cli(void)
|
||||
{
|
||||
__asm__ volatile("cli");
|
||||
}
|
||||
|
||||
// aka sti
|
||||
static inline void toris(void)
|
||||
{
|
||||
__asm__ volatile("sti");
|
||||
}
|
||||
|
@ -3,7 +3,35 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
[[__maybe_unused__]] static const char *keymap[128] = {
|
||||
[[__maybe_unused__]] static const char *azerty_keymap[128] = {
|
||||
[2] = "&1", [3] = "é2", [4] = "\"3", [5] = "'4", [6] = "(5",
|
||||
[7] = "-6", [8] = "è7", [9] = "_8", [10] = "ç9", [11] = "à0",
|
||||
[12] = ")°", [13] = "=+", [14] = NULL, [15] = NULL, [16] = "aA",
|
||||
[17] = "zZ", [18] = "eE", [19] = "rR", [20] = "tT", [21] = "yY",
|
||||
[22] = "uU", [23] = "iI", [24] = "oO", [25] = "pP", [26] = "^¨",
|
||||
[27] = "$£", [28] = "\n\n", [30] = "qQ", [31] = "sS", [32] = "dD",
|
||||
[33] = "fF", [34] = "gG", [35] = "hH", [36] = "jJ", [37] = "kK",
|
||||
[38] = "lL", [39] = "mM", [40] = "ù%", [41] = NULL, [42] = NULL,
|
||||
[43] = "*µ", [44] = "wW", [45] = "xX", [46] = "cC", [47] = "vV",
|
||||
[48] = "bB", [49] = "nN", [50] = ",?", [51] = ";.", [52] = ":/",
|
||||
[53] = "!§", [54] = NULL, [55] = NULL, [56] = NULL, [57] = " ",
|
||||
[58] = NULL, [59] = NULL, [60] = NULL, [61] = NULL, [62] = NULL,
|
||||
[63] = NULL, [64] = NULL, [65] = NULL, [66] = NULL, [67] = NULL,
|
||||
[68] = NULL, [69] = NULL, [70] = NULL, [71] = NULL, [72] = NULL,
|
||||
[73] = NULL, [74] = NULL, [75] = NULL, [76] = NULL, [77] = NULL,
|
||||
[78] = NULL, [79] = NULL, [80] = NULL, [81] = NULL, [82] = NULL,
|
||||
[83] = NULL, [84] = NULL, [85] = NULL, [86] = NULL, [87] = NULL,
|
||||
[88] = NULL, [89] = NULL, [90] = NULL, [91] = NULL, [92] = NULL,
|
||||
[93] = NULL, [94] = NULL, [95] = NULL, [96] = NULL, [97] = NULL,
|
||||
[98] = NULL, [99] = NULL, [100] = NULL, [101] = NULL, [102] = NULL,
|
||||
[103] = NULL, [104] = NULL, [105] = NULL, [106] = NULL, [107] = NULL,
|
||||
[108] = NULL, [109] = NULL, [110] = NULL, [111] = NULL, [112] = NULL,
|
||||
[113] = NULL, [114] = NULL, [115] = NULL, [116] = NULL, [117] = NULL,
|
||||
[118] = NULL, [119] = NULL, [120] = NULL, [121] = NULL, [122] = NULL,
|
||||
[123] = NULL, [124] = NULL, [125] = NULL, [126] = NULL, [127] = NULL,
|
||||
};
|
||||
|
||||
[[__maybe_unused__]] static const char *qwerty_keymap[128] = {
|
||||
[2] = "1!", [3] = "2@", [4] = "3#", [5] = "4$", [6] = "5%",
|
||||
[7] = "6^", [8] = "7&", [9] = "8*", [10] = "9(", [11] = "0)",
|
||||
[12] = "-_", [13] = "=+", [14] = NULL, [15] = NULL, [16] = "qQ",
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "multiboot.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@ -44,7 +45,9 @@ struct frame_zone {
|
||||
extern uint32_t _kernel_end;
|
||||
extern uint32_t _kernel_start;
|
||||
extern uint32_t boot_page_directory;
|
||||
extern uint32_t *page_directory;
|
||||
extern uint32_t boot_page_table1;
|
||||
extern uint32_t *kernel_pd;
|
||||
extern uint32_t *current_pd;
|
||||
extern uint32_t page_table_default[1024];
|
||||
extern uint32_t mem_size;
|
||||
extern multiboot_memory_map_t *mmap_addr;
|
||||
@ -55,7 +58,9 @@ uint32_t *virt_to_phys(uint32_t *virt_addr);
|
||||
void init_memory(multiboot_info_t *mbd, uint32_t magic);
|
||||
void *alloc_frame(void);
|
||||
int free_frame(void *frame_ptr);
|
||||
void *alloc_pages(size_t size);
|
||||
int8_t add_single_page(void *frame);
|
||||
void *alloc_pages(size_t size, void **phys_addr);
|
||||
int free_pages(void *page_ptr, size_t size);
|
||||
void init_page_table(uint32_t page_table[1024], uint16_t start);
|
||||
int16_t add_page_table(uint16_t pd_index);
|
||||
void switch_pd(uint32_t *pd, uint32_t *cr3);
|
||||
|
@ -3,4 +3,3 @@
|
||||
#define PROMPT "> "
|
||||
|
||||
void shell_init(void);
|
||||
void auto_complete(void);
|
||||
|
@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#define SIG_DFL -1
|
||||
#define SIG_IGN 0
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum {
|
||||
#define SIG_DFL 0
|
||||
#define SIG_IGN -1
|
||||
|
||||
typedef enum {
|
||||
SIGABRT, // Abort signal from abort(3)
|
||||
SIGALRM, // Timer signal from alarm(2)
|
||||
SIGBUS, // Bus error (bad memory access)
|
||||
@ -44,11 +47,16 @@ enum {
|
||||
SIGXFSZ, // File size limit exceeded (4.2BSD); see setrlimit(2)
|
||||
SIGWINCH, // Window resize signal (4.3BSD, Sun)
|
||||
SIG_INT, // Interrupt from keyboard
|
||||
};
|
||||
LAST
|
||||
} SIGNAL_CODE;
|
||||
|
||||
typedef void (*sighandler_t)(int);
|
||||
typedef void (*signal_handler_t)(int);
|
||||
|
||||
struct signal {
|
||||
int signum;
|
||||
sighandler_t handler;
|
||||
void signal(SIGNAL_CODE sig_num, void *handler);
|
||||
void kill(int pid, SIGNAL_CODE sig_num);
|
||||
void exec_signal_pending(void);
|
||||
|
||||
struct signal_data {
|
||||
void *handlers[LAST];
|
||||
uint32_t pending;
|
||||
};
|
44
headers/task.h
Normal file
44
headers/task.h
Normal file
@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "list.h"
|
||||
#include "memory.h"
|
||||
#include "signal.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern struct task *current_task;
|
||||
|
||||
enum status { ZOMBIE, THREAD, RUN, WAIT, SLEEP, STOPPED, FORKED };
|
||||
enum owner { OWNER_KERNEL, OWNER_USER };
|
||||
|
||||
#define STACK_SIZE PAGE_SIZE * 4
|
||||
|
||||
struct task {
|
||||
uint8_t *esp;
|
||||
uint8_t *esp0;
|
||||
uint32_t *cr3; // physical
|
||||
uint32_t *heap; // virtual
|
||||
uint32_t *eip;
|
||||
uint16_t pid;
|
||||
uint8_t status;
|
||||
uint8_t uid;
|
||||
struct task *daddy;
|
||||
struct task *child;
|
||||
struct signal_data signals;
|
||||
struct task *next;
|
||||
struct task *prev;
|
||||
};
|
||||
|
||||
void scheduler(void);
|
||||
void switch_to_task(struct task *next_task);
|
||||
struct task *create_task(uint8_t uid);
|
||||
int8_t create_kernel_task(void);
|
||||
void remove_task(struct task *task);
|
||||
struct task *copy_task(const struct task *task);
|
||||
void kfork(struct task *daddy);
|
||||
void zombify_task(struct task *task);
|
||||
|
||||
// utils
|
||||
void exec_fn(void (*fn)(void));
|
||||
uint16_t fork(void);
|
||||
uint16_t wait(void);
|
@ -1,21 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "font.h"
|
||||
#include "icon.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define VGA_WIDTH 80
|
||||
#define VGA_HEIGHT 25
|
||||
#define TERM_BUF ((uint16_t *)0xC03FF000)
|
||||
#define SCREEN_WIDTH 1024
|
||||
#define SCREEN_HEIGHT 768
|
||||
#define FONT_WIDTH 13
|
||||
#define FONT_HEIGHT 17
|
||||
#define VGA_WIDTH (SCREEN_WIDTH / FONT_WIDTH)
|
||||
#define VGA_HEIGHT (SCREEN_HEIGHT / FONT_HEIGHT)
|
||||
#define TERM_COUNT 10
|
||||
|
||||
struct screen {
|
||||
size_t row;
|
||||
size_t column;
|
||||
uint8_t color;
|
||||
uint16_t buffer[VGA_WIDTH * VGA_HEIGHT];
|
||||
uint8_t default_color;
|
||||
uint32_t fg_color;
|
||||
uint32_t bg_color;
|
||||
uint8_t buffer[VGA_WIDTH * VGA_HEIGHT];
|
||||
uint32_t default_color;
|
||||
struct icon *background;
|
||||
struct font *font;
|
||||
char line[256];
|
||||
};
|
||||
|
||||
@ -41,20 +50,22 @@ typedef enum {
|
||||
enum cursor_direction { LEFT, RIGHT, UP, DOWN };
|
||||
|
||||
void terminal_initialize(void);
|
||||
void terminal_set_bg_color(uint8_t color);
|
||||
void terminal_set_fg_color(uint8_t color);
|
||||
void terminal_set_bg_color(uint32_t color);
|
||||
void terminal_set_fg_color(uint32_t color);
|
||||
int terminal_putchar(char c);
|
||||
int terminal_write(const char *data, size_t size);
|
||||
int terminal_writestring(const char *data);
|
||||
int terminal_writelong(long number);
|
||||
void terminal_set_screen(int pos);
|
||||
void terminal_clear(void);
|
||||
void terminal_refresh(void);
|
||||
struct key_event terminal_getkey(void);
|
||||
void update_cursor(void);
|
||||
void move_cursor(int direction);
|
||||
void set_color_level(int level);
|
||||
void terminal_set_default_fg_color(uint8_t fg_color);
|
||||
void terminal_set_default_bg_color(uint8_t fg_color);
|
||||
void terminal_change_default_fg_color(uint8_t color);
|
||||
uint8_t terminal_get_default_color(void);
|
||||
void terminal_set_default_fg_color(uint32_t fg_color);
|
||||
void terminal_set_default_bg_color(uint32_t fg_color);
|
||||
void terminal_change_default_fg_color(uint32_t color);
|
||||
uint32_t terminal_get_default_color(void);
|
||||
uint8_t terminal_get_char(int column, int row);
|
||||
void terminal_remove_last_char(void);
|
||||
|
5
headers/time.h
Normal file
5
headers/time.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void sleep(uint64_t delay);
|
60
headers/tss.h
Normal file
60
headers/tss.h
Normal file
@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// _h fields are for the offset
|
||||
struct tss {
|
||||
uint16_t link;
|
||||
uint16_t link_h;
|
||||
|
||||
uint32_t esp0;
|
||||
uint16_t ss0;
|
||||
uint16_t ss0_h;
|
||||
|
||||
uint32_t esp1;
|
||||
uint16_t ss1;
|
||||
uint16_t ss1_h;
|
||||
|
||||
uint32_t esp2;
|
||||
uint16_t ss2;
|
||||
uint16_t ss2_h;
|
||||
|
||||
uint32_t cr3;
|
||||
uint32_t eip;
|
||||
uint32_t eflags;
|
||||
|
||||
uint32_t eax;
|
||||
uint32_t ecx;
|
||||
uint32_t edx;
|
||||
uint32_t ebx;
|
||||
|
||||
uint32_t esp;
|
||||
uint32_t ebp;
|
||||
|
||||
uint32_t esi;
|
||||
uint32_t edi;
|
||||
|
||||
uint16_t es;
|
||||
uint16_t es_h;
|
||||
|
||||
uint16_t cs;
|
||||
uint16_t cs_h;
|
||||
|
||||
uint16_t ss;
|
||||
uint16_t ss_h;
|
||||
|
||||
uint16_t ds;
|
||||
uint16_t ds_h;
|
||||
|
||||
uint16_t fs;
|
||||
uint16_t fs_h;
|
||||
|
||||
uint16_t gs;
|
||||
uint16_t gs_h;
|
||||
|
||||
uint16_t ldt;
|
||||
uint16_t ldt_h;
|
||||
|
||||
uint16_t trap;
|
||||
uint16_t iomap;
|
||||
};
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "icon.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct vbe_interface {
|
||||
|
6
libbozo/headers/list.h
Normal file
6
libbozo/headers/list.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct list {
|
||||
void *content;
|
||||
struct list *next;
|
||||
};
|
@ -12,3 +12,4 @@ void *memcpy(void *dest, const void *src, size_t n);
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
void *memset(void *str, int c, size_t n);
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
void bzero(void *s, size_t n);
|
||||
|
@ -1,4 +1,4 @@
|
||||
int isprint(int c)
|
||||
{
|
||||
return (32 <= c && c < 127);
|
||||
return (c >= 32 && c < 127);
|
||||
}
|
6
libbozo/src/string/bzero.c
Normal file
6
libbozo/src/string/bzero.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "string.h"
|
||||
|
||||
void bzero(void *s, size_t n)
|
||||
{
|
||||
memset(s, 0, n);
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
9
libbozo/src/types.sh
Executable file
9
libbozo/src/types.sh
Executable file
@ -0,0 +1,9 @@
|
||||
# !/bin/bash
|
||||
sed -i 's/u8/uint8_t/g' **/*.c
|
||||
sed -i 's/i8/int8_t/g' **/*.c
|
||||
sed -i 's/u16/uint16_t/g' **/*.c
|
||||
sed -i 's/i16/int16_t/g' **/*.c
|
||||
sed -i 's/u32/uint32_t/g' **/*.c
|
||||
sed -i 's/i32/int32_t/g' **/*.c
|
||||
sed -i 's/u64/uint64_t/g' **/*.c
|
||||
sed -i 's/i64/int64_t/g' **/*.c
|
@ -1,6 +1,52 @@
|
||||
#include "interrupts.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void clock_handler(struct registers *regs)
|
||||
#include "debug.h"
|
||||
#include "drivers.h"
|
||||
#include "interrupts.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "sys/io.h"
|
||||
#include "task.h"
|
||||
|
||||
#define PIT_CHANNEL0 0x40
|
||||
#define PIT_FREQUENCY 1193182
|
||||
#define PIT_COUNT (65535 / 2)
|
||||
#define DELAY (1000 / (PIT_FREQUENCY / PIT_COUNT))
|
||||
|
||||
static uint32_t sleep_counter;
|
||||
static uint32_t scheduler_counter;
|
||||
|
||||
static void clock_handler(struct registers *regs);
|
||||
|
||||
static void set_pit_count(unsigned count)
|
||||
{
|
||||
cli();
|
||||
|
||||
outb(0x40, count & 0xFF); // Low byte
|
||||
outb(0x40, (count & 0xFF00) >> 8); // High byte
|
||||
|
||||
toris();
|
||||
}
|
||||
|
||||
void clock_init(struct registers *regs)
|
||||
{
|
||||
(void)regs;
|
||||
set_pit_count(PIT_COUNT);
|
||||
register_interrupt_handler(0, clock_handler);
|
||||
}
|
||||
|
||||
static void clock_handler(struct registers *regs)
|
||||
{
|
||||
(void)regs;
|
||||
if (scheduler_counter % 10 == 0)
|
||||
scheduler();
|
||||
scheduler_counter++;
|
||||
sleep_counter--;
|
||||
}
|
||||
|
||||
void sleep(uint64_t delay)
|
||||
{
|
||||
sleep_counter = delay / DELAY;
|
||||
while (sleep_counter)
|
||||
;
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
void load_drivers(void)
|
||||
{
|
||||
register_interrupt_handler(0, clock_handler);
|
||||
register_interrupt_handler(0, clock_init);
|
||||
register_interrupt_handler(1, keyboard_handler);
|
||||
}
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern struct screen *screen;
|
||||
|
||||
static bool new_input_indicator = false;
|
||||
static struct key_event new_input = {};
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "vbe.h"
|
||||
#include "drivers.h"
|
||||
#include "icon.h"
|
||||
|
||||
struct vbe_interface display;
|
||||
|
@ -5,8 +5,9 @@
|
||||
|
||||
extern void set_gdt(uint32_t gdt_ptr);
|
||||
|
||||
struct tss TSS;
|
||||
uint8_t gdt_entries[GDT_SIZE * 8];
|
||||
struct gdt_descriptor *gdtr = (struct gdt_descriptor *)GDT_ADDRESS;
|
||||
struct gdt_descriptor gdtr;
|
||||
|
||||
static void set_gdt_entry_value(uint8_t *target, uint32_t base, uint32_t limit,
|
||||
uint8_t access, uint8_t granularity)
|
||||
@ -36,8 +37,8 @@ static void set_gdt_entry_value(uint8_t *target, uint32_t base, uint32_t limit,
|
||||
|
||||
void init_gdt(void)
|
||||
{
|
||||
gdtr->size = 8 * GDT_SIZE - 1;
|
||||
gdtr->base = (uint32_t)&gdt_entries[0];
|
||||
gdtr.size = 8 * GDT_SIZE - 1;
|
||||
gdtr.base = (uint32_t)&gdt_entries[0];
|
||||
|
||||
set_gdt_entry_value(gdt_entries + 0x00, 0, 0, 0, 0); // Null segment
|
||||
|
||||
@ -90,6 +91,9 @@ void init_gdt(void)
|
||||
GDT_ACCESS_RW_READABLE_FOR_CODE_WRITABLE_FOR_DATA |
|
||||
GDT_ACCESS_A_ACCESSED,
|
||||
GDT_FLAG_32BIT_MODE | GDT_FLAG_PAGE_MODE); // User stack
|
||||
// TSS
|
||||
set_gdt_entry_value(gdt_entries + GDT_OFFSET_TSS, (uint32_t)&TSS,
|
||||
sizeof(struct tss) - 1, 0x89, 0);
|
||||
|
||||
set_gdt(((uint32_t)gdtr));
|
||||
set_gdt(((uint32_t)&gdtr));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "interrupts.h"
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "power.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <stddef.h>
|
||||
@ -35,6 +36,8 @@ void isr_handler(struct registers *regs)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
while (i < ARRAY_SIZE(faults)) {
|
||||
if (i == 6)
|
||||
reboot();
|
||||
if (i == regs->int_no)
|
||||
kpanic("interrupt: %s\n", faults[i]);
|
||||
i++;
|
||||
|
@ -38,6 +38,7 @@ irq_common_stub:
|
||||
iret
|
||||
|
||||
irq0:
|
||||
mov [esp_backup], esp
|
||||
push 0
|
||||
push 32
|
||||
jmp irq_common_stub
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <cpuid.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
@ -1,10 +0,0 @@
|
||||
#include "signal.h"
|
||||
#include <stddef.h>
|
||||
|
||||
void (*signal(int sig, void (*func)(int)))(int)
|
||||
{
|
||||
// TODO after multi tasking and processes
|
||||
(void)sig;
|
||||
(void)func;
|
||||
return NULL;
|
||||
}
|
26
src/kernel.c
26
src/kernel.c
@ -3,7 +3,6 @@
|
||||
#include "drivers.h"
|
||||
#include "gdt.h"
|
||||
#include "icon.h"
|
||||
#include "icons/image.h"
|
||||
#include "idt.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
@ -11,7 +10,9 @@
|
||||
#include "power.h"
|
||||
#include "shell.h"
|
||||
#include "string.h"
|
||||
#include "task.h"
|
||||
#include "terminal.h"
|
||||
#include "time.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
@ -29,20 +30,23 @@
|
||||
#error "This tutorial needs to be compiled with a ix86-elf compiler"
|
||||
#endif
|
||||
|
||||
static void bozo(int int_code)
|
||||
{
|
||||
kprintf("apagnan code\n");
|
||||
}
|
||||
|
||||
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
{
|
||||
/* terminal_initialize(); */
|
||||
terminal_initialize();
|
||||
init_gdt();
|
||||
init_idt();
|
||||
init_memory(mbd, magic);
|
||||
load_drivers();
|
||||
/* kprintf(KERN_ALERT */
|
||||
/* "I see no way to confuse an array of 256 seg:off pairs with a
|
||||
* " */
|
||||
/* "complex 8*unknown quantity -byte descriptor table. -- Troy "
|
||||
*/
|
||||
/* "Martin 03:50, 22 March 2009 (UTC)\n"); */
|
||||
terminal_putchar('A');
|
||||
/* memset(display.buff, 255, 1024 * 1024); */
|
||||
/* shell_init(); */
|
||||
create_kernel_task();
|
||||
kill(0, 4);
|
||||
for (size_t i = 0; i < 10000; i++)
|
||||
free_pages(alloc_pages(1, NULL), 1);
|
||||
signal(4, bozo);
|
||||
kill(0, 4);
|
||||
shell_init();
|
||||
}
|
||||
|
15
src/kpanic.c
15
src/kpanic.c
@ -4,9 +4,12 @@
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "power.h"
|
||||
#include "string.h"
|
||||
#include "terminal.h"
|
||||
|
||||
extern uint32_t page_table1[1024];
|
||||
extern const char *faults[];
|
||||
void clear_registers(void);
|
||||
|
||||
__attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
{
|
||||
@ -14,20 +17,20 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
|
||||
/* terminal_set_bg_color(VGA_COLOR_BLUE); */
|
||||
/* terminal_clear(); */
|
||||
kprintf("kpanic: ");
|
||||
va_start(va, format);
|
||||
kvprintf(format, &va);
|
||||
va_end(va);
|
||||
|
||||
uint32_t faulting_address;
|
||||
__asm__ __volatile__("mov %%cr2, %0" : "=r"(faulting_address));
|
||||
kprintf("fault at address: %p\n", faulting_address);
|
||||
// __asm__ __volatile__("mov %%cr2, %0" : "=r"(faulting_address));
|
||||
// kprintf("fault at address: %p\n", faulting_address);
|
||||
/* for (int i = 16; i < 32; i++) */
|
||||
/* kprintf("%p\n", page_table1[i]); */
|
||||
/* show_valloc_mem(); */
|
||||
// show_valloc_mem();
|
||||
/* kprintf("\n\n"); */
|
||||
/* print_stack(); */
|
||||
/* kprintf("\n\n"); */
|
||||
/* kprintf("PRESS SPACE TO REBOOT"); */
|
||||
while (terminal_getkey().scan_code != KEY_SPACE)
|
||||
;
|
||||
reboot();
|
||||
__asm__ __volatile__("jmp panic");
|
||||
}
|
||||
|
@ -4,12 +4,19 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t *page_directory = &boot_page_directory;
|
||||
uint32_t *kernel_pd = &boot_page_directory;
|
||||
uint32_t *current_pd;
|
||||
uint32_t page_table_default[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
uint32_t frame_zones_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
uint32_t mem_size;
|
||||
struct frame_zone *head;
|
||||
|
||||
void switch_pd(uint32_t *pd, uint32_t *cr3)
|
||||
{
|
||||
current_pd = pd;
|
||||
asm volatile("mov %0, %%cr3" ::"r"(cr3));
|
||||
}
|
||||
|
||||
static void lst_add_back(struct frame_zone **root, struct frame_zone *element)
|
||||
{
|
||||
if (!*root) {
|
||||
@ -61,8 +68,7 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
end_addr = ROUND_CEIL(start_addr + len, PAGE_SIZE);
|
||||
|
||||
init_page_table(frame_zones_page_table, 0);
|
||||
page_directory[1022] =
|
||||
((uint32_t)frame_zones_page_table - HEAP_END) | 0x03;
|
||||
kernel_pd[1022] = ((uint32_t)frame_zones_page_table - HEAP_END) | 0x03;
|
||||
frame_zones_page_table[index] =
|
||||
((uint32_t)start_addr & PAGE_MASK) | INIT_FLAGS;
|
||||
|
||||
@ -108,9 +114,10 @@ static void init_frame_zones(void)
|
||||
void init_memory(multiboot_info_t *mbd, uint32_t magic)
|
||||
{
|
||||
for (uint16_t i = 0; i < 0x300; i++)
|
||||
page_directory[i] = 0x02;
|
||||
kernel_pd[i] = 0x02;
|
||||
init_page_table(page_table_default, 0);
|
||||
page_directory[0] = ((uint32_t)page_table_default - HEAP_END) | 0x03;
|
||||
kernel_pd[0] = ((uint32_t)page_table_default - HEAP_END) | 0x03;
|
||||
current_pd = kernel_pd;
|
||||
init_multiboot(mbd, magic);
|
||||
init_frame_zones();
|
||||
}
|
||||
|
@ -6,13 +6,14 @@
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "string.h"
|
||||
#include "task.h"
|
||||
#include "utils.h"
|
||||
|
||||
static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr,
|
||||
uint32_t **page_table_ptr)
|
||||
{
|
||||
for (*pd_index_ptr = 1; *pd_index_ptr < 768; (*pd_index_ptr)++) {
|
||||
if (page_directory[(*pd_index_ptr)] == 0x02) {
|
||||
if (current_pd[(*pd_index_ptr)] == 0x02) {
|
||||
if (add_page_table(*pd_index_ptr) < 0)
|
||||
return -2;
|
||||
}
|
||||
@ -32,7 +33,21 @@ static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr,
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *alloc_pages(size_t size)
|
||||
int8_t add_single_page(void *frame)
|
||||
{
|
||||
uint16_t pd_index;
|
||||
uint32_t *page_table;
|
||||
const int16_t i = find_next_block(1, &pd_index, &page_table);
|
||||
|
||||
if (i < 0) {
|
||||
kprintf(KERN_CRIT "impossible to add page to page directory\n");
|
||||
return -1;
|
||||
}
|
||||
page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *alloc_pages(size_t size, void **phys_addr)
|
||||
{
|
||||
const uint32_t nb_pages = CEIL(size, PAGE_SIZE);
|
||||
uint16_t pd_index;
|
||||
@ -51,6 +66,8 @@ void *alloc_pages(size_t size)
|
||||
free_frame((void *)(page_table[j] & PAGE_MASK));
|
||||
return NULL;
|
||||
}
|
||||
if (phys_addr)
|
||||
*phys_addr = frame;
|
||||
page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
||||
}
|
||||
memset((void *)GET_PAGE_ADDR(pd_index, index), 0, nb_pages * PAGE_SIZE);
|
||||
|
@ -17,6 +17,6 @@ int16_t add_page_table(uint16_t pd_index)
|
||||
uint32_t *page_table =
|
||||
(uint32_t *)GET_PAGE_ADDR(0, PT_START + pd_index);
|
||||
init_page_table(page_table, 0);
|
||||
page_directory[pd_index] = ((uint32_t)frame & PAGE_MASK) | 0x03;
|
||||
kernel_pd[pd_index] = ((uint32_t)frame & PAGE_MASK) | 0x03;
|
||||
return 0;
|
||||
}
|
||||
|
70
src/memory/phys/allocator.c
Normal file
70
src/memory/phys/allocator.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "alloc.h"
|
||||
#include "debug.h"
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "task.h"
|
||||
|
||||
Zone *kzones[3];
|
||||
|
||||
static void add_zone(Zone *zone, block_type_t type)
|
||||
{
|
||||
// We put the zone at the beginning of the list
|
||||
if (kzones[type]) {
|
||||
assert(kzones[type] != zone);
|
||||
zone->next = kzones[type];
|
||||
kzones[type]->prev = zone;
|
||||
}
|
||||
kzones[type] = zone;
|
||||
}
|
||||
|
||||
static void new_block(Zone *zone, uint32_t zone_size)
|
||||
{
|
||||
Block *new_block = (Block *)align_mem((uint32_t)zone + sizeof(Zone));
|
||||
|
||||
// Metadata
|
||||
new_block->in_use = false;
|
||||
new_block->size = zone_size - sizeof(Zone) - sizeof(Block);
|
||||
new_block->sub_size = new_block->size;
|
||||
new_block->ptr = (Block *)((uint32_t)new_block + sizeof(Block));
|
||||
new_block->zone = zone;
|
||||
|
||||
// Init future linked lists
|
||||
new_block->prev = NULL;
|
||||
new_block->prev_free = NULL;
|
||||
new_block->prev_used = NULL;
|
||||
new_block->next = NULL;
|
||||
new_block->next_free = NULL;
|
||||
new_block->next_used = NULL;
|
||||
|
||||
if (zone->free) {
|
||||
zone->free->prev = new_block;
|
||||
zone->free->prev_free = new_block;
|
||||
new_block->next = zone->free;
|
||||
new_block->next_free = zone->free;
|
||||
}
|
||||
zone->free = new_block;
|
||||
assert(zone->free == new_block);
|
||||
}
|
||||
|
||||
int new_kzone(block_type_t type, uint32_t size)
|
||||
{
|
||||
// assert(current_task->pid);
|
||||
void *heap = alloc_frame();
|
||||
if (heap == NULL) {
|
||||
kprintf(KERN_ERR "error: alloc_frame failed\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
Zone *zone = (Zone *)heap;
|
||||
zone->type = type;
|
||||
zone->size = size;
|
||||
zone->used = NULL;
|
||||
zone->next = NULL;
|
||||
zone->prev = NULL;
|
||||
|
||||
new_block(zone, size);
|
||||
add_zone(heap, type);
|
||||
|
||||
return (0);
|
||||
}
|
52
src/memory/phys/info.c
Normal file
52
src/memory/phys/info.c
Normal file
@ -0,0 +1,52 @@
|
||||
#include "alloc.h"
|
||||
#include "kprintf.h"
|
||||
#include <stdint.h>
|
||||
|
||||
// FULL_INFO is to display (or not) both used and unused blocks
|
||||
#define FULL_INFO 1
|
||||
|
||||
void show_kalloc_mem(void)
|
||||
{
|
||||
char *const zones_name[3] = {"TINY", "SMALL", "LARGE"};
|
||||
uint32_t total_size = 0;
|
||||
|
||||
for (block_type_t type = 0; type < 3; ++type) {
|
||||
int count = 0;
|
||||
for (Zone *zone_it = kzones[type]; zone_it != NULL;
|
||||
zone_it = zone_it->next) {
|
||||
if (zone_it->used)
|
||||
kprintf("---------- IN_USE %s [n°%d - %p] "
|
||||
"----------\n",
|
||||
zones_name[type], count, zone_it);
|
||||
for (Block *block_it = zone_it->used; block_it != NULL;
|
||||
block_it = block_it->next_used) {
|
||||
/* i++; */
|
||||
/* if (i < 10) */
|
||||
kprintf("%p - %p : %u bytes\n", block_it->ptr,
|
||||
(uint32_t)block_it->ptr +
|
||||
block_it->sub_size + sizeof(Block),
|
||||
block_it->sub_size);
|
||||
total_size += block_it->sub_size;
|
||||
}
|
||||
if (zone_it->used)
|
||||
kprintf("\n");
|
||||
count++;
|
||||
#if FULL_INFO
|
||||
if (zone_it->free)
|
||||
kprintf("---------- AVAILABLE %s [n°%d - %p] "
|
||||
"----------\n",
|
||||
zones_name[type], count, zone_it);
|
||||
for (Block *block_it = zone_it->free; block_it != NULL;
|
||||
block_it = block_it->next_free) {
|
||||
kprintf("%p - %p : %u bytes\n", block_it->ptr,
|
||||
(uint32_t)block_it->ptr +
|
||||
block_it->sub_size + sizeof(Block),
|
||||
block_it->sub_size);
|
||||
}
|
||||
if (zone_it->free)
|
||||
kprintf("\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
kprintf("Total: %u\n", total_size);
|
||||
}
|
116
src/memory/phys/kfree.c
Normal file
116
src/memory/phys/kfree.c
Normal file
@ -0,0 +1,116 @@
|
||||
#include "alloc.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include <stdint.h>
|
||||
|
||||
static void remove_used(Block *to_free)
|
||||
{
|
||||
Block *left = to_free->prev_used;
|
||||
Block *right = to_free->next_used;
|
||||
|
||||
to_free->next_used = NULL;
|
||||
to_free->prev_used = NULL;
|
||||
|
||||
if (!left && !right) {
|
||||
to_free->zone->used = NULL;
|
||||
return;
|
||||
}
|
||||
if (!left)
|
||||
to_free->zone->used = right;
|
||||
else
|
||||
left->next_used = right;
|
||||
if (right)
|
||||
right->prev_used = left;
|
||||
}
|
||||
|
||||
/*
|
||||
* If all the blocks of the zone have been kfreed,
|
||||
* we can unmap the zone and delete it from the list of zones
|
||||
*/
|
||||
static int unmap_zone(Zone *zone)
|
||||
{
|
||||
int err = 0;
|
||||
block_type_t type = zone->type;
|
||||
Zone *left = zone->prev;
|
||||
Zone *right = zone->next;
|
||||
zone->prev = NULL;
|
||||
zone->next = NULL;
|
||||
|
||||
if (!left && !right) {
|
||||
kzones[type] = NULL;
|
||||
goto unmap;
|
||||
}
|
||||
if (!left)
|
||||
kzones[type] = right;
|
||||
else
|
||||
left->next = right;
|
||||
if (right)
|
||||
right->prev = left;
|
||||
unmap:
|
||||
err = free_pages((void *)zone, zone->size);
|
||||
if (err)
|
||||
kprintf(KERN_ERR "error: munmap failed\n");
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the newly kfreed block is next to another previously
|
||||
* kfreed block, merge both of these and update the size
|
||||
*/
|
||||
static Block *merge_blocks(Block *left, Block *right)
|
||||
{
|
||||
if (right->next)
|
||||
right->next->prev = left;
|
||||
if (right->next_free) {
|
||||
right->next_free->prev_free = left;
|
||||
left->next_free = right->next_free;
|
||||
}
|
||||
left->next = right->next;
|
||||
left->size += right->size + sizeof(Block);
|
||||
return (left);
|
||||
}
|
||||
|
||||
// Simply add the new block to the list of available blocks
|
||||
static int add_available(Block *available, Block *merged)
|
||||
{
|
||||
Zone *zone = available->zone;
|
||||
if (merged != zone->free && available != zone->free)
|
||||
available->next_free = zone->free;
|
||||
if (zone->free)
|
||||
zone->free->prev_free = available;
|
||||
zone->free = available;
|
||||
if (zone->type == LARGE)
|
||||
return (unmap_zone(zone));
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ptr: pointer to kfree, if the pointer is invalid the kfree()
|
||||
* function will have an undefined behavior (most likely segfault)
|
||||
*
|
||||
* First, we remove the block from the list of in_use blocks
|
||||
* Then, we check if the block needs to be merged with another
|
||||
* neighboring block, if so we replace the previous block by the
|
||||
* newly merged block
|
||||
* Finally, we add the block to the list of available blocks
|
||||
*/
|
||||
void kfree(void *ptr)
|
||||
{
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
Block *to_free = (Block *)((uint32_t)ptr - sizeof(Block));
|
||||
Block *to_merge = NULL;
|
||||
to_free->in_use = false;
|
||||
remove_used(to_free);
|
||||
if (to_free->prev && !to_free->prev->in_use) {
|
||||
to_merge = to_free;
|
||||
to_free = merge_blocks(to_free->prev, to_free);
|
||||
}
|
||||
if (to_free->next && !to_free->next->in_use) {
|
||||
to_merge = to_free->next;
|
||||
to_free = merge_blocks(to_free, to_free->next);
|
||||
}
|
||||
int err = add_available(to_free, to_merge);
|
||||
if (err)
|
||||
kprintf(KERN_ERR "kfree: fatal error\n");
|
||||
}
|
162
src/memory/phys/kmalloc.c
Normal file
162
src/memory/phys/kmalloc.c
Normal file
@ -0,0 +1,162 @@
|
||||
#include "alloc.h"
|
||||
#include "debug.h"
|
||||
#include "kprintf.h"
|
||||
#include "terminal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Find first available (not in_use) block
|
||||
* in a zone matching the size we need
|
||||
*/
|
||||
static Block *find_block(Zone *head, uint32_t size)
|
||||
{
|
||||
for (Zone *zone_it = head; zone_it != NULL; zone_it = zone_it->next) {
|
||||
for (Block *block_it = zone_it->free; block_it != NULL;
|
||||
block_it = block_it->next_free) {
|
||||
assert(block_it);
|
||||
assert(!block_it->in_use);
|
||||
if (size <= block_it->size) {
|
||||
assert(block_it->zone == zone_it);
|
||||
return (block_it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
// PARTIALLY DEPRECATED
|
||||
/*
|
||||
* This will split the newly allocated block to use
|
||||
* the remaining bytes for a new block
|
||||
* This is our linked list of blocks
|
||||
* ... -> [5] -> [6] -> ...
|
||||
* After the allocation, this will become
|
||||
* ... -> [5] -> [new] -> [6] -> ...
|
||||
*
|
||||
* For an example of [5].size = 32 and requiring a kmalloc of 10
|
||||
* Let's say the metadata takes a size of 2:
|
||||
* ... -> [metadata][data][remaining size] -> [6]
|
||||
* ^ ^ ^
|
||||
* 2 10 20
|
||||
*
|
||||
* So now our block [new] will become:
|
||||
* [5] -> [metadata][available data] -> [6]
|
||||
* ^ ^
|
||||
* 2 18
|
||||
* We can see that it now has its own metadata and available
|
||||
* data and it points towards [6]
|
||||
*/
|
||||
static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
{
|
||||
Block *new_block = (Block *)align_mem((uint32_t)old_block + size);
|
||||
assert(new_block <
|
||||
(Block *)((uint32_t)zone + get_zone_size(zone->type)));
|
||||
|
||||
if (old_block->size - align_mem(size) < sizeof(Block)) {
|
||||
zone->free = NULL;
|
||||
goto last_block;
|
||||
}
|
||||
|
||||
// Newly created block metadata
|
||||
new_block->size = old_block->size - align_mem(size);
|
||||
new_block->sub_size = new_block->size;
|
||||
new_block->in_use = false;
|
||||
new_block->ptr = (void *)((uint32_t)new_block + sizeof(Block));
|
||||
new_block->zone = zone;
|
||||
|
||||
new_block->prev = old_block;
|
||||
new_block->next = old_block->next;
|
||||
old_block->next = new_block;
|
||||
|
||||
new_block->prev_used = NULL;
|
||||
new_block->next_used = NULL;
|
||||
|
||||
new_block->prev_free = old_block->prev_free;
|
||||
new_block->next_free = NULL;
|
||||
if (new_block != old_block->next_free)
|
||||
new_block->next_free = old_block->next_free;
|
||||
|
||||
if (zone->free == old_block)
|
||||
zone->free = new_block;
|
||||
|
||||
last_block:
|
||||
old_block->next_free = NULL;
|
||||
old_block->prev_free = NULL;
|
||||
|
||||
// Newly in_use block metadata
|
||||
old_block->in_use = true;
|
||||
old_block->size = size - sizeof(Block);
|
||||
old_block->sub_size = old_block->size;
|
||||
|
||||
if (zone->used == NULL) {
|
||||
zone->used = old_block;
|
||||
return;
|
||||
}
|
||||
old_block->prev_used = NULL;
|
||||
old_block->next_used = zone->used;
|
||||
zone->used->prev_used = old_block;
|
||||
zone->used = old_block;
|
||||
}
|
||||
|
||||
// Set the block to used and unset free
|
||||
static void save_block(Zone *head, Block *block, Zone *zone)
|
||||
{
|
||||
zone->free = NULL;
|
||||
block->in_use = true;
|
||||
if (head->used) {
|
||||
head->used->prev_used = block;
|
||||
head->used->prev = block;
|
||||
block->next = head->used;
|
||||
block->next_used = head->used;
|
||||
}
|
||||
head->used = block;
|
||||
}
|
||||
|
||||
/*
|
||||
* size: size needed by the user to get allocated
|
||||
*
|
||||
* First, we init the allocator if it's the first time
|
||||
* Then we search if there is an available block in all
|
||||
* the zones currently mapped
|
||||
* If no block has been found (NULL), we create 1 new zone of
|
||||
* the corresponding type
|
||||
* We then search again for an available block (should not be NULL)
|
||||
* Finally, if type == LARGE, we just have to change the block to used
|
||||
* else, we frag the block to use just what's needed
|
||||
*
|
||||
* ptr: returns the aligned pointer of the block (after the metadata)
|
||||
*/
|
||||
void *kmalloc(uint32_t size)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
if (size == 0) {
|
||||
kprintf(KERN_WARNING "kmalloc: can't kmalloc(0)\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Find the zone we need to search
|
||||
block_type_t type = get_type(size);
|
||||
Zone *head = kzones[type];
|
||||
|
||||
// Find an available block in a zone of type "type"
|
||||
Block *available = find_block(head, size);
|
||||
if (available == NULL) {
|
||||
uint32_t full_size;
|
||||
if (type == LARGE)
|
||||
full_size = size + sizeof(Block) + sizeof(Zone);
|
||||
else
|
||||
full_size = get_zone_size(type);
|
||||
if (new_kzone(type, full_size) == -1)
|
||||
return NULL;
|
||||
head = kzones[type];
|
||||
available = find_block(head, size);
|
||||
}
|
||||
assert(available != NULL);
|
||||
if (type == LARGE)
|
||||
save_block(head, available, available->zone);
|
||||
else
|
||||
frag_block(available->zone, available, size + sizeof(Block));
|
||||
ptr = available->ptr;
|
||||
return ptr;
|
||||
}
|
37
src/memory/phys/krealloc.c
Normal file
37
src/memory/phys/krealloc.c
Normal file
@ -0,0 +1,37 @@
|
||||
#include "alloc.h"
|
||||
#include "string.h"
|
||||
#include <stdint.h>
|
||||
|
||||
// Prototype for kfree and kmalloc
|
||||
void kfree(void *ptr);
|
||||
void *kmalloc(uint32_t size);
|
||||
|
||||
/*
|
||||
* ptr: block to resize (undefined behavior if invalid)
|
||||
* size: size needed by the user to get kreallocated
|
||||
*
|
||||
* If we have a size <= to the previous size, we don't have
|
||||
* to do anything, we just change sub_size for info purposes
|
||||
* and return the same pointer
|
||||
* Else, we allocate a new block and copy the content of
|
||||
* the previous block in the new one and kfree the old block
|
||||
*
|
||||
* ptr: returns the aligned pointer of the kreallocated block
|
||||
*/
|
||||
void *krealloc(void *ptr, uint32_t size)
|
||||
{
|
||||
void *new_ptr = NULL;
|
||||
if (ptr == NULL)
|
||||
return NULL;
|
||||
Block *block = (Block *)((uint32_t)ptr - sizeof(Block));
|
||||
if (block->size >= size) {
|
||||
block->sub_size = size;
|
||||
return (ptr);
|
||||
}
|
||||
new_ptr = kmalloc(size);
|
||||
if (new_ptr == NULL)
|
||||
return NULL;
|
||||
memmove(new_ptr, ptr, block->size);
|
||||
kfree(ptr);
|
||||
return (new_ptr);
|
||||
}
|
9
src/memory/phys/ksize.c
Normal file
9
src/memory/phys/ksize.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include "alloc.h"
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t ksize(void *ptr)
|
||||
{
|
||||
Block *meta_data = (Block *)((uint32_t)ptr - sizeof(Block));
|
||||
|
||||
return meta_data->sub_size;
|
||||
}
|
@ -3,18 +3,19 @@
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "task.h"
|
||||
|
||||
Zone *zones[3];
|
||||
Zone *vzones[3];
|
||||
|
||||
static void add_zone(Zone *zone, block_type_t type)
|
||||
{
|
||||
// We put the zone at the beginning of the list
|
||||
if (zones[type]) {
|
||||
assert(zones[type] != zone);
|
||||
zone->next = zones[type];
|
||||
zones[type]->prev = zone;
|
||||
if (vzones[type]) {
|
||||
assert(vzones[type] != zone);
|
||||
zone->next = vzones[type];
|
||||
vzones[type]->prev = zone;
|
||||
}
|
||||
zones[type] = zone;
|
||||
vzones[type] = zone;
|
||||
}
|
||||
|
||||
static void new_block(Zone *zone, uint32_t zone_size)
|
||||
@ -48,7 +49,8 @@ static void new_block(Zone *zone, uint32_t zone_size)
|
||||
|
||||
int new_vzone(block_type_t type, uint32_t size)
|
||||
{
|
||||
void *heap = alloc_pages(size);
|
||||
// assert(current_task->pid);
|
||||
void *heap = alloc_pages(size, NULL);
|
||||
if (heap == NULL) {
|
||||
kprintf(KERN_ERR "error: alloc_pages failed\n");
|
||||
return (-1);
|
||||
|
@ -12,7 +12,7 @@ void show_valloc_mem(void)
|
||||
|
||||
for (block_type_t type = 0; type < 3; ++type) {
|
||||
int count = 0;
|
||||
for (Zone *zone_it = zones[type]; zone_it != NULL;
|
||||
for (Zone *zone_it = vzones[type]; zone_it != NULL;
|
||||
zone_it = zone_it->next) {
|
||||
if (zone_it->used)
|
||||
kprintf("---------- IN_USE %s [n°%d - %p] "
|
||||
|
@ -37,11 +37,11 @@ static int unmap_zone(Zone *zone)
|
||||
zone->next = NULL;
|
||||
|
||||
if (!left && !right) {
|
||||
zones[type] = NULL;
|
||||
vzones[type] = NULL;
|
||||
goto unmap;
|
||||
}
|
||||
if (!left)
|
||||
zones[type] = right;
|
||||
vzones[type] = right;
|
||||
else
|
||||
left->next = right;
|
||||
if (right)
|
||||
|
@ -52,6 +52,11 @@ static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
assert(new_block <
|
||||
(Block *)((uint32_t)zone + get_zone_size(zone->type)));
|
||||
|
||||
if (old_block->size - align_mem(size) < sizeof(Block)) {
|
||||
zone->free = NULL;
|
||||
goto last_block;
|
||||
}
|
||||
|
||||
// Newly created block metadata
|
||||
new_block->size = old_block->size - align_mem(size);
|
||||
new_block->sub_size = new_block->size;
|
||||
@ -74,6 +79,7 @@ static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
if (zone->free == old_block)
|
||||
zone->free = new_block;
|
||||
|
||||
last_block:
|
||||
old_block->next_free = NULL;
|
||||
old_block->prev_free = NULL;
|
||||
|
||||
@ -131,7 +137,7 @@ void *vmalloc(uint32_t size)
|
||||
|
||||
// Find the zone we need to search
|
||||
block_type_t type = get_type(size);
|
||||
Zone *head = zones[type];
|
||||
Zone *head = vzones[type];
|
||||
|
||||
// Find an available block in a zone of type "type"
|
||||
Block *available = find_block(head, size);
|
||||
@ -143,7 +149,7 @@ void *vmalloc(uint32_t size)
|
||||
full_size = get_zone_size(type);
|
||||
if (new_vzone(type, full_size) == -1)
|
||||
return NULL;
|
||||
head = zones[type];
|
||||
head = vzones[type];
|
||||
available = find_block(head, size);
|
||||
}
|
||||
assert(available != NULL);
|
||||
|
@ -33,13 +33,12 @@ static void init_vbe(multiboot_info_t *mbd_virt)
|
||||
{
|
||||
const uint32_t framebuffer_size =
|
||||
mbd_virt->framebuffer_height * mbd_virt->framebuffer_pitch;
|
||||
uint32_t i = 0;
|
||||
for (; i < CEIL(framebuffer_size, PAGE_SIZE); i++) {
|
||||
for (uint32_t i = 0; i < CEIL(framebuffer_size, PAGE_SIZE); i++) {
|
||||
vbe_page_table[i % 1024] =
|
||||
((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
INIT_FLAGS;
|
||||
}
|
||||
page_directory[800] = ((uint32_t)vbe_page_table - HEAP_END) | 0x03;
|
||||
kernel_pd[800] = ((uint32_t)vbe_page_table - HEAP_END) | 0x03;
|
||||
display.buff = (uint32_t *)GET_PAGE_ADDR(800, 0) +
|
||||
(mbd_virt->framebuffer_addr % PAGE_SIZE);
|
||||
display.height = mbd_virt->framebuffer_height;
|
||||
@ -54,8 +53,7 @@ void init_multiboot(multiboot_info_t *mbd, uint32_t magic)
|
||||
kpanic("invalid magic number! (git good skill issue)");
|
||||
|
||||
init_page_table(multiboot_page_table, 0);
|
||||
page_directory[1023] =
|
||||
((uint32_t)multiboot_page_table - HEAP_END) | 0x03;
|
||||
kernel_pd[1023] = ((uint32_t)multiboot_page_table - HEAP_END) | 0x03;
|
||||
size_t pt_index = CEIL(
|
||||
(uint32_t)mbd % PAGE_SIZE + sizeof(multiboot_info_t), PAGE_SIZE);
|
||||
|
||||
|
26
src/multitasking/fork.c
Normal file
26
src/multitasking/fork.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include "interrupts.h"
|
||||
#include "kprintf.h"
|
||||
#include "task.h"
|
||||
|
||||
uint16_t fork(void)
|
||||
{
|
||||
current_task->status = FORKED;
|
||||
scheduler();
|
||||
return current_task->child ? current_task->child->pid : 0;
|
||||
}
|
||||
|
||||
void kfork(struct task *daddy)
|
||||
{
|
||||
cli();
|
||||
struct task *child = copy_task(daddy);
|
||||
if (!child) {
|
||||
kprintf(KERN_ALERT "Fork failed ! retry at the next loop");
|
||||
toris();
|
||||
return;
|
||||
}
|
||||
child->daddy = daddy;
|
||||
daddy->child = child;
|
||||
daddy->status = RUN;
|
||||
child->status = RUN;
|
||||
toris();
|
||||
}
|
35
src/multitasking/scheduler.c
Normal file
35
src/multitasking/scheduler.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include "alloc.h"
|
||||
#include "debug.h"
|
||||
#include "interrupts.h"
|
||||
#include "kprintf.h"
|
||||
#include "task.h"
|
||||
#include "time.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct task *current_task;
|
||||
|
||||
void scheduler(void)
|
||||
{
|
||||
// ZOMBIE, THREAD, RUN, WAIT, SLEEP, STOPPED, FORKED
|
||||
void (*func[])(struct task *) = {
|
||||
zombify_task, NULL, NULL, NULL, NULL, remove_task, kfork,
|
||||
};
|
||||
|
||||
if (!current_task) // || current_task->next == current_task)
|
||||
return;
|
||||
cli();
|
||||
switch_pd(kernel_pd, (uint32_t *)((uint32_t)kernel_pd - HEAP_END));
|
||||
struct task *it = current_task->next;
|
||||
while (it && it->status != RUN) {
|
||||
if (it != current_task && func[it->status]) {
|
||||
struct task *new_it = it->prev;
|
||||
func[it->status](it);
|
||||
it = new_it;
|
||||
}
|
||||
it = it->next;
|
||||
}
|
||||
switch_to_task(it);
|
||||
exec_signal_pending();
|
||||
toris();
|
||||
}
|
58
src/multitasking/switch_to_task.s
Normal file
58
src/multitasking/switch_to_task.s
Normal file
@ -0,0 +1,58 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
.section .text
|
||||
.global switch_to_task
|
||||
|
||||
switch_to_task:
|
||||
push ebx
|
||||
push ebp
|
||||
push edi
|
||||
push esi
|
||||
|
||||
mov eax, [current_task]
|
||||
|
||||
// save the current stack pointer to the old stack
|
||||
mov [eax+0], esp
|
||||
|
||||
// stack pointer + the 4 regs pushed
|
||||
// and + 1 to get the argument (next task)
|
||||
mov esi, [esp+(4+1)*4]
|
||||
mov [current_task], esi
|
||||
|
||||
mov eax, [current_task]
|
||||
|
||||
mov esp, [eax+0] // get esp
|
||||
|
||||
mov ecx, [eax+12] // get task's pd
|
||||
mov [current_pd], ecx
|
||||
mov ecx, [eax+8]
|
||||
mov cr3, ecx
|
||||
|
||||
pop esi
|
||||
pop edi
|
||||
pop ebp
|
||||
pop ebx
|
||||
|
||||
|
||||
mov ecx, 0
|
||||
|
||||
cmp [eax+16], ecx
|
||||
je .END
|
||||
|
||||
sti
|
||||
|
||||
push [eax+16] // store func_ptr
|
||||
|
||||
mov [eax+16], ecx // clear eip in current_task
|
||||
|
||||
push 0
|
||||
call pic_send_eoi
|
||||
pop edx // remove pic_send_eoi argument
|
||||
|
||||
pop edx // get func_ptr
|
||||
call edx
|
||||
|
||||
call exit_task
|
||||
|
||||
.END:
|
||||
ret
|
136
src/multitasking/task.c
Normal file
136
src/multitasking/task.c
Normal file
@ -0,0 +1,136 @@
|
||||
#include "task.h"
|
||||
#include "alloc.h"
|
||||
#include "debug.h"
|
||||
#include "interrupts.h"
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "string.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t esp_backup;
|
||||
|
||||
struct task *create_task(uint8_t uid)
|
||||
{
|
||||
static uint32_t pid = 1;
|
||||
switch_pd(kernel_pd, (uint32_t *)((uint32_t)kernel_pd - HEAP_END));
|
||||
struct task *new_task = vmalloc(sizeof(struct task));
|
||||
if (!new_task) {
|
||||
switch_pd(current_task->heap, current_task->cr3);
|
||||
return NULL;
|
||||
}
|
||||
switch_pd(current_task->heap, current_task->cr3);
|
||||
new_task->status = RUN;
|
||||
new_task->uid = uid;
|
||||
new_task->esp = new_task->esp0 + STACK_SIZE;
|
||||
new_task->pid = pid++;
|
||||
|
||||
// Allocate new pd
|
||||
new_task->heap = alloc_pages(4096, (void **)&new_task->cr3);
|
||||
if (!new_task->heap) {
|
||||
vfree(new_task);
|
||||
return NULL;
|
||||
}
|
||||
new_task->heap[768] = ((uint32_t)boot_page_table1 - HEAP_END) | 0x03;
|
||||
memcpy(new_task->heap, current_task->heap, 4096);
|
||||
switch_pd(new_task->heap, new_task->cr3);
|
||||
|
||||
// Allocate new stack on the newly allocated pd
|
||||
new_task->esp0 = alloc_pages(STACK_SIZE, NULL);
|
||||
switch_pd(current_task->heap, current_task->cr3);
|
||||
if (!new_task->esp0) {
|
||||
vfree(new_task);
|
||||
free_pages(new_task->heap, 4096);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_task->next = current_task->next;
|
||||
new_task->prev = current_task;
|
||||
current_task->next = new_task;
|
||||
|
||||
new_task->signals.pending = SIG_IGN;
|
||||
|
||||
return new_task;
|
||||
}
|
||||
|
||||
int8_t create_kernel_task(void)
|
||||
{
|
||||
struct task *new_task = vmalloc(sizeof(struct task));
|
||||
if (!new_task)
|
||||
return -1;
|
||||
new_task->status = RUN;
|
||||
new_task->uid = 0;
|
||||
new_task->pid = 0;
|
||||
new_task->heap = kernel_pd;
|
||||
new_task->cr3 = (uint32_t *)((uint32_t)kernel_pd - HEAP_END);
|
||||
new_task->prev = new_task;
|
||||
new_task->next = new_task;
|
||||
new_task->signals.pending = SIG_IGN;
|
||||
current_task = new_task;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void exec_fn(void (*fn)(void))
|
||||
{
|
||||
struct task *new_task = create_task(OWNER_KERNEL);
|
||||
if (!new_task)
|
||||
kpanic("failed to create new task");
|
||||
new_task->eip = (uint32_t *)fn;
|
||||
}
|
||||
|
||||
void zombify_task(struct task *task)
|
||||
{
|
||||
cli(); // Technically useless
|
||||
free_pages(task->heap, 4096);
|
||||
free_pages(task->esp0, STACK_SIZE);
|
||||
task->esp0 = NULL;
|
||||
task->heap = NULL;
|
||||
toris();
|
||||
}
|
||||
|
||||
void remove_task(struct task *task)
|
||||
{
|
||||
cli();
|
||||
struct task *left = task->prev;
|
||||
struct task *right = task->next;
|
||||
|
||||
if (task->child) {
|
||||
remove_task(task->child);
|
||||
task->child = NULL;
|
||||
}
|
||||
if (task->heap)
|
||||
free_pages(task->heap, 4096);
|
||||
if (task->esp0)
|
||||
free_pages(task->esp0, STACK_SIZE);
|
||||
left->next = right;
|
||||
right->prev = left;
|
||||
vfree(task);
|
||||
toris();
|
||||
}
|
||||
|
||||
struct task *copy_task(const struct task *task)
|
||||
{
|
||||
struct task *new_task = create_task(task->uid);
|
||||
if (!new_task)
|
||||
return NULL;
|
||||
memcpy(new_task->esp0, task->esp0, STACK_SIZE);
|
||||
new_task->esp = new_task->esp0 + (task->esp - task->esp0);
|
||||
new_task->status = task->status;
|
||||
return new_task;
|
||||
}
|
||||
|
||||
void exit_task(void)
|
||||
{
|
||||
cli();
|
||||
if (current_task->daddy && current_task->daddy->status != WAIT)
|
||||
current_task->status = ZOMBIE;
|
||||
else {
|
||||
if (current_task->daddy->status == WAIT)
|
||||
current_task->daddy->status = RUN;
|
||||
current_task->status = STOPPED;
|
||||
}
|
||||
toris();
|
||||
scheduler();
|
||||
}
|
17
src/multitasking/wait.c
Normal file
17
src/multitasking/wait.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include "interrupts.h"
|
||||
#include "task.h"
|
||||
|
||||
uint16_t wait(void)
|
||||
{
|
||||
if (current_task->child == NULL)
|
||||
return -1;
|
||||
cli();
|
||||
if (current_task->child->status == ZOMBIE)
|
||||
current_task->child->status = STOPPED;
|
||||
else
|
||||
current_task->status = WAIT;
|
||||
uint16_t child_pid = current_task->child->pid;
|
||||
toris();
|
||||
scheduler();
|
||||
return child_pid;
|
||||
}
|
19
src/panic.s
Normal file
19
src/panic.s
Normal file
@ -0,0 +1,19 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
.section .text
|
||||
.global panic
|
||||
|
||||
panic:
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
xor edx, edx
|
||||
xor esp, esp
|
||||
xor ebp, ebp
|
||||
xor esi, esi
|
||||
xor edi, edi
|
||||
|
||||
cli
|
||||
loop:
|
||||
hlt
|
||||
jmp loop
|
19
src/shell/commands/layout_cmd.c
Normal file
19
src/shell/commands/layout_cmd.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "keyboard.h"
|
||||
#include "kprintf.h"
|
||||
#include "string.h"
|
||||
|
||||
extern char const **keymap;
|
||||
|
||||
void layout_cmd(char *arg)
|
||||
{
|
||||
if (!strcmp(arg, "us") || !strcmp(arg, "qwerty")) {
|
||||
kprintf("Successfully changed layout to us/qwerty\n");
|
||||
keymap = qwerty_keymap;
|
||||
} else if (!strcmp(arg, "fr") || !strcmp(arg, "azerty")) {
|
||||
kprintf("Successfully changed layout to fr/azerty\n");
|
||||
keymap = azerty_keymap;
|
||||
} else {
|
||||
kprintf(
|
||||
"Invalid argument: please type us|qwerty or fr|azerty\n");
|
||||
}
|
||||
}
|
@ -2,12 +2,13 @@
|
||||
|
||||
#include "alloc.h"
|
||||
#include "commands.h"
|
||||
#include "ctype.h"
|
||||
#include "font.h"
|
||||
#include "kprintf.h"
|
||||
#include "shell.h"
|
||||
#include "string.h"
|
||||
#include "terminal.h"
|
||||
#include "utils.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#define BORDER "==========================================================="
|
||||
#define HEADER "Welcome to bozOShell - Available Commands"
|
||||
@ -29,11 +30,13 @@ const struct shell_command cmds[] = {
|
||||
{"date", "Display the current time and date", date_cmd},
|
||||
{"merdella", "Surprise", merdella_cmd},
|
||||
{"color", "Change the screen color", color_cmd},
|
||||
{"layout", "Change the current layout (us or fr)", layout_cmd},
|
||||
};
|
||||
|
||||
#define NB_CMDS ARRAY_SIZE(cmds)
|
||||
|
||||
extern struct screen *screen;
|
||||
extern struct icon *terminal_bg;
|
||||
extern int line_status;
|
||||
|
||||
void help_cmd(char *arg)
|
||||
@ -55,7 +58,7 @@ void help_cmd(char *arg)
|
||||
kprintf("%s\n", BORDER);
|
||||
}
|
||||
|
||||
void auto_complete(void)
|
||||
static void auto_complete(void)
|
||||
{
|
||||
const size_t len = strlen(screen->line);
|
||||
int nb_matches = 0;
|
||||
@ -92,9 +95,7 @@ static char *get_line(void)
|
||||
if (!i)
|
||||
continue;
|
||||
buf[--i] = '\0';
|
||||
move_cursor(LEFT);
|
||||
terminal_putchar(' ');
|
||||
move_cursor(LEFT);
|
||||
terminal_remove_last_char();
|
||||
} else if (ev.scan_code == KEY_TAB && i) {
|
||||
auto_complete();
|
||||
} else if (ev.c && i < size - 1) {
|
||||
@ -110,7 +111,7 @@ static char *get_line(void)
|
||||
return screen->line;
|
||||
}
|
||||
|
||||
void shell_init()
|
||||
void shell_init(void)
|
||||
{
|
||||
while (1) {
|
||||
kprintf(PROMPT);
|
||||
|
49
src/signal/signal.c
Normal file
49
src/signal/signal.c
Normal file
@ -0,0 +1,49 @@
|
||||
#include "signal.h"
|
||||
#include "kprintf.h"
|
||||
#include "task.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void signal(SIGNAL_CODE sig_num, void *handler)
|
||||
{
|
||||
current_task->signals.handlers[sig_num] = handler;
|
||||
}
|
||||
|
||||
void kill(int pid, SIGNAL_CODE sig_num)
|
||||
{
|
||||
struct task *task = current_task;
|
||||
|
||||
while (task->pid != pid)
|
||||
task = task->next;
|
||||
|
||||
task->signals.pending = sig_num;
|
||||
}
|
||||
|
||||
static void display_signal(SIGNAL_CODE sig_num)
|
||||
{
|
||||
kprintf("signal: %d\n", sig_num);
|
||||
}
|
||||
|
||||
static void exec_signal(SIGNAL_CODE sig_num)
|
||||
{
|
||||
void *handler = current_task->signals.handlers[sig_num];
|
||||
|
||||
if (handler == SIG_IGN)
|
||||
return;
|
||||
|
||||
if (handler == SIG_DFL) {
|
||||
display_signal(sig_num);
|
||||
return;
|
||||
}
|
||||
|
||||
signal_handler_t func = handler;
|
||||
func(sig_num);
|
||||
}
|
||||
|
||||
void exec_signal_pending(void)
|
||||
{
|
||||
uint32_t signal_code = current_task->signals.pending;
|
||||
if (signal_code != SIG_IGN) {
|
||||
exec_signal(signal_code);
|
||||
current_task->signals.pending = SIG_IGN;
|
||||
}
|
||||
}
|
@ -8,5 +8,5 @@ uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
|
||||
|
||||
__attribute__((noreturn)) void __stack_chk_fail(void)
|
||||
{
|
||||
kpanic("Stack smashing detected");
|
||||
kpanic("Stack smashing detected\n");
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "sys/io.h"
|
||||
#include "terminal.h"
|
||||
|
||||
char const **keymap = qwerty_keymap;
|
||||
|
||||
struct key_event terminal_getkey(void)
|
||||
{
|
||||
static bool caps_mode = false;
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "ctype.h"
|
||||
#include "debug.h"
|
||||
#include "font.h"
|
||||
#include "fonts/eating_pasta_regular_32.h"
|
||||
#include "fonts/consolas_regular_13.h"
|
||||
// #include "icons/image.h"
|
||||
#include "kprintf.h"
|
||||
#include "shell.h"
|
||||
#include "string.h"
|
||||
@ -15,163 +17,197 @@
|
||||
static struct screen screens[TERM_COUNT];
|
||||
struct screen *screen = &screens[0];
|
||||
|
||||
static inline uint8_t vga_entry_color(vga_color fg, vga_color bg)
|
||||
{
|
||||
return fg | bg << 4;
|
||||
}
|
||||
|
||||
static inline uint16_t vga_entry(unsigned char uc, uint8_t color)
|
||||
{
|
||||
return (uint16_t)uc | (uint16_t)color << 8;
|
||||
}
|
||||
static struct font get_font_node(int c);
|
||||
static void terminal_scroll(void);
|
||||
static void terminal_new_line(void);
|
||||
|
||||
void terminal_initialize(void)
|
||||
{
|
||||
for (size_t y = 0; y < VGA_HEIGHT; y++) {
|
||||
for (size_t x = 0; x < VGA_WIDTH; x++) {
|
||||
const size_t index = y * VGA_WIDTH + x;
|
||||
TERM_BUF[index] = vga_entry(' ', VGA_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < TERM_COUNT; i++) {
|
||||
screens[i].row = 0;
|
||||
screens[i].column = 0;
|
||||
screens[i].default_color =
|
||||
vga_entry_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
|
||||
screens[i].color = screens[i].default_color;
|
||||
memcpy(screens[i].buffer, TERM_BUF, sizeof(screen->buffer));
|
||||
screens[i].default_color = 0xffffff;
|
||||
screens[i].fg_color = screens[i].default_color;
|
||||
// screens[i].background = &image_icon;
|
||||
screens[i].font = consolas_regular_13_font;
|
||||
memset(screens[i].line, 0, sizeof(screen->line));
|
||||
}
|
||||
}
|
||||
|
||||
void terminal_remove_last_char(void)
|
||||
{
|
||||
if (screen->column)
|
||||
screen->column--;
|
||||
else if (screen->row) {
|
||||
screen->column = VGA_WIDTH - 1;
|
||||
screen->row--;
|
||||
}
|
||||
uint32_t pos_x = (screen->column) * FONT_WIDTH;
|
||||
uint32_t pos_y = screen->row * FONT_HEIGHT;
|
||||
|
||||
struct font node = get_font_node(
|
||||
screen->buffer[screen->row * VGA_WIDTH + screen->column]);
|
||||
screen->buffer[screen->row * VGA_WIDTH + screen->column] = '\0';
|
||||
for (uint32_t y = 0; y < node.height; y++) {
|
||||
for (uint32_t x = 0; x < node.width; x++) {
|
||||
// Current bg is taking too much memory
|
||||
// so we do a black bg for now
|
||||
// struct icon *bg = screen->background;
|
||||
// uint32_t pixel = 0;
|
||||
// if (bg->width > pos_x + x && bg->height > pos_y + y)
|
||||
// pixel = bg->pixels[(pos_y + y) * bg->width +
|
||||
// (pos_x + x)];
|
||||
put_pixel(0, pos_x + x, pos_y + y + node.yoffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void terminal_set_screen(int pos)
|
||||
{
|
||||
memcpy(screen->buffer, TERM_BUF, sizeof(screen->buffer));
|
||||
screen = &screens[pos];
|
||||
memcpy(TERM_BUF, screen->buffer, sizeof(screen->buffer));
|
||||
update_cursor();
|
||||
if (TERM_BUF[0] == vga_entry(' ', VGA_COLOR_WHITE))
|
||||
kprintf(PROMPT);
|
||||
// TODO
|
||||
/* memcpy(screen->buffer, TERM_BUF, sizeof(screen->buffer)); */
|
||||
/* screen = &screens[pos]; */
|
||||
/* memcpy(TERM_BUF, screen->buffer, sizeof(screen->buffer)); */
|
||||
/* update_cursor(); */
|
||||
/* if (TERM_BUF[0] == vga_entry(' ', VGA_COLOR_WHITE)) */
|
||||
/* kprintf(PROMPT); */
|
||||
}
|
||||
|
||||
void terminal_set_bg_color(uint8_t bg_color)
|
||||
void terminal_set_bg_color(uint32_t bg_color)
|
||||
{
|
||||
screen->color = bg_color << 4 | (screen->color & 0x0F);
|
||||
screen->bg_color = bg_color;
|
||||
}
|
||||
|
||||
void terminal_set_fg_color(uint8_t fg_color)
|
||||
void terminal_set_fg_color(uint32_t fg_color)
|
||||
{
|
||||
screen->color = (screen->color & 0xF0) | fg_color;
|
||||
screen->fg_color = screen->fg_color;
|
||||
}
|
||||
|
||||
void terminal_set_color(uint8_t color)
|
||||
void terminal_set_color(uint32_t fg_color, uint32_t bg_color)
|
||||
{
|
||||
screen->color = color;
|
||||
screen->fg_color = fg_color;
|
||||
screen->bg_color = bg_color;
|
||||
}
|
||||
|
||||
void terminal_set_default_fg_color(uint8_t fg_color)
|
||||
void terminal_set_default_fg_color(uint32_t fg_color)
|
||||
{
|
||||
screen->default_color = (screen->default_color & 0xF0) | fg_color;
|
||||
screen->default_color = fg_color;
|
||||
}
|
||||
|
||||
void terminal_set_default_bg_color(uint8_t bg_color)
|
||||
{
|
||||
screen->default_color = bg_color << 4 | (screen->default_color & 0x0F);
|
||||
}
|
||||
|
||||
uint8_t terminal_get_default_color(void)
|
||||
uint32_t terminal_get_default_color(void)
|
||||
{
|
||||
return screen->default_color;
|
||||
}
|
||||
|
||||
uint8_t terminal_get_char(int column, int row)
|
||||
uint8_t terminal_get_char(int x, int y)
|
||||
{
|
||||
return screen->buffer[row * VGA_WIDTH + column];
|
||||
return screen->buffer[y * VGA_WIDTH + x];
|
||||
}
|
||||
|
||||
void terminal_putentryat(char c, uint32_t color, size_t x, size_t y)
|
||||
void terminal_putentryat(struct font node, uint32_t fg_color, uint32_t bg_color,
|
||||
size_t x, size_t y)
|
||||
{
|
||||
struct font node = eating_pasta_regular_32_font[(int)c];
|
||||
char *glyph = node.bitmap;
|
||||
for (size_t cy = 0; cy < node.height; cy++)
|
||||
for (size_t cx = 0; cx < node.width; cx++)
|
||||
if (glyph[cy + node.width + cx] == '#')
|
||||
put_pixel(color, x + cx, y + cy);
|
||||
/* const size_t index = y * VGA_WIDTH + x; */
|
||||
/* TERM_BUF[index] = vga_entry(c, color); */
|
||||
for (size_t cy = 0; cy < node.height; cy++) {
|
||||
for (size_t cx = 0; cx < node.width; cx++) {
|
||||
if (glyph[cy * node.width + cx] == '#')
|
||||
put_pixel(fg_color, x + cx,
|
||||
y + cy + node.yoffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct font get_font_node(int c)
|
||||
{
|
||||
return screen->font[c];
|
||||
}
|
||||
|
||||
static void terminal_scroll(void)
|
||||
{
|
||||
screen->row--;
|
||||
for (size_t i = 0; i < VGA_WIDTH * (VGA_HEIGHT - 1); i++)
|
||||
TERM_BUF[i] = TERM_BUF[i + VGA_WIDTH];
|
||||
for (size_t i = 0; i < VGA_WIDTH; i++)
|
||||
terminal_putentryat(' ', VGA_COLOR_WHITE, i, VGA_HEIGHT - 1);
|
||||
memset(display.buff, 0, display.height * display.pitch);
|
||||
for (size_t i = 0; i < VGA_WIDTH * (VGA_HEIGHT - 1); i++) {
|
||||
const uint32_t x = (i % VGA_WIDTH) * FONT_WIDTH;
|
||||
const uint32_t y = (i / VGA_WIDTH) * FONT_HEIGHT;
|
||||
screen->buffer[i] = screen->buffer[i + VGA_WIDTH];
|
||||
terminal_putentryat(get_font_node(screen->buffer[i]),
|
||||
screen->fg_color, screen->bg_color, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void terminal_new_line(void)
|
||||
{
|
||||
screen->column = 0;
|
||||
if (++screen->row == VGA_HEIGHT)
|
||||
if (++screen->row >= VGA_HEIGHT - 1)
|
||||
terminal_scroll();
|
||||
}
|
||||
|
||||
static uint8_t get_entry_color(uint16_t vga_entry)
|
||||
void terminal_change_default_color(uint32_t color)
|
||||
{
|
||||
return vga_entry >> 8;
|
||||
// TODO
|
||||
/* terminal_set_color(color); */
|
||||
/* for (size_t y = 0; y < VGA_HEIGHT; y++) { */
|
||||
/* for (size_t x = 0; x < VGA_WIDTH; x++) { */
|
||||
/* const size_t index = y * VGA_WIDTH + x;
|
||||
*/
|
||||
/* uint8_t entry_color =
|
||||
* get_entry_color(TERM_BUF[index]);
|
||||
*/
|
||||
/* TERM_BUF[index] = vga_entry( */
|
||||
/* TERM_BUF[index], */
|
||||
/* entry_color == screen->default_color
|
||||
* ? color
|
||||
*/
|
||||
/* :
|
||||
* entry_color);
|
||||
*/
|
||||
/* } */
|
||||
/* } */
|
||||
/* memcpy(screen->buffer, TERM_BUF,
|
||||
* sizeof(screen->buffer)); */
|
||||
/* screen->default_color = color; */
|
||||
/* screen->color = color; */
|
||||
}
|
||||
|
||||
void terminal_change_default_color(uint8_t color)
|
||||
{
|
||||
terminal_set_color(color);
|
||||
for (size_t y = 0; y < VGA_HEIGHT; y++) {
|
||||
for (size_t x = 0; x < VGA_WIDTH; x++) {
|
||||
const size_t index = y * VGA_WIDTH + x;
|
||||
uint8_t entry_color = get_entry_color(TERM_BUF[index]);
|
||||
TERM_BUF[index] = vga_entry(
|
||||
TERM_BUF[index],
|
||||
entry_color == screen->default_color ? color
|
||||
: entry_color);
|
||||
}
|
||||
}
|
||||
memcpy(screen->buffer, TERM_BUF, sizeof(screen->buffer));
|
||||
screen->default_color = color;
|
||||
screen->color = color;
|
||||
}
|
||||
|
||||
void terminal_change_default_fg_color(uint8_t fg_color)
|
||||
void terminal_change_default_fg_color(uint32_t fg_color)
|
||||
{
|
||||
terminal_set_fg_color(fg_color);
|
||||
terminal_change_default_color(screen->color);
|
||||
/* terminal_change_default_color(screen->fg_color); */
|
||||
}
|
||||
|
||||
void terminal_clear(void)
|
||||
{
|
||||
for (size_t y = 0; y < VGA_HEIGHT; y++) {
|
||||
for (size_t x = 0; x < VGA_WIDTH; x++) {
|
||||
const size_t index = y * VGA_WIDTH + x;
|
||||
TERM_BUF[index] = vga_entry(' ', screen->color);
|
||||
}
|
||||
}
|
||||
memcpy(screen->buffer, TERM_BUF, sizeof(screen->buffer));
|
||||
screen->column = 0;
|
||||
screen->row = 0;
|
||||
// TODO
|
||||
/* for (size_t y = 0; y < VGA_HEIGHT; y++) { */
|
||||
/* for (size_t x = 0; x < VGA_WIDTH; x++) { */
|
||||
/* const size_t index = y * VGA_WIDTH + x;
|
||||
*/
|
||||
/* TERM_BUF[index] = vga_entry(' ',
|
||||
* screen->color);
|
||||
*/
|
||||
/* } */
|
||||
/* } */
|
||||
/* memcpy(screen->buffer, TERM_BUF,
|
||||
* sizeof(screen->buffer)); */
|
||||
/* screen->column = 0; */
|
||||
/* screen->row = 0; */
|
||||
}
|
||||
|
||||
int terminal_putchar(char c)
|
||||
{
|
||||
terminal_putentryat(c, 0xCCFFE5, 10, 10);
|
||||
/* if (c == '\r') */
|
||||
/* screen->column = 0; */
|
||||
/* else if (c == '\n') */
|
||||
/* terminal_new_line(); */
|
||||
/* if (!isprint(c)) */
|
||||
/* return 1; */
|
||||
/* terminal_putentryat(c, screen->color, screen->column, screen->row);
|
||||
*/
|
||||
/* if (++screen->column == VGA_WIDTH) */
|
||||
/* terminal_new_line(); */
|
||||
/* return 1; */
|
||||
if (c == '\r')
|
||||
screen->column = 0;
|
||||
else if (c == '\n')
|
||||
terminal_new_line();
|
||||
if (!isprint(c))
|
||||
return 1;
|
||||
screen->buffer[screen->column + screen->row * VGA_WIDTH] = c;
|
||||
terminal_putentryat(get_font_node(c), screen->fg_color,
|
||||
screen->bg_color, screen->column * FONT_WIDTH,
|
||||
screen->row * FONT_HEIGHT);
|
||||
if (++screen->column >= VGA_WIDTH)
|
||||
terminal_new_line();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int terminal_write(const char *data, size_t size)
|
||||
@ -191,12 +227,13 @@ int terminal_writestring(const char *data)
|
||||
|
||||
void update_cursor(void)
|
||||
{
|
||||
uint16_t pos = screen->row * VGA_WIDTH + screen->column;
|
||||
/* uint16_t pos = screen->row * VGA_WIDTH +
|
||||
* screen->column; */
|
||||
|
||||
outb(0x3D4, 0x0F);
|
||||
outb(0x3D5, pos & 0xFF);
|
||||
outb(0x3D4, 0x0E);
|
||||
outb(0x3D5, (pos >> 8) & 0xFF);
|
||||
/* outb(0x3D4, 0x0F); */
|
||||
/* outb(0x3D5, pos & 0xFF); */
|
||||
/* outb(0x3D4, 0x0E); */
|
||||
/* outb(0x3D5, (pos >> 8) & 0xFF); */
|
||||
}
|
||||
|
||||
void move_cursor(int direction)
|
||||
@ -237,10 +274,11 @@ void set_color_level(int level)
|
||||
VGA_COLOR_RED, VGA_COLOR_MAGENTA,
|
||||
VGA_COLOR_LIGHT_YELLOW, VGA_COLOR_LIGHT_YELLOW,
|
||||
VGA_COLOR_LIGHT_BLUE, VGA_COLOR_GREEN,
|
||||
VGA_COLOR_LIGHT_GREY};
|
||||
VGA_COLOR_LIGHT_GREY,
|
||||
};
|
||||
|
||||
if (level == 0) {
|
||||
terminal_set_color(screen->default_color);
|
||||
terminal_set_color(screen->default_color, 0);
|
||||
return;
|
||||
}
|
||||
terminal_set_fg_color(color_translation[level]);
|
||||
|
@ -13,7 +13,8 @@ with open(sys.argv[1]) as f:
|
||||
font_name: str = os.path.basename(sys.argv[1]).split(".")[0]
|
||||
|
||||
img_file_relative_path: str = re.findall(r"file=\"(\w+[^\"]+)\"", fnt_data)[0]
|
||||
img_file_absolute_path: str = sys.argv[1][0:sys.argv[1].rfind("/") + 1] + img_file_relative_path
|
||||
img_file_absolute_path: str = sys.argv[1][0:sys.argv[1].rfind("/") +
|
||||
1] + img_file_relative_path
|
||||
|
||||
image = Image.open(img_file_absolute_path)
|
||||
|
||||
@ -23,19 +24,24 @@ pixels = [pixels[i * width:(i + 1) * width] for i in range(height)]
|
||||
|
||||
characteres: list[list[int]] = [None for i in range(128)]
|
||||
|
||||
for id, x, y, width, height, xoffset, yoffset, xadvance in re.findall(r"id=(\d+) x=(\d+) y=(\d+) width=(\d+) height=(\d+) xoffset=(-?\d+) yoffset=(-?\d+) xadvance=(\d+)", fnt_data):
|
||||
id, x, y, width, height, xoffset, yoffset, xadvance = int(id), int(x), int(y), int(width), int(height), int(xoffset), int(yoffset), int(xadvance)
|
||||
for id, x, y, width, height, xoffset, yoffset, xadvance in re.findall(
|
||||
r"id=(\d+) x=(\d+) y=(\d+) width=(\d+) height=(\d+) xoffset=(-?\d+) yoffset=(-?\d+) xadvance=(\d+)",
|
||||
fnt_data):
|
||||
id, x, y, width, height, xoffset, yoffset, xadvance = int(id), int(x), int(
|
||||
y), int(width), int(height), int(xoffset), int(yoffset), int(xadvance)
|
||||
bitmap: list[str] = []
|
||||
for line in pixels[y:y + height]:
|
||||
tmp: str = ""
|
||||
for r, g, b, a in line[x:x + width]:
|
||||
tmp += "#" if a else " "
|
||||
bitmap.append(tmp)
|
||||
characteres[id] = [height, width, bitmap]
|
||||
characteres[id] = [height, width, yoffset, bitmap]
|
||||
|
||||
string: str = f"""\
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "font.h"
|
||||
|
||||
struct font {font_name}_font[] = {{\\\
|
||||
@ -43,11 +49,12 @@ struct font {font_name}_font[] = {{\\\
|
||||
|
||||
for charactere in characteres:
|
||||
if (charactere is not None):
|
||||
height, width, bitmap = charactere
|
||||
height, width, yoffset, bitmap = charactere
|
||||
string += f"""
|
||||
{{
|
||||
.width = {width},
|
||||
.height = {height},
|
||||
.yoffset = {yoffset},
|
||||
.bitmap = "{"".join(bitmap)}",
|
||||
}},\
|
||||
"""
|
||||
@ -56,10 +63,11 @@ for charactere in characteres:
|
||||
{{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
}},\
|
||||
"""
|
||||
string += "\n}};"
|
||||
string += "\n};"
|
||||
|
||||
if not os.path.exists("./headers/fonts"):
|
||||
os.makedirs("./headers/fonts")
|
||||
|
37
tools/icon_maker.py
Normal file
37
tools/icon_maker.py
Normal file
@ -0,0 +1,37 @@
|
||||
from PIL import Image
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
if (len(sys.argv) < 2):
|
||||
print("Error: usage python icon_maker.py {img}")
|
||||
|
||||
image = Image.open(sys.argv[1])
|
||||
|
||||
width, height = image.size
|
||||
pixels = list(image.getdata())
|
||||
pixels = [r << 16 | g << 8 | b for r, g, b in pixels]
|
||||
|
||||
string = str(pixels).replace("(", "{").replace(")", "}").replace("[", "{").replace("]", "}")
|
||||
|
||||
filename: str = os.path.basename(sys.argv[1]).split(".")[0]
|
||||
|
||||
string = f"""\
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "icon.h"
|
||||
|
||||
uint32_t {filename}_color_map[{width} * {height}] = {string};
|
||||
|
||||
struct icon {filename}_icon = {{
|
||||
.height = {height},
|
||||
.width = {width},
|
||||
.pixels = {filename}_color_map
|
||||
}};
|
||||
|
||||
"""
|
||||
|
||||
with open(f"./headers/icons/{filename}.h", "w") as f:
|
||||
f.write(string)
|
Reference in New Issue
Block a user