Compare commits
108 Commits
5fba376e2f
...
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 | |||
33cb3dfa30 | |||
e5bdd1b5ee | |||
bd080a0f9e | |||
570b848625 | |||
c6e2d52831 | |||
0348e04436 | |||
d6a59da6d1 | |||
d39f708a51 | |||
bedbca1154 | |||
738b285e62 | |||
daf510687a | |||
2a281522cf | |||
30d22b3334 | |||
88bf5e7960 | |||
fb1a1bc213 | |||
4bd4198293 | |||
f626edd0f0 | |||
1352201800 | |||
dc12949329 | |||
295c513f2d | |||
9944f79b2e | |||
773f55466e | |||
8203b36092 | |||
da804296c6 | |||
0c280d971b | |||
94b2fa340c | |||
ec3a038a36 | |||
3bc05604db | |||
b7dd7761d5 | |||
3315d85e0c | |||
e8fd6c55eb | |||
d8d31d959f | |||
20ba985b34 | |||
09ea386b21 | |||
1e35f3b710 | |||
11ef629a3a | |||
719c615c92 | |||
3c87632b0c | |||
5fccbf3708 | |||
a72c3ca195 | |||
6533334824 | |||
ae3cfa7647 | |||
04211e2773 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ obj
|
||||
.*
|
||||
compile_commands.json
|
||||
tags
|
||||
base_fonts
|
||||
*.log
|
||||
|
30
Makefile
30
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 -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
|
||||
@ -31,7 +31,7 @@ $(NAME): $(OBJ)
|
||||
$(LD) $(LDFLAGS) -o build/$(NAME).bin $(OBJ) $(LIBS)
|
||||
|
||||
run: $(NAME)
|
||||
qemu-system-i386 -kernel build/$(NAME).bin
|
||||
qemu-system-i386 -kernel build/$(NAME).bin -vga std
|
||||
|
||||
iso: $(NAME)
|
||||
mkdir -p isodir/boot/grub
|
||||
@ -40,11 +40,21 @@ iso: $(NAME)
|
||||
grub-mkrescue -o build/$(NAME).iso --compress=xz --locales=en@quot --themes= isodir
|
||||
rm -rf isodir
|
||||
|
||||
run-iso: iso
|
||||
qemu-system-i386 -cdrom build/$(NAME).iso
|
||||
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
|
||||
|
||||
debug: iso
|
||||
qemu-system-i386 -s -S build/$(NAME).iso
|
||||
run-iso: iso
|
||||
qemu-system-i386 -cdrom 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
|
||||
@ -55,7 +65,9 @@ fclean: clean
|
||||
make -C libbozo fclean
|
||||
rm -rf build
|
||||
|
||||
re: fclean all
|
||||
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)
|
||||
|
72
README.md
72
README.md
@ -2,68 +2,10 @@
|
||||
|
||||
This project aims to explore how a kernel works by building our own, gaining hands-on experience with core concepts like memory management, interrupt, keyboard driver, etc
|
||||
|
||||
## INSTALLATION
|
||||
|
||||
### Cross compile the compile
|
||||
[THE DOCUMENTATION](https://wiki.osdev.org/GCC_Cross-Compiler)
|
||||
- install requirement follow [THE DOCUMENTATION](https://wiki.osdev.org/GCC_Cross-Compiler)
|
||||
- Setup the shell
|
||||
``` sh
|
||||
export PREFIX="$HOME/opt/cross"
|
||||
export TARGET=i386-elf
|
||||
export PATH="$PREFIX/bin:$PATH"
|
||||
mkdir $HOME/src
|
||||
cd $HOME/src
|
||||
```
|
||||
- Download [binutils](https://ftp.gnu.org/gnu/binutils/?C=M;O=D)
|
||||
- Download [gcc](https://ftp.gnu.org/gnu/gcc/?C=M;O=D)
|
||||
- Download [gdb](https://ftp.gnu.org/gnu/gdb/?C=M;O=D)
|
||||
- extract archives
|
||||
``` sh
|
||||
tar xf [your binutils archive]
|
||||
tar xf [your gcc archive]
|
||||
tar xf [your gdb archive]
|
||||
```
|
||||
- (protips use -j [nb core])
|
||||
- Compile binutils
|
||||
``` sh
|
||||
cd $HOME/src
|
||||
mkdir build-binutils
|
||||
|
||||
cd build-binutils
|
||||
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
||||
make
|
||||
make install
|
||||
```
|
||||
- Compile gdb
|
||||
``` sh
|
||||
cd $HOME/src
|
||||
mkdir build-gdb
|
||||
|
||||
cd build-gdb
|
||||
../gdb.x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-werror
|
||||
make all-gdb
|
||||
make install-gdb
|
||||
make
|
||||
make install
|
||||
```
|
||||
- Compile gcc
|
||||
``` sh
|
||||
cd $HOME/src
|
||||
|
||||
# The $PREFIX/bin dir _must_ be in the PATH. We did that above.
|
||||
which -- $TARGET-as || echo $TARGET-as is not in the PATH
|
||||
|
||||
mkdir build-gcc
|
||||
cd build-gcc
|
||||
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
|
||||
make all-gcc
|
||||
make all-target-libgcc
|
||||
make install-gcc
|
||||
make install-target-libgcc
|
||||
```
|
||||
|
||||
### Compile and the start the kernel
|
||||
``` sh
|
||||
make run
|
||||
```
|
||||
## Currently supported
|
||||
- screen driver
|
||||
- keyboard driver
|
||||
- [memory pagination](./documentation/memory.md)
|
||||
- interruption
|
||||
- power management (reboot, halt, shutdown)
|
||||
- simple shell
|
@ -1,3 +1,6 @@
|
||||
menuentry "bozos" {
|
||||
multiboot /boot/bozOS.bin
|
||||
set gfxmode=1024x768x32
|
||||
set gfxpayload=keep
|
||||
menuentry "bozOS" {
|
||||
multiboot /boot/bozOS.bin
|
||||
boot
|
||||
}
|
BIN
documentation/assets/memory/heap_map.webp
Normal file
BIN
documentation/assets/memory/heap_map.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
73
documentation/installation.md
Normal file
73
documentation/installation.md
Normal file
@ -0,0 +1,73 @@
|
||||
# INSTALLATION
|
||||
|
||||
## Cross compile the compile
|
||||
|
||||
### WHY ??
|
||||
Why cross compile the gcc ?
|
||||
|
||||
We must cross compile gcc cause our kernel is developped for i386 cpu but your current cpu is probally not an i386 so we need to create an i386 compiler
|
||||
|
||||
### HOW ?
|
||||
|
||||
[THE DOCUMENTATION](https://wiki.osdev.org/GCC_Cross-Compiler)
|
||||
- install requirement follow [THE DOCUMENTATION](https://wiki.osdev.org/GCC_Cross-Compiler)
|
||||
- Setup the shell
|
||||
``` sh
|
||||
export PREFIX="$HOME/opt/cross"
|
||||
export TARGET=i386-elf
|
||||
export PATH="$PREFIX/bin:$PATH"
|
||||
mkdir $HOME/src
|
||||
cd $HOME/src
|
||||
```
|
||||
- Download [binutils](https://ftp.gnu.org/gnu/binutils/?C=M;O=D)
|
||||
- Download [gcc](https://ftp.gnu.org/gnu/gcc/?C=M;O=D)
|
||||
- Download [gdb](https://ftp.gnu.org/gnu/gdb/?C=M;O=D)
|
||||
- extract archives
|
||||
``` sh
|
||||
tar xf [your binutils archive]
|
||||
tar xf [your gcc archive]
|
||||
tar xf [your gdb archive]
|
||||
```
|
||||
- (protips use -j [nb core])
|
||||
- Compile binutils
|
||||
``` sh
|
||||
cd $HOME/src
|
||||
mkdir build-binutils
|
||||
|
||||
cd build-binutils
|
||||
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
||||
make
|
||||
make install
|
||||
```
|
||||
- Compile gdb
|
||||
``` sh
|
||||
cd $HOME/src
|
||||
mkdir build-gdb
|
||||
|
||||
cd build-gdb
|
||||
../gdb.x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-werror
|
||||
make all-gdb
|
||||
make install-gdb
|
||||
make
|
||||
make install
|
||||
```
|
||||
- Compile gcc
|
||||
``` sh
|
||||
cd $HOME/src
|
||||
|
||||
# The $PREFIX/bin dir _must_ be in the PATH. We did that above.
|
||||
which -- $TARGET-as || echo $TARGET-as is not in the PATH
|
||||
|
||||
mkdir build-gcc
|
||||
cd build-gcc
|
||||
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
|
||||
make all-gcc
|
||||
make all-target-libgcc
|
||||
make install-gcc
|
||||
make install-target-libgcc
|
||||
```
|
||||
|
||||
## Compile and the start the kernel
|
||||
``` sh
|
||||
make run
|
||||
```
|
10
documentation/memory.md
Normal file
10
documentation/memory.md
Normal file
@ -0,0 +1,10 @@
|
||||
# MEMOMY
|
||||
|
||||
## Pagination
|
||||
|
||||
To activate pagination you must put the physic [pd](./memory/page_directory.md) address in the cr3 register and 0x80000000 in the cr0 register. Now the [MMU](./memory/mmu.md) will translate your address
|
||||
|
||||
### Our setup
|
||||
|
||||
Cause create all [pt](./memory/page_table.md) will cost 3MB (768 * 1024 * 4, 768: cause is our heap limite, 1024: cause each pt contains 1024 entry and 4: cause size of pte is 4byte) we decided to create it on the heap and dynamically. So the first pt of the pd (pd[0]) will contain a default_page_table (or heap_pt). Each page create by each the heap_pt will be a pt added to the pd.
|
||||

|
3
documentation/memory/frame.md
Normal file
3
documentation/memory/frame.md
Normal file
@ -0,0 +1,3 @@
|
||||
# FRAME
|
||||
|
||||
Like [page](./page.md) but in physical memory space
|
19
documentation/memory/mmu.md
Normal file
19
documentation/memory/mmu.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Memory Management Unit (MMU)
|
||||
The MMU is a chip which translate virtual memory to physical memory. When you try to access to an address (/!\ only when you try to access) the MMU will get the physical address from the [pd](./page_directory.md).
|
||||
|
||||
## How translate an address ?
|
||||
The address will be divid in 3 parts:
|
||||
- Page Directory index (10bit (cause 1024))
|
||||
- Page Table index (10bit (cause 1024 too))
|
||||
- offset (12bit cause page size = 4096)
|
||||
|
||||
### Example
|
||||
|
||||
**address**: 0b000100000011101011111011101101
|
||||
|
||||
| Base | PD index | PT index | offset |
|
||||
|--------|----------|------------|--------------|
|
||||
| Binary | 00010000 | 0011101011 | 111011101101 |
|
||||
| Decimal| 16 | 235 | 3821 |
|
||||
|
||||
So to translate this address the MMU will get the 20 first bit of the value store at the 235th PTE of the 16th PDE and will replace the 20 first bit of the virtually address.
|
3
documentation/memory/page.md
Normal file
3
documentation/memory/page.md
Normal file
@ -0,0 +1,3 @@
|
||||
# PAGE
|
||||
|
||||
A page is a memory space with with a specific size (default 4096byte).
|
7
documentation/memory/page_directory.md
Normal file
7
documentation/memory/page_directory.md
Normal file
@ -0,0 +1,7 @@
|
||||
# PAGE DIRECTORY
|
||||
|
||||
The page directory (or pd) is
|
||||
|
||||
|
||||
## Indexed Size
|
||||
A PD can store 1024 PT, each PT index 1024 * 4096Byte = 4MB of address, so a PD can index 1024 * 4MB = 4GB.
|
12
documentation/memory/page_table.md
Normal file
12
documentation/memory/page_table.md
Normal file
@ -0,0 +1,12 @@
|
||||
# PAGE TABLE
|
||||
|
||||
A page table (or PT) is an 1024 array of 32bit value(Page Table Entry (or PTE)). The address of the PT is store in the [PD](./page_directory.md).
|
||||
|
||||
## Page Table Entry (PTE)
|
||||
The value is a 20 first bits of the [frame](./frame.md) address and the 12 last bit is for the flag.
|
||||
|
||||
### Not used PTE value
|
||||
To say to the [MMU](./mmu.md) the page is currently not attribued to a frame you should put the (PTE index << 12)
|
||||
|
||||
## Indexed Size
|
||||
Cause our kernel use 4096byte page and a PT can store 1024 value, each PT index 1024 * 4096Byte = 4MB of address.
|
@ -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 *kzones[3];
|
||||
extern Zone *vzones[3];
|
||||
extern Zone *kzones[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);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define BASE_BIN "01"
|
||||
#define BASE_BIN "01"
|
||||
#define BASE_OCTA BASE_BIN "234567"
|
||||
#define BASE_DECA BASE_OCTA "89"
|
||||
#define BASE_HEXA BASE_DECA "abcdef"
|
@ -6,7 +6,8 @@ void date_cmd(char *arg);
|
||||
void poweroff_cmd(char *arg);
|
||||
void stack_cmd(char *arg);
|
||||
void help_cmd(char *arg);
|
||||
void reboot_cmd(char* arg);
|
||||
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);
|
||||
|
10
headers/font.h
Normal file
10
headers/font.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
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,
|
||||
},
|
||||
};
|
1731
headers/fonts/eating_pasta_regular_32.h
Normal file
1731
headers/fonts/eating_pasta_regular_32.h
Normal file
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
|
||||
|
9
headers/icon.h
Normal file
9
headers/icon.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct icon {
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t *pixels;
|
||||
};
|
57864
headers/icons/image.h
Normal file
57864
headers/icons/image.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -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,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void kpanic(const char *format, ...);
|
||||
__attribute__((noreturn)) void kpanic(const char *format, ...);
|
||||
|
@ -1,34 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include "multiboot.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRESENT (1 << 0)
|
||||
#define RW (1 << 1)
|
||||
#define SUPERVISOR (0 << 2)
|
||||
#define ACCESSED (1 << 4)
|
||||
#define INIT_FLAGS (PRESENT | RW | SUPERVISOR)
|
||||
#define PAGE_SIZE 4096
|
||||
#define PT_SIZE 1024
|
||||
#define PD_SIZE 1024
|
||||
#define PAGE_MASK 0xFFFFF000
|
||||
#define HEAP_END 0xC0000000
|
||||
#define HEAP_START ((uint32_t) & _kernel_end - HEAP_END)
|
||||
#define PT_START 256
|
||||
#define PRESENT (1 << 0)
|
||||
#define RW (1 << 1)
|
||||
#define SUPERVISOR (0 << 2)
|
||||
#define ACCESSED (1 << 4)
|
||||
#define INIT_FLAGS (PRESENT | RW | SUPERVISOR)
|
||||
#define PAGE_SIZE 4096
|
||||
#define PT_SIZE 1024
|
||||
#define PD_SIZE 1024
|
||||
#define PAGE_MASK 0xFFFFF000
|
||||
#define HEAP_END 0xC0000000
|
||||
#define HEAP_START ((uint32_t)&_kernel_end - HEAP_END)
|
||||
#define KERNEL_START ((uint32_t)&_kernel_start)
|
||||
#define KERNEL_END ((uint32_t)&_kernel_end - HEAP_END)
|
||||
#define PT_START 256
|
||||
|
||||
#define GET_PAGE_ADDR(pd_index, pt_index) \
|
||||
(((pd_index * 1024) + pt_index) * 4096)
|
||||
((((uint32_t)pd_index * 1024) + (uint32_t)pt_index) * 4096)
|
||||
|
||||
#define GET_FRAME(frame_table, i) (frame_table[i / 8] & (1 << (i % 8)))
|
||||
#define SET_FRAME(frame_table, i, used) \
|
||||
do { \
|
||||
if (used) \
|
||||
frame_table[i / 8] |= (1 << (i % 8)); \
|
||||
else \
|
||||
frame_table[i / 8] &= ~(1 << (i % 8)); \
|
||||
} while (0)
|
||||
|
||||
struct frame_zone {
|
||||
void *addr;
|
||||
uint32_t first_free_frame;
|
||||
uint8_t *frame_table;
|
||||
uint32_t total_frames;
|
||||
uint32_t remaining_frames;
|
||||
struct frame_zone *next;
|
||||
};
|
||||
|
||||
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;
|
||||
extern multiboot_uint32_t mmap_length;
|
||||
extern struct frame_zone *head;
|
||||
|
||||
uint32_t *virt_to_phys(uint32_t *virt_addr);
|
||||
void init_memory(void);
|
||||
void *alloc_frames(size_t size);
|
||||
int free_frames(void *frame_ptr, size_t size);
|
||||
void *alloc_pages(size_t size);
|
||||
void init_memory(multiboot_info_t *mbd, uint32_t magic);
|
||||
void *alloc_frame(void);
|
||||
int free_frame(void *frame_ptr);
|
||||
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);
|
||||
|
268
headers/multiboot.h
Normal file
268
headers/multiboot.h
Normal file
@ -0,0 +1,268 @@
|
||||
/* multiboot.h - Multiboot header file. */
|
||||
/* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY
|
||||
* DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
// https://imgflip.com/i/9cflls
|
||||
|
||||
#pragma once
|
||||
|
||||
/* How many bytes from the start of the file we search for the header. */
|
||||
#define MULTIBOOT_SEARCH 8192
|
||||
#define MULTIBOOT_HEADER_ALIGN 4
|
||||
|
||||
/* The magic field should contain this. */
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
|
||||
/* This should be in %eax. */
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
|
||||
/* Alignment of multiboot modules. */
|
||||
#define MULTIBOOT_MOD_ALIGN 0x00001000
|
||||
|
||||
/* Alignment of the multiboot info structure. */
|
||||
#define MULTIBOOT_INFO_ALIGN 0x00000004
|
||||
|
||||
/* Flags set in the ’flags’ member of the multiboot header. */
|
||||
|
||||
/* Align all boot modules on i386 page (4KB) boundaries. */
|
||||
#define MULTIBOOT_PAGE_ALIGN 0x00000001
|
||||
|
||||
/* Must pass memory information to OS. */
|
||||
#define MULTIBOOT_MEMORY_INFO 0x00000002
|
||||
|
||||
/* Must pass video information to OS. */
|
||||
#define MULTIBOOT_VIDEO_MODE 0x00000004
|
||||
|
||||
/* This flag indicates the use of the address fields in the header. */
|
||||
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
|
||||
|
||||
/* Flags to be set in the ’flags’ member of the multiboot info structure. */
|
||||
|
||||
/* is there basic lower/upper memory information? */
|
||||
#define MULTIBOOT_INFO_MEMORY 0x00000001
|
||||
/* is there a boot device set? */
|
||||
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
|
||||
/* is the command-line defined? */
|
||||
#define MULTIBOOT_INFO_CMDLINE 0x00000004
|
||||
/* are there modules to do something with? */
|
||||
#define MULTIBOOT_INFO_MODS 0x00000008
|
||||
|
||||
/* These next two are mutually exclusive */
|
||||
|
||||
/* is there a symbol table loaded? */
|
||||
#define MULTIBOOT_INFO_AOUT_SYMS 0x00000010
|
||||
/* is there an ELF section header table? */
|
||||
#define MULTIBOOT_INFO_ELF_SHDR 0X00000020
|
||||
|
||||
/* is there a full memory map? */
|
||||
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
|
||||
|
||||
/* Is there drive info? */
|
||||
#define MULTIBOOT_INFO_DRIVE_INFO 0x00000080
|
||||
|
||||
/* Is there a config table? */
|
||||
#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
|
||||
|
||||
/* Is there a boot loader name? */
|
||||
#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
|
||||
|
||||
/* Is there a APM table? */
|
||||
#define MULTIBOOT_INFO_APM_TABLE 0x00000400
|
||||
|
||||
/* Is there video information? */
|
||||
#define MULTIBOOT_INFO_VBE_INFO 0x00000800
|
||||
#define MULTIBOOT_INFO_FRAMEBUFFER_INFO 0x00001000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef unsigned char multiboot_uint8_t;
|
||||
typedef unsigned short multiboot_uint16_t;
|
||||
typedef unsigned int multiboot_uint32_t;
|
||||
typedef unsigned long long multiboot_uint64_t;
|
||||
|
||||
struct multiboot_header {
|
||||
/* Must be MULTIBOOT_MAGIC - see above. */
|
||||
multiboot_uint32_t magic;
|
||||
|
||||
/* Feature flags. */
|
||||
multiboot_uint32_t flags;
|
||||
|
||||
/* The above fields plus this one must equal 0 mod 2^32. */
|
||||
multiboot_uint32_t checksum;
|
||||
|
||||
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
|
||||
multiboot_uint32_t header_addr;
|
||||
multiboot_uint32_t load_addr;
|
||||
multiboot_uint32_t load_end_addr;
|
||||
multiboot_uint32_t bss_end_addr;
|
||||
multiboot_uint32_t entry_addr;
|
||||
|
||||
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
|
||||
multiboot_uint32_t mode_type;
|
||||
multiboot_uint32_t width;
|
||||
multiboot_uint32_t height;
|
||||
multiboot_uint32_t depth;
|
||||
};
|
||||
|
||||
/* The symbol table for a.out. */
|
||||
struct multiboot_aout_symbol_table {
|
||||
multiboot_uint32_t tabsize;
|
||||
multiboot_uint32_t strsize;
|
||||
multiboot_uint32_t addr;
|
||||
multiboot_uint32_t reserved;
|
||||
};
|
||||
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
|
||||
|
||||
/* The section header table for ELF. */
|
||||
struct multiboot_elf_section_header_table {
|
||||
multiboot_uint32_t num;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t addr;
|
||||
multiboot_uint32_t shndx;
|
||||
};
|
||||
typedef struct multiboot_elf_section_header_table
|
||||
multiboot_elf_section_header_table_t;
|
||||
|
||||
struct multiboot_info {
|
||||
/* Multiboot info version number */
|
||||
multiboot_uint32_t flags;
|
||||
|
||||
/* Available memory from BIOS */
|
||||
multiboot_uint32_t mem_lower;
|
||||
multiboot_uint32_t mem_upper;
|
||||
|
||||
/* "root" partition */
|
||||
multiboot_uint32_t boot_device;
|
||||
|
||||
/* Kernel command line */
|
||||
multiboot_uint32_t cmdline;
|
||||
|
||||
/* Boot-Module list */
|
||||
multiboot_uint32_t mods_count;
|
||||
multiboot_uint32_t mods_addr;
|
||||
|
||||
union {
|
||||
multiboot_aout_symbol_table_t aout_sym;
|
||||
multiboot_elf_section_header_table_t elf_sec;
|
||||
} u;
|
||||
|
||||
/* Memory Mapping buffer */
|
||||
multiboot_uint32_t mmap_length;
|
||||
multiboot_uint32_t mmap_addr;
|
||||
|
||||
/* Drive Info buffer */
|
||||
multiboot_uint32_t drives_length;
|
||||
multiboot_uint32_t drives_addr;
|
||||
|
||||
/* ROM configuration table */
|
||||
multiboot_uint32_t config_table;
|
||||
|
||||
/* Boot Loader Name */
|
||||
multiboot_uint32_t boot_loader_name;
|
||||
|
||||
/* APM table */
|
||||
multiboot_uint32_t apm_table;
|
||||
|
||||
/* Video */
|
||||
multiboot_uint32_t vbe_control_info;
|
||||
multiboot_uint32_t vbe_mode_info;
|
||||
multiboot_uint16_t vbe_mode;
|
||||
multiboot_uint16_t vbe_interface_seg;
|
||||
multiboot_uint16_t vbe_interface_off;
|
||||
multiboot_uint16_t vbe_interface_len;
|
||||
|
||||
multiboot_uint64_t framebuffer_addr;
|
||||
multiboot_uint32_t framebuffer_pitch;
|
||||
multiboot_uint32_t framebuffer_width;
|
||||
multiboot_uint32_t framebuffer_height;
|
||||
multiboot_uint8_t framebuffer_bpp;
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
|
||||
multiboot_uint8_t framebuffer_type;
|
||||
union {
|
||||
struct {
|
||||
multiboot_uint32_t framebuffer_palette_addr;
|
||||
multiboot_uint16_t framebuffer_palette_num_colors;
|
||||
};
|
||||
struct {
|
||||
multiboot_uint8_t framebuffer_red_field_position;
|
||||
multiboot_uint8_t framebuffer_red_mask_size;
|
||||
multiboot_uint8_t framebuffer_green_field_position;
|
||||
multiboot_uint8_t framebuffer_green_mask_size;
|
||||
multiboot_uint8_t framebuffer_blue_field_position;
|
||||
multiboot_uint8_t framebuffer_blue_mask_size;
|
||||
};
|
||||
};
|
||||
};
|
||||
typedef struct multiboot_info multiboot_info_t;
|
||||
|
||||
struct multiboot_color {
|
||||
multiboot_uint8_t red;
|
||||
multiboot_uint8_t green;
|
||||
multiboot_uint8_t blue;
|
||||
};
|
||||
|
||||
struct multiboot_mmap_entry {
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint64_t addr;
|
||||
multiboot_uint64_t len;
|
||||
#define MULTIBOOT_MEMORY_AVAILABLE 1
|
||||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
|
||||
#define MULTIBOOT_MEMORY_NVS 4
|
||||
#define MULTIBOOT_MEMORY_BADRAM 5
|
||||
multiboot_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
|
||||
|
||||
struct multiboot_mod_list {
|
||||
/* the memory used goes from bytes ’mod_start’ to ’mod_end-1’ inclusive
|
||||
*/
|
||||
multiboot_uint32_t mod_start;
|
||||
multiboot_uint32_t mod_end;
|
||||
|
||||
/* Module command line */
|
||||
multiboot_uint32_t cmdline;
|
||||
|
||||
/* padding to take it to 16 bytes (must be zero) */
|
||||
multiboot_uint32_t pad;
|
||||
};
|
||||
typedef struct multiboot_mod_list multiboot_module_t;
|
||||
|
||||
/* APM BIOS info. */
|
||||
struct multiboot_apm_info {
|
||||
multiboot_uint16_t version;
|
||||
multiboot_uint16_t cseg;
|
||||
multiboot_uint32_t offset;
|
||||
multiboot_uint16_t cseg_16;
|
||||
multiboot_uint16_t dseg;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint16_t cseg_len;
|
||||
multiboot_uint16_t cseg_16_len;
|
||||
multiboot_uint16_t dseg_len;
|
||||
};
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void init_multiboot(multiboot_info_t *mbd, uint32_t magic);
|
@ -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 TERM_COUNT 10
|
||||
#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;
|
||||
};
|
18
headers/vbe.h
Normal file
18
headers/vbe.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "icon.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct vbe_interface {
|
||||
uint32_t *buff;
|
||||
uint16_t height;
|
||||
uint16_t width;
|
||||
uint32_t pitch;
|
||||
uint8_t bpp;
|
||||
};
|
||||
|
||||
extern struct vbe_interface display;
|
||||
|
||||
void draw_icon(uint32_t pos_x, uint32_t pos_y, struct icon *img);
|
||||
void put_pixel(uint32_t color, uint32_t x, uint32_t y);
|
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,6 @@
|
||||
#pragma once
|
||||
|
||||
#define CEIL(x, y) (((x) + (y) - 1) / (y))
|
||||
#define ARRAY_SIZE(ptr) (sizeof(ptr) / sizeof(ptr[0]))
|
||||
#define CEIL(x, y) (((x) + (y) - 1) / (y))
|
||||
#define ARRAY_SIZE(ptr) (sizeof(ptr) / sizeof(ptr[0]))
|
||||
#define ROUND_CEIL(x, y) (CEIL(x, y) * y)
|
||||
#define ROUND_FLOOR(x, y) ((x / y) * y)
|
||||
|
@ -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
|
21
src/boot.s
21
src/boot.s
@ -1,9 +1,10 @@
|
||||
# Declare constants for the multiboot header.
|
||||
.set ALIGN, 1<<0 # align loaded modules on page boundaries
|
||||
.set MEMINFO, 1<<1 # provide memory map
|
||||
.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
|
||||
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
|
||||
.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot
|
||||
.set ALIGN, 1<<0 # align loaded modules on page boundaries
|
||||
.set MEMINFO, 1<<1 # provide memory map
|
||||
.set VIDEOMODE, 1<<2 # provide memory map
|
||||
.set FLAGS, ALIGN | MEMINFO | VIDEOMODE # this is the Multiboot 'flag' field
|
||||
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
|
||||
.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot
|
||||
|
||||
# Declare a multiboot header that marks the program as a kernel.
|
||||
.section .multiboot.data, "aw"
|
||||
@ -11,6 +12,13 @@
|
||||
.long MAGIC
|
||||
.long FLAGS
|
||||
.long CHECKSUM
|
||||
.skip 20
|
||||
|
||||
# Video mode
|
||||
.long 0
|
||||
.long 1024
|
||||
.long 768
|
||||
.long 32
|
||||
|
||||
# Allocate the initial stack.
|
||||
.section .bootstrap_stack, "aw", @nobits
|
||||
@ -113,6 +121,9 @@ _start:
|
||||
# Set up the stack.
|
||||
mov $stack_top, %esp
|
||||
|
||||
push %eax
|
||||
push %ebx
|
||||
|
||||
# Enter the high-level kernel.
|
||||
call kernel_main
|
||||
|
||||
|
@ -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 = {};
|
||||
|
||||
|
21
src/drivers/vbe.c
Normal file
21
src/drivers/vbe.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "vbe.h"
|
||||
#include "icon.h"
|
||||
|
||||
struct vbe_interface display;
|
||||
|
||||
void put_pixel(uint32_t color, uint32_t x, uint32_t y)
|
||||
{
|
||||
// divide by 4 because display.buff is in 32bit instead of 8bit
|
||||
const uint32_t coords = x + y * display.pitch / 4;
|
||||
display.buff[coords] = color;
|
||||
}
|
||||
|
||||
void draw_icon(uint32_t pos_x, uint32_t pos_y, struct icon *img)
|
||||
{
|
||||
for (uint32_t y = 0; y < img->height; y++) {
|
||||
for (uint32_t x = 0; x < img->width; x++) {
|
||||
put_pixel(img->pixels[y * img->width + x], pos_x + x,
|
||||
pos_y + y);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
42
src/kernel.c
42
src/kernel.c
@ -2,13 +2,18 @@
|
||||
#include "debug.h"
|
||||
#include "drivers.h"
|
||||
#include "gdt.h"
|
||||
#include "icon.h"
|
||||
#include "idt.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "multiboot.h"
|
||||
#include "power.h"
|
||||
#include "shell.h"
|
||||
#include "string.h"
|
||||
#include "task.h"
|
||||
#include "terminal.h"
|
||||
#include "time.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
@ -25,34 +30,23 @@
|
||||
#error "This tutorial needs to be compiled with a ix86-elf compiler"
|
||||
#endif
|
||||
|
||||
void kernel_main(void)
|
||||
static void bozo(int int_code)
|
||||
{
|
||||
kprintf("apagnan code\n");
|
||||
}
|
||||
|
||||
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
{
|
||||
terminal_initialize();
|
||||
init_gdt();
|
||||
init_idt();
|
||||
init_memory();
|
||||
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");
|
||||
/* int i = 0; */
|
||||
/* while (vmalloc(10)) */
|
||||
/* ; */
|
||||
/* if (i++ > 70000) */
|
||||
/* kprintf("%d\n", i); */
|
||||
/* void *tab[1024]; */
|
||||
/* for (int i = 0; i < 1023; i++) { */
|
||||
/* tab[i] = alloc_pages(1, NULL); */
|
||||
/* PRINT_INT(i); */
|
||||
/* PRINT_PTR(tab[i]); */
|
||||
/* if (!tab[i]) */
|
||||
/* break; */
|
||||
/* memset(tab[i], i, 4096); */
|
||||
/* } */
|
||||
/* PRINT_UINT(((uint8_t *)tab[0])[0]); */
|
||||
/* for (int i = 0; i < 10; i++) */
|
||||
/* PRINT_UINT(((uint8_t *)tab[i])[0]); */
|
||||
/* PRINT_PTR(tab[i]); */
|
||||
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();
|
||||
}
|
||||
|
17
src/kpanic.c
17
src/kpanic.c
@ -4,30 +4,33 @@
|
||||
#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);
|
||||
|
||||
void kpanic(const char *format, ...)
|
||||
__attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
||||
/* 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");
|
||||
}
|
||||
|
@ -5,65 +5,39 @@
|
||||
#include "debug.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "string.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define MAX_FRAMES (HEAP_END / PAGE_SIZE)
|
||||
|
||||
static uint8_t frame_table[MAX_FRAMES];
|
||||
static uint32_t remaining_frames = MAX_FRAMES;
|
||||
|
||||
static int32_t find_next_block(size_t nb_frames)
|
||||
void *alloc_frame(void)
|
||||
{
|
||||
for (uint32_t i = CEIL(HEAP_START, PAGE_SIZE);
|
||||
i + nb_frames < MAX_FRAMES; i++) {
|
||||
uint32_t j;
|
||||
for (j = 0; frame_table[i + j] == 0 && j < nb_frames; j++)
|
||||
;
|
||||
if (j == nb_frames)
|
||||
return i;
|
||||
i += j;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *alloc_frames(size_t size)
|
||||
{
|
||||
const uint32_t nb_frames = CEIL(size, PAGE_SIZE);
|
||||
if (nb_frames > remaining_frames) {
|
||||
kprintf(KERN_CRIT "Not enough frames (max: %d)\n", MAX_FRAMES);
|
||||
struct frame_zone *it = head;
|
||||
while (it && !it->remaining_frames)
|
||||
it = it->next;
|
||||
if (!it || it->remaining_frames == 0) {
|
||||
kprintf(KERN_CRIT "No memory zone available (ratio)\n");
|
||||
return NULL;
|
||||
}
|
||||
int i = find_next_block(nb_frames);
|
||||
if (i < 0) {
|
||||
kprintf(KERN_WARNING "Not enough frames available\n");
|
||||
return NULL;
|
||||
}
|
||||
for (size_t j = 0; j < nb_frames; j++) {
|
||||
assert(j + i < MAX_FRAMES);
|
||||
frame_table[j + i] = 1;
|
||||
}
|
||||
assert(remaining_frames >= nb_frames);
|
||||
remaining_frames -= nb_frames;
|
||||
return (void *)(i * PAGE_SIZE);
|
||||
|
||||
size_t i = it->first_free_frame;
|
||||
for (; GET_FRAME(it->frame_table, i); i++)
|
||||
;
|
||||
it->first_free_frame++;
|
||||
it->remaining_frames--;
|
||||
SET_FRAME(it->frame_table, i, 1);
|
||||
return it->addr + i * PAGE_SIZE;
|
||||
}
|
||||
|
||||
int free_frames(void *frame_ptr, size_t size)
|
||||
int free_frame(void *frame_ptr)
|
||||
{
|
||||
const uint32_t nb_frames = CEIL(size, PAGE_SIZE);
|
||||
const uint32_t start = (uint32_t)(frame_ptr + HEAP_END) / PAGE_SIZE;
|
||||
struct frame_zone *it = head;
|
||||
while (it && (frame_ptr < it->addr ||
|
||||
frame_ptr >= it->addr + it->total_frames * PAGE_SIZE))
|
||||
it = it->next;
|
||||
|
||||
if (start > MAX_FRAMES) {
|
||||
kprintf(KERN_WARNING "Address out of range\n");
|
||||
return -1;
|
||||
} else if ((uint32_t)frame_ptr % PAGE_SIZE) {
|
||||
kprintf(KERN_WARNING "Invalid address\n");
|
||||
return -1;
|
||||
} else if (start + nb_frames > MAX_FRAMES) {
|
||||
kprintf(KERN_WARNING "Invalid number of frames\n");
|
||||
return -1;
|
||||
}
|
||||
for (size_t i = start; i < start + nb_frames; i++)
|
||||
frame_table[i] = 0;
|
||||
remaining_frames += nb_frames;
|
||||
uint32_t index = ((frame_ptr - it->addr) / PAGE_SIZE);
|
||||
SET_FRAME(it->frame_table, index, 0);
|
||||
if (it->first_free_frame > index)
|
||||
it->first_free_frame = index;
|
||||
it->remaining_frames++;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,17 +1,123 @@
|
||||
#include "memory.h"
|
||||
#include "debug.h"
|
||||
#include "kprintf.h"
|
||||
#include "string.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t *page_directory = &boot_page_directory;
|
||||
uint32_t page_table_default[1024] __attribute__((aligned(4096)));
|
||||
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 init_memory(void)
|
||||
void switch_pd(uint32_t *pd, uint32_t *cr3)
|
||||
{
|
||||
assert(page_directory);
|
||||
for (uint16_t i = 0; i < 0x300; i++)
|
||||
page_directory[i] = 0x02;
|
||||
init_page_table(page_table_default, 0);
|
||||
page_directory[0] = ((uint32_t)page_table_default - HEAP_END) | 0x03;
|
||||
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) {
|
||||
*root = element;
|
||||
return;
|
||||
}
|
||||
struct frame_zone *it = *root;
|
||||
while (it->next)
|
||||
it = it->next;
|
||||
it->next = element;
|
||||
}
|
||||
|
||||
static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
{
|
||||
static uint32_t index;
|
||||
|
||||
/**
|
||||
* # = kernel code
|
||||
* - = blank
|
||||
*/
|
||||
|
||||
uint64_t start_addr = mmmt->addr;
|
||||
uint64_t end_addr = mmmt->addr + mmmt->len;
|
||||
uint64_t len = mmmt->len;
|
||||
|
||||
/** Kernel code cover all the block
|
||||
* this situation:
|
||||
* #######################
|
||||
*/
|
||||
if (KERNEL_START <= start_addr && KERNEL_END >= end_addr)
|
||||
return;
|
||||
|
||||
/** Kernel code start on the block
|
||||
* this situation:
|
||||
* --------###############
|
||||
*/
|
||||
if (KERNEL_START > start_addr && KERNEL_START <= end_addr)
|
||||
len = ROUND_FLOOR(KERNEL_START - start_addr, PAGE_SIZE);
|
||||
/** Kernel code end on the block
|
||||
* this situation:
|
||||
* ###############--------
|
||||
*/
|
||||
if (KERNEL_START <= start_addr && KERNEL_END > start_addr &&
|
||||
KERNEL_END <= end_addr) {
|
||||
len = ROUND_CEIL(len - (KERNEL_END - start_addr), PAGE_SIZE) -
|
||||
PAGE_SIZE; // cringe but ROUND_FLOOR is un poquito crampte
|
||||
start_addr = ROUND_CEIL(KERNEL_END, PAGE_SIZE);
|
||||
}
|
||||
end_addr = ROUND_CEIL(start_addr + len, PAGE_SIZE);
|
||||
|
||||
init_page_table(frame_zones_page_table, 0);
|
||||
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;
|
||||
|
||||
struct frame_zone *current =
|
||||
(struct frame_zone *)GET_PAGE_ADDR(1022, index++);
|
||||
|
||||
current->frame_table = (uint8_t *)current + sizeof(struct frame_zone);
|
||||
|
||||
/** 8 is cause we are using uint8_t
|
||||
nb_frame = size / (PAGE_SIZE + 1 / 8)
|
||||
cause we are using non decimal number
|
||||
nb_frame = ((size * 8) / (PAGE_SIZE * 8 + 1))
|
||||
*/
|
||||
const uint32_t nb_frame = ((len * 8) / (PAGE_SIZE * 8 + 1));
|
||||
current->first_free_frame = 0;
|
||||
current->next = NULL;
|
||||
current->remaining_frames = nb_frame;
|
||||
current->total_frames = nb_frame;
|
||||
|
||||
memset(current->frame_table, 0,
|
||||
nb_frame * sizeof(*current->frame_table));
|
||||
|
||||
uint32_t i = 1;
|
||||
for (; i < CEIL(nb_frame, PAGE_SIZE); i++)
|
||||
frame_zones_page_table[index + i] =
|
||||
((uint32_t)(start_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
INIT_FLAGS;
|
||||
current->addr = (void *)start_addr + i * PAGE_SIZE;
|
||||
index += i - 1;
|
||||
lst_add_back(&head, current);
|
||||
}
|
||||
|
||||
static void init_frame_zones(void)
|
||||
{
|
||||
for (uint32_t i = 0; i < mmap_length; i++) {
|
||||
multiboot_memory_map_t *mmmt =
|
||||
(multiboot_memory_map_t *)mmap_addr + i;
|
||||
if (mmmt->type == MULTIBOOT_MEMORY_AVAILABLE)
|
||||
add_frame_node(mmmt);
|
||||
}
|
||||
}
|
||||
|
||||
void init_memory(multiboot_info_t *mbd, uint32_t magic)
|
||||
{
|
||||
for (uint16_t i = 0; i < 0x300; i++)
|
||||
kernel_pd[i] = 0x02;
|
||||
init_page_table(page_table_default, 0);
|
||||
kernel_pd[0] = ((uint32_t)page_table_default - HEAP_END) | 0x03;
|
||||
current_pd = kernel_pd;
|
||||
init_multiboot(mbd, magic);
|
||||
init_frame_zones();
|
||||
}
|
||||
|
@ -5,26 +5,23 @@
|
||||
#include "debug.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "string.h"
|
||||
#include "task.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define MAX_TLB_ENTRIES 32
|
||||
|
||||
static uint32_t *current_page_table;
|
||||
static uint16_t current_pd_index;
|
||||
|
||||
static int16_t find_next_block(size_t nb_pages)
|
||||
static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr,
|
||||
uint32_t **page_table_ptr)
|
||||
{
|
||||
for (uint16_t pd_index = 1; pd_index < 768; pd_index++) {
|
||||
if (page_directory[pd_index] == 0x02) {
|
||||
if (add_page_table(pd_index) < 0)
|
||||
for (*pd_index_ptr = 1; *pd_index_ptr < 768; (*pd_index_ptr)++) {
|
||||
if (current_pd[(*pd_index_ptr)] == 0x02) {
|
||||
if (add_page_table(*pd_index_ptr) < 0)
|
||||
return -2;
|
||||
}
|
||||
current_pd_index = pd_index;
|
||||
current_page_table =
|
||||
(uint32_t *)GET_PAGE_ADDR(0, pd_index + PT_START);
|
||||
for (uint16_t i = 0; i + nb_pages < PT_SIZE; i++) {
|
||||
*page_table_ptr =
|
||||
(uint32_t *)GET_PAGE_ADDR(0, *pd_index_ptr + PT_START);
|
||||
for (uint16_t i = 0; i + nb_pages - 1 < PT_SIZE; i++) {
|
||||
uint16_t j;
|
||||
for (j = 0; current_page_table[i + j] >> 12 == i + j &&
|
||||
for (j = 0; (*page_table_ptr)[i + j] >> 12 == i + j &&
|
||||
j < nb_pages;
|
||||
j++)
|
||||
;
|
||||
@ -36,10 +33,26 @@ static int16_t find_next_block(size_t nb_pages)
|
||||
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);
|
||||
const int16_t index = find_next_block(nb_pages);
|
||||
uint16_t pd_index;
|
||||
uint32_t *page_table;
|
||||
const int16_t index = find_next_block(nb_pages, &pd_index, &page_table);
|
||||
|
||||
if (index < 0) {
|
||||
kprintf(KERN_CRIT "%d: Not enough pages (max: %d)\n", index,
|
||||
@ -47,38 +60,48 @@ void *alloc_pages(size_t size)
|
||||
return NULL;
|
||||
}
|
||||
for (size_t i = index; i - (size_t)index < nb_pages; i++) {
|
||||
void *frame = alloc_frames(PAGE_SIZE);
|
||||
void *frame = alloc_frame();
|
||||
if (!frame) {
|
||||
for (size_t j = index; j < i; j++)
|
||||
free_frames(
|
||||
(void *)(current_page_table[j] >> 12),
|
||||
PAGE_SIZE);
|
||||
free_frame((void *)(page_table[j] & PAGE_MASK));
|
||||
return NULL;
|
||||
}
|
||||
current_page_table[i] =
|
||||
((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
||||
if (phys_addr)
|
||||
*phys_addr = frame;
|
||||
page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
||||
}
|
||||
return (void *)GET_PAGE_ADDR(current_pd_index, index);
|
||||
memset((void *)GET_PAGE_ADDR(pd_index, index), 0, nb_pages * PAGE_SIZE);
|
||||
return (void *)GET_PAGE_ADDR(pd_index, index);
|
||||
}
|
||||
|
||||
int free_pages(void *page_ptr, size_t size)
|
||||
{
|
||||
const uint32_t page_addr = (uint32_t)page_ptr;
|
||||
const uint32_t nb_pages = CEIL(size, PAGE_SIZE);
|
||||
const uint32_t page_index = (uint32_t)page_ptr / PAGE_SIZE;
|
||||
const uint32_t page_index = page_addr / PAGE_SIZE;
|
||||
const uint32_t pd_index = page_index / PD_SIZE;
|
||||
const uint32_t pt_index = page_index % PD_SIZE;
|
||||
|
||||
if ((uint32_t)page_ptr > PT_SIZE * PAGE_SIZE) {
|
||||
if ((uint32_t)pd_index > 0x300) {
|
||||
kprintf(KERN_WARNING "Address out of range\n");
|
||||
return -1;
|
||||
} else if ((uint32_t)page_ptr % PAGE_SIZE) {
|
||||
} else if (page_addr % PAGE_SIZE) {
|
||||
kprintf(KERN_WARNING "Invalid address\n");
|
||||
return -1;
|
||||
} else if (page_index + nb_pages > PT_SIZE) {
|
||||
} else if (pt_index + nb_pages > PT_SIZE) {
|
||||
kprintf(KERN_WARNING "Invalid number of frames\n");
|
||||
return -1;
|
||||
}
|
||||
for (size_t i = page_index; i < page_index + nb_pages; i++) {
|
||||
free_frames((void *)(current_page_table[i] >> 12), PAGE_SIZE);
|
||||
current_page_table[i] = i << 12 | INIT_FLAGS;
|
||||
uint32_t *page_table =
|
||||
(uint32_t *)GET_PAGE_ADDR(0, PT_START + pd_index);
|
||||
for (uint16_t i = pt_index; i < pt_index + nb_pages; i++) {
|
||||
if (page_table[i] >> 12 == i) {
|
||||
kprintf(KERN_WARNING "Page already free\n");
|
||||
return -2;
|
||||
}
|
||||
free_frame((void *)(page_table[i] & PAGE_MASK));
|
||||
page_table[i] = i << 12;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ void init_page_table(uint32_t page_table[1024], uint16_t start)
|
||||
|
||||
int16_t add_page_table(uint16_t pd_index)
|
||||
{
|
||||
void *frame = alloc_frames(PAGE_SIZE);
|
||||
void *frame = alloc_frame();
|
||||
if (!frame)
|
||||
return -1;
|
||||
page_table_default[PT_START + pd_index] =
|
||||
@ -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;
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "alloc.h"
|
||||
#include "debug.h"
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include <stdint.h>
|
||||
#include "task.h"
|
||||
|
||||
Zone *kzones[3];
|
||||
|
||||
@ -9,6 +11,7 @@ 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;
|
||||
}
|
||||
@ -41,13 +44,15 @@ static void new_block(Zone *zone, uint32_t zone_size)
|
||||
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)
|
||||
{
|
||||
void *heap = alloc_frames(size);
|
||||
// assert(current_task->pid);
|
||||
void *heap = alloc_frame();
|
||||
if (heap == NULL) {
|
||||
kprintf(KERN_ERR "error: alloc_frames failed\n");
|
||||
kprintf(KERN_ERR "error: alloc_frame failed\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -7,18 +7,35 @@
|
||||
|
||||
void show_kalloc_mem(void)
|
||||
{
|
||||
char *const kzones_name[3] = {"TINY", "SMALL", "LARGE"};
|
||||
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",
|
||||
kzones_name[type], count, zone_it);
|
||||
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,
|
||||
@ -29,21 +46,6 @@ void show_kalloc_mem(void)
|
||||
if (zone_it->free)
|
||||
kprintf("\n");
|
||||
#endif
|
||||
if (zone_it->used)
|
||||
kprintf("---------- IN_USE %s [n°%d - %p] "
|
||||
"----------\n",
|
||||
kzones_name[type], count, zone_it);
|
||||
for (Block *block_it = zone_it->used; block_it != NULL;
|
||||
block_it = block_it->next_used) {
|
||||
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++;
|
||||
}
|
||||
}
|
||||
kprintf("Total: %u\n", total_size);
|
||||
|
@ -25,7 +25,7 @@ static void remove_used(Block *to_free)
|
||||
|
||||
/*
|
||||
* If all the blocks of the zone have been kfreed,
|
||||
* we can unmap the zone and delete it from the list of kzones
|
||||
* we can unmap the zone and delete it from the list of zones
|
||||
*/
|
||||
static int unmap_zone(Zone *zone)
|
||||
{
|
||||
@ -47,7 +47,7 @@ static int unmap_zone(Zone *zone)
|
||||
if (right)
|
||||
right->prev = left;
|
||||
unmap:
|
||||
err = free_frames((void *)zone, zone->size);
|
||||
err = free_pages((void *)zone, zone->size);
|
||||
if (err)
|
||||
kprintf(KERN_ERR "error: munmap failed\n");
|
||||
return (err);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "alloc.h"
|
||||
#include "debug.h"
|
||||
#include "kprintf.h"
|
||||
#include "terminal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
@ -12,6 +13,7 @@ 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);
|
||||
@ -47,11 +49,16 @@ static Block *find_block(Zone *head, uint32_t size)
|
||||
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))));
|
||||
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 - size;
|
||||
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));
|
||||
@ -65,11 +72,14 @@ static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
new_block->next_used = NULL;
|
||||
|
||||
new_block->prev_free = old_block->prev_free;
|
||||
new_block->next_free = old_block->next_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;
|
||||
|
||||
@ -88,7 +98,7 @@ static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
zone->used = old_block;
|
||||
}
|
||||
|
||||
// Set the block to use and unset free
|
||||
// Set the block to used and unset free
|
||||
static void save_block(Zone *head, Block *block, Zone *zone)
|
||||
{
|
||||
zone->free = NULL;
|
||||
@ -107,7 +117,7 @@ static void save_block(Zone *head, Block *block, Zone *zone)
|
||||
*
|
||||
* First, we init the allocator if it's the first time
|
||||
* Then we search if there is an available block in all
|
||||
* the kzones currently mapped
|
||||
* 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)
|
||||
|
@ -3,13 +3,15 @@
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "memory.h"
|
||||
#include "task.h"
|
||||
|
||||
Zone *vzones[3];
|
||||
|
||||
static void add_zone(Zone *zone, block_type_t type)
|
||||
{
|
||||
// We put the zone at the beginning of the list
|
||||
if (vzones[type] && vzones[type] != zone) {
|
||||
if (vzones[type]) {
|
||||
assert(vzones[type] != zone);
|
||||
zone->next = vzones[type];
|
||||
vzones[type]->prev = zone;
|
||||
}
|
||||
@ -40,8 +42,6 @@ static void new_block(Zone *zone, uint32_t zone_size)
|
||||
zone->free->prev_free = new_block;
|
||||
new_block->next = zone->free;
|
||||
new_block->next_free = zone->free;
|
||||
PRINT_PTR(new_block);
|
||||
PRINT_PTR(new_block->next_free);
|
||||
}
|
||||
zone->free = new_block;
|
||||
assert(zone->free == new_block);
|
||||
@ -49,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);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
void show_valloc_mem(void)
|
||||
{
|
||||
char *const vzones_name[3] = {"TINY", "SMALL", "LARGE"};
|
||||
char *const zones_name[3] = {"TINY", "SMALL", "LARGE"};
|
||||
uint32_t total_size = 0;
|
||||
|
||||
for (block_type_t type = 0; type < 3; ++type) {
|
||||
@ -17,7 +17,7 @@ void show_valloc_mem(void)
|
||||
if (zone_it->used)
|
||||
kprintf("---------- IN_USE %s [n°%d - %p] "
|
||||
"----------\n",
|
||||
vzones_name[type], count, zone_it);
|
||||
zones_name[type], count, zone_it);
|
||||
for (Block *block_it = zone_it->used; block_it != NULL;
|
||||
block_it = block_it->next_used) {
|
||||
/* i++; */
|
||||
@ -35,7 +35,7 @@ void show_valloc_mem(void)
|
||||
if (zone_it->free)
|
||||
kprintf("---------- AVAILABLE %s [n°%d - %p] "
|
||||
"----------\n",
|
||||
vzones_name[type], count, zone_it);
|
||||
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,
|
||||
|
@ -25,7 +25,7 @@ static void remove_used(Block *to_free)
|
||||
|
||||
/*
|
||||
* If all the blocks of the zone have been kfreed,
|
||||
* we can unmap the zone and delete it from the list of vzones
|
||||
* we can unmap the zone and delete it from the list of zones
|
||||
*/
|
||||
static int unmap_zone(Zone *zone)
|
||||
{
|
||||
|
@ -4,8 +4,6 @@
|
||||
#include "terminal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
int new_zone(block_type_t type, uint32_t size);
|
||||
|
||||
/*
|
||||
* Find first available (not in_use) block
|
||||
* in a zone matching the size we need
|
||||
@ -16,10 +14,6 @@ static Block *find_block(Zone *head, uint32_t size)
|
||||
for (Block *block_it = zone_it->free; block_it != NULL;
|
||||
block_it = block_it->next_free) {
|
||||
assert(block_it);
|
||||
if (block_it->in_use) {
|
||||
/* PRINT_PTR(block_it); */
|
||||
/* PRINT_PTR(block_it->zone); */
|
||||
}
|
||||
assert(!block_it->in_use);
|
||||
if (size <= block_it->size) {
|
||||
assert(block_it->zone == zone_it);
|
||||
@ -43,16 +37,6 @@ static Block *find_block(Zone *head, uint32_t size)
|
||||
* Let's say the metadata takes a size of 2:
|
||||
* ... -> [metadata][data][remaining size] -> [6]
|
||||
* ^ ^ ^
|
||||
PRINT_UINT(size);
|
||||
PRINT_UINT(size);
|
||||
PRINT_UINT(block_it->size);
|
||||
if (size <= block_it->size) {
|
||||
assert(block_it->zone == zone_it);
|
||||
return (block_it);
|
||||
PRINT_UINT(block_it->size);
|
||||
if (size <= block_it->size) {
|
||||
assert(block_it->zone == zone_it);
|
||||
return (block_it);
|
||||
* 2 10 20
|
||||
*
|
||||
* So now our block [new] will become:
|
||||
@ -65,14 +49,14 @@ static Block *find_block(Zone *head, uint32_t size)
|
||||
static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
{
|
||||
Block *new_block = (Block *)align_mem((uint32_t)old_block + size);
|
||||
/* PRINT_PTR(old_block); */
|
||||
/* PRINT_PTR(new_block); */
|
||||
/* PRINT_UINT(old_block->size); */
|
||||
/* PRINT_UINT(size); */
|
||||
/* PRINT_PTR(zone); */
|
||||
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;
|
||||
@ -95,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;
|
||||
|
||||
@ -113,7 +98,7 @@ static void frag_block(Zone *zone, Block *old_block, uint32_t size)
|
||||
zone->used = old_block;
|
||||
}
|
||||
|
||||
// Set the block to use and unset free
|
||||
// Set the block to used and unset free
|
||||
static void save_block(Zone *head, Block *block, Zone *zone)
|
||||
{
|
||||
zone->free = NULL;
|
||||
@ -132,7 +117,7 @@ static void save_block(Zone *head, Block *block, Zone *zone)
|
||||
*
|
||||
* First, we init the allocator if it's the first time
|
||||
* Then we search if there is an available block in all
|
||||
* the vzones currently mapped
|
||||
* 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)
|
||||
@ -168,9 +153,6 @@ void *vmalloc(uint32_t size)
|
||||
available = find_block(head, size);
|
||||
}
|
||||
assert(available != NULL);
|
||||
/* PRINT_PTR(available); */
|
||||
/* PRINT_PTR(available->zone); */
|
||||
/* PRINT_PTR(available->zone->size); */
|
||||
if (type == LARGE)
|
||||
save_block(head, available, available->zone);
|
||||
else
|
||||
|
@ -32,6 +32,6 @@ void *vrealloc(void *ptr, uint32_t size)
|
||||
if (new_ptr == NULL)
|
||||
return NULL;
|
||||
memmove(new_ptr, ptr, block->size);
|
||||
kfree(ptr);
|
||||
vfree(ptr);
|
||||
return (new_ptr);
|
||||
}
|
||||
|
69
src/multiboot.c
Normal file
69
src/multiboot.c
Normal file
@ -0,0 +1,69 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "commands.h"
|
||||
#include "debug.h"
|
||||
#include "kpanic.h"
|
||||
#include "memory.h"
|
||||
#include "multiboot.h"
|
||||
#include "utils.h"
|
||||
#include "vbe.h"
|
||||
|
||||
uint32_t multiboot_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
uint32_t vbe_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
multiboot_memory_map_t *mmap_addr;
|
||||
multiboot_uint32_t mmap_length;
|
||||
|
||||
static void init_mmap(multiboot_info_t *mbd_virt, size_t *pt_index)
|
||||
{
|
||||
// Index mbd->mmap_addr pointers
|
||||
uint32_t i = 0;
|
||||
for (; i < mbd_virt->mmap_length; i++)
|
||||
multiboot_page_table[i + *pt_index] =
|
||||
((mbd_virt->mmap_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
INIT_FLAGS;
|
||||
mmap_addr = (multiboot_memory_map_t *)(GET_PAGE_ADDR(1023, *pt_index) +
|
||||
(uint32_t)mbd_virt->mmap_addr %
|
||||
PAGE_SIZE);
|
||||
mmap_length = mbd_virt->mmap_length / sizeof(multiboot_memory_map_t);
|
||||
*pt_index += i;
|
||||
}
|
||||
|
||||
static void init_vbe(multiboot_info_t *mbd_virt)
|
||||
{
|
||||
const uint32_t framebuffer_size =
|
||||
mbd_virt->framebuffer_height * mbd_virt->framebuffer_pitch;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
display.width = mbd_virt->framebuffer_width;
|
||||
display.pitch = mbd_virt->framebuffer_pitch;
|
||||
display.bpp = mbd_virt->framebuffer_bpp;
|
||||
}
|
||||
|
||||
void init_multiboot(multiboot_info_t *mbd, uint32_t magic)
|
||||
{
|
||||
if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
|
||||
kpanic("invalid magic number! (git good skill issue)");
|
||||
|
||||
init_page_table(multiboot_page_table, 0);
|
||||
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);
|
||||
|
||||
// Index multiboot_info_t struct
|
||||
for (uint32_t i = 0; i < pt_index; i++)
|
||||
multiboot_page_table[i] =
|
||||
(((uint32_t)mbd + PAGE_SIZE * i) & PAGE_MASK) | INIT_FLAGS;
|
||||
multiboot_info_t *mbd_virt =
|
||||
(multiboot_info_t *)(GET_PAGE_ADDR(1023, 0) +
|
||||
(uint32_t)mbd % PAGE_SIZE);
|
||||
init_mmap(mbd_virt, &pt_index);
|
||||
init_vbe(mbd_virt);
|
||||
}
|
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
|
@ -4,13 +4,6 @@
|
||||
|
||||
void heap_cmd(char *arg)
|
||||
{
|
||||
if (!arg)
|
||||
kprintf(KERN_INFO "You must specify an argument (phys/virt)\n");
|
||||
else if (!strcmp(arg, "phys"))
|
||||
show_kalloc_mem();
|
||||
else if (!strcmp(arg, "virt"))
|
||||
show_valloc_mem();
|
||||
else
|
||||
kprintf(KERN_INFO "%s: invalid argument to heap (phys/virt)\n",
|
||||
arg);
|
||||
(void)arg;
|
||||
show_valloc_mem();
|
||||
}
|
||||
|
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");
|
||||
}
|
||||
}
|
@ -46,5 +46,4 @@ void merdella_cmd(char *arg)
|
||||
{
|
||||
(void)arg;
|
||||
kprintf(POOP);
|
||||
int i = 1 / 0;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
12
src/ssp.c
Normal file
12
src/ssp.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include "kpanic.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define STACK_CHK_GUARD 0xe2dee396
|
||||
|
||||
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
|
||||
|
||||
__attribute__((noreturn)) void __stack_chk_fail(void)
|
||||
{
|
||||
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,9 +1,14 @@
|
||||
#include "ctype.h"
|
||||
#include "debug.h"
|
||||
#include "font.h"
|
||||
#include "fonts/consolas_regular_13.h"
|
||||
// #include "icons/image.h"
|
||||
#include "kprintf.h"
|
||||
#include "shell.h"
|
||||
#include "string.h"
|
||||
#include "sys/io.h"
|
||||
#include "terminal.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
@ -12,141 +17,180 @@
|
||||
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, uint8_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)
|
||||
{
|
||||
const size_t index = y * VGA_WIDTH + x;
|
||||
TERM_BUF[index] = vga_entry(c, color);
|
||||
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(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)
|
||||
@ -157,8 +201,11 @@ int terminal_putchar(char c)
|
||||
terminal_new_line();
|
||||
if (!isprint(c))
|
||||
return 1;
|
||||
terminal_putentryat(c, screen->color, screen->column, screen->row);
|
||||
if (++screen->column == VGA_WIDTH)
|
||||
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;
|
||||
}
|
||||
@ -180,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)
|
||||
@ -226,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]);
|
||||
|
76
tools/font_converter.py
Normal file
76
tools/font_converter.py
Normal file
@ -0,0 +1,76 @@
|
||||
from PIL import Image
|
||||
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
|
||||
if (len(sys.argv) < 2):
|
||||
print(f"Error: usage python {sys.argv[0]} {{file.fnt}}")
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
fnt_data = f.read()
|
||||
|
||||
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
|
||||
|
||||
image = Image.open(img_file_absolute_path)
|
||||
|
||||
width, height = image.size
|
||||
pixels = list(image.getdata())
|
||||
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)
|
||||
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, yoffset, bitmap]
|
||||
|
||||
string: str = f"""\
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "font.h"
|
||||
|
||||
struct font {font_name}_font[] = {{\\\
|
||||
"""
|
||||
|
||||
for charactere in characteres:
|
||||
if (charactere is not None):
|
||||
height, width, yoffset, bitmap = charactere
|
||||
string += f"""
|
||||
{{
|
||||
.width = {width},
|
||||
.height = {height},
|
||||
.yoffset = {yoffset},
|
||||
.bitmap = "{"".join(bitmap)}",
|
||||
}},\
|
||||
"""
|
||||
else:
|
||||
string += f"""
|
||||
{{
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.yoffset = 0,
|
||||
.bitmap = NULL,
|
||||
}},\
|
||||
"""
|
||||
string += "\n};"
|
||||
|
||||
if not os.path.exists("./headers/fonts"):
|
||||
os.makedirs("./headers/fonts")
|
||||
|
||||
with open(f"./headers/fonts/{font_name}.h", "w") as f:
|
||||
f.write(string)
|
40
tools/icon_converter.py
Normal file
40
tools/icon_converter.py
Normal file
@ -0,0 +1,40 @@
|
||||
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
|
||||
}};
|
||||
|
||||
"""
|
||||
|
||||
if not os.path.exists("./headers/icons"):
|
||||
os.makedirs("./headers/icons")
|
||||
|
||||
with open(f"./headers/icons/{filename}.h", "w") as f:
|
||||
f.write(string)
|
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