makefile: introduce a format command to run clang-format all over the kernel source.

This commit is contained in:
RaphProductions 2025-05-11 11:45:04 +02:00
parent c4e98f5ef2
commit a379d66784
47 changed files with 5092 additions and 4603 deletions

View file

@ -266,3 +266,8 @@ clean:
distclean: distclean:
$(MAKE) -C kernel distclean $(MAKE) -C kernel distclean
rm -rf iso_root *.iso *.hdd kernel-deps limine ovmf rm -rf iso_root *.iso *.hdd kernel-deps limine ovmf
# Make some function to run clang-format all over the kernel
.PHONY: format
format:
clang-format -i -style=file $(shell find kernel/src -name '*.c' -or -name '*.h')

44
compile_commands.json Executable file → Normal file
View file

@ -33,8 +33,46 @@
"obj-x86_64/main.c.o", "obj-x86_64/main.c.o",
"src/main.c" "src/main.c"
], ],
"directory": "/home/raphm/Projets/sild/kernel", "directory": "/home/raphm/Projets/sild/soaplin/kernel",
"file": "/home/raphm/Projets/sild/kernel/src/main.c", "file": "/home/raphm/Projets/sild/soaplin/kernel/src/main.c",
"output": "/home/raphm/Projets/sild/kernel/obj-x86_64/main.c.o" "output": "/home/raphm/Projets/sild/soaplin/kernel/obj-x86_64/main.c.o"
},
{
"arguments": [
"/usr/bin/cc",
"-g",
"-O2",
"-pipe",
"-Wall",
"-Wextra",
"-std=gnu11",
"-nostdinc",
"-ffreestanding",
"-fno-stack-protector",
"-fno-stack-check",
"-fno-PIC",
"-ffunction-sections",
"-fdata-sections",
"-m64",
"-march=x86-64",
"-mno-80387",
"-mno-mmx",
"-mno-sse",
"-mno-sse2",
"-mno-red-zone",
"-mcmodel=kernel",
"-I",
"src",
"-isystem",
"freestnd-c-hdrs",
"-DLIMINE_API_REVISION=3",
"-c",
"-o",
"obj-x86_64/mm/vmm.c.o",
"src/mm/vmm.c"
],
"directory": "/home/raphm/Projets/sild/soaplin/kernel",
"file": "/home/raphm/Projets/sild/soaplin/kernel/src/mm/vmm.c",
"output": "/home/raphm/Projets/sild/soaplin/kernel/obj-x86_64/mm/vmm.c.o"
} }
] ]

View file

@ -2,125 +2,126 @@
#include "mm/memop.h" #include "mm/memop.h"
#include "mm/pmm.h" #include "mm/pmm.h"
#include "mm/vmm.h" #include "mm/vmm.h"
#include <mm/liballoc/liballoc.h>
#include <exec/elf.h> #include <exec/elf.h>
#include <mm/liballoc/liballoc.h>
#include <stdint.h> #include <stdint.h>
#include <sys/log.h> #include <sys/log.h>
program_t *elf_load(char *data) { program_t *elf_load(char *data, int user) {
Elf64_Ehdr *ehdr = (Elf64_Ehdr*)data; Elf64_Ehdr *ehdr = (Elf64_Ehdr *)data;
if ( ehdr->e_ident[EI_MAG0] != ELFMAG0 if (ehdr->e_ident[EI_MAG0] != ELFMAG0 || ehdr->e_ident[EI_MAG1] != ELFMAG1 ||
|| ehdr->e_ident[EI_MAG1] != ELFMAG1 ehdr->e_ident[EI_MAG2] != ELFMAG2 || ehdr->e_ident[EI_MAG3] != ELFMAG3) {
|| ehdr->e_ident[EI_MAG2] != ELFMAG2 log("elf - loading failed: magic is incorrect\n");
|| ehdr->e_ident[EI_MAG3] != ELFMAG3) return NULL;
{ }
log("elf - loading failed: magic is incorrect\n");
return NULL;
}
log("elf - e_ident[EI_DATA]: %d\n", ehdr->e_ident[EI_DATA]); log("elf - e_ident[EI_DATA]: %d\n", ehdr->e_ident[EI_DATA]);
log("elf - e_ident[EI_CLASS]: %d\n", ehdr->e_ident[EI_CLASS]); log("elf - e_ident[EI_CLASS]: %d\n", ehdr->e_ident[EI_CLASS]);
log("elf - e_ident[EI_OSABI]: %d\n", ehdr->e_ident[EI_OSABI]); log("elf - e_ident[EI_OSABI]: %d\n", ehdr->e_ident[EI_OSABI]);
log("elf - e_machine: %d\n", ehdr->e_machine); log("elf - e_machine: %d\n", ehdr->e_machine);
log("elf - e_entry: %p\n", ehdr->e_entry); log("elf - e_entry: %p\n", ehdr->e_entry);
log("elf - e_type: %p\n", ehdr->e_type); log("elf - e_type: %p\n", ehdr->e_type);
log("elf - e_phnum: %p\n", ehdr->e_phnum); log("elf - e_phnum: %p\n", ehdr->e_phnum);
if ( ehdr->e_ident[EI_CLASS] != ELFCLASS64 if (ehdr->e_ident[EI_CLASS] != ELFCLASS64 || ehdr->e_machine != EM_X86_64) {
|| ehdr->e_machine != EM_X86_64) log("elf - loading failed: is the file built for amd64?\n");
{ return NULL;
log("elf - loading failed: is the file built for amd64?\n"); }
return NULL;
}
if (ehdr->e_type != ET_EXEC) if (ehdr->e_type != ET_EXEC) {
{ log("elf - loading failed: ELF type isn't ET_EXEC\n");
log("elf - loading failed: ELF type isn't ET_EXEC\n"); return NULL;
return NULL; }
}
// There's the interesing part // There's the interesing part
elf_program_t *ret = malloc(sizeof(elf_program_t)); // Allocate memory for the program. elf_program_t *ret =
malloc(sizeof(elf_program_t)); // Allocate memory for the program.
pagemap_t *pm = vmm_alloc_pm(); // Allocate a pagemap, so that we can map the program inside. pagemap_t *pm = vmm_alloc_pm(); // Allocate a pagemap, so that we can map the
ret->program.pm = pm; // program inside.
ret->program.entry = ehdr->e_entry; ret->program.pm = pm;
ret->ehdr = ehdr; ret->program.entry = ehdr->e_entry;
ret->ehdr = ehdr;
Elf64_Phdr *phdr = (Elf64_Phdr *)((uint8_t *)data + ehdr->e_phoff); Elf64_Phdr *phdr = (Elf64_Phdr *)((uint8_t *)data + ehdr->e_phoff);
for (uint16_t i = 0; i <= ehdr->e_phnum; i++) for (uint16_t i = 0; i < ehdr->e_phnum; i++) {
{ log("elf - ELF segment type: %d\n", phdr[i].p_type);
log("elf - ELF segment type: %d\n", phdr[i].p_type); if (phdr[i].p_type != PT_LOAD)
if (phdr[i].p_type != PT_LOAD) continue;
continue;
uint64_t vaddr_start = ALIGN_DOWN(phdr[i].p_vaddr, PMM_PAGE_SIZE); uint64_t vaddr_start = ALIGN_DOWN(phdr[i].p_vaddr, PMM_PAGE_SIZE);
uint64_t vaddr_end = ALIGN_UP(phdr[i].p_vaddr + phdr[i].p_memsz, PMM_PAGE_SIZE); uint64_t vaddr_end =
uint64_t offset = phdr[i].p_offset; ALIGN_UP(phdr[i].p_vaddr + phdr[i].p_memsz, PMM_PAGE_SIZE);
uint64_t offset = phdr[i].p_offset;
uint64_t flags = VMM_PRESENT; uint64_t flags = VMM_PRESENT;
//if (phdr[i].p_flags & PF_W) if (phdr[i].p_flags & PF_W)
flags |= VMM_WRITABLE; flags |= VMM_WRITABLE;
//if (!(phdr[i].p_flags & PF_X)) if (!(phdr[i].p_flags & PF_X))
// flags |= VMM_NX; flags |= VMM_NX;
flags |= VMM_USER; if (user)
flags |= VMM_USER;
log("elf - loading ELF program header %u: vaddr 0x%llx - 0x%llx, offset 0x%llx, filesz 0x%llx, size 0x%llx, flags 0x%llx\n", log("elf - loading ELF program header %u: vaddr 0x%llx - 0x%llx, offset "
i, vaddr_start, vaddr_end, offset, phdr[i].p_filesz, phdr[i].p_memsz, flags); "0x%llx, filesz 0x%llx, size 0x%llx, flags 0x%llx\n",
i, vaddr_start, vaddr_end, offset, phdr[i].p_filesz, phdr[i].p_memsz,
flags);
uint64_t page_offset = phdr[i].p_vaddr & (PMM_PAGE_SIZE - 1); uint64_t page_offset = phdr[i].p_vaddr & (PMM_PAGE_SIZE - 1);
for (uint64_t vaddr = vaddr_start; vaddr < vaddr_end; vaddr += PMM_PAGE_SIZE) for (uint64_t vaddr = vaddr_start; vaddr < vaddr_end;
{ vaddr += PMM_PAGE_SIZE) {
uint64_t phys = (uint64_t)pmm_request_page(); uint64_t phys = (uint64_t)pmm_request_page();
if (!phys) if (!phys) {
{ log("elf - pmm page alloc failed. out of memory?\n");
log("elf - pmm page alloc failed. out of memory?\n"); return 0;
return 0; }
}
log("elf - vmm_map(%p, %p, %p, %d)\n", pm, vaddr, phys, flags); if (user) {
vmm_map(pm, vaddr, phys, flags); log("elf - vmm_map_user(%p, %p, %p, %d)\n", pm, vaddr, phys, flags);
log("elf - memset(%p, 0, 0x1000)\n", HIGHER_HALF(phys)); vmm_map_user(pm, vaddr, phys, flags);
memset((void *)HIGHER_HALF(phys), 0, PMM_PAGE_SIZE); } else {
log("elf - vmm_map(%p, %p, %p, %d)\n", pm, vaddr, phys, flags);
vmm_map(pm, vaddr, phys, flags);
}
log("elf - memset(%p, 0, 0x1000)\n", HIGHER_HALF(phys));
memset((void *)HIGHER_HALF(phys), 0, PMM_PAGE_SIZE);
uint64_t file_page_offset = offset + (vaddr - vaddr_start); uint64_t file_page_offset = offset + (vaddr - vaddr_start);
uint64_t file_data_end = offset + phdr[i].p_filesz; uint64_t file_data_end = offset + phdr[i].p_filesz;
if (file_page_offset < file_data_end) if (file_page_offset < file_data_end) {
{ uint64_t bytes_from_start = vaddr - vaddr_start;
uint64_t bytes_from_start = vaddr - vaddr_start; uint64_t page_data_offset = 0;
uint64_t page_data_offset = 0;
if (bytes_from_start == 0 && page_offset > 0) if (bytes_from_start == 0 && page_offset > 0) {
{ page_data_offset = page_offset;
page_data_offset = page_offset;
}
uint64_t copy_offset = file_page_offset;
uint64_t copy_size = PMM_PAGE_SIZE - page_data_offset;
if (copy_offset + copy_size > file_data_end)
{
copy_size = file_data_end - copy_offset;
}
if (copy_size > 0)
{
void *dest = (void *)(HIGHER_HALF(phys) + page_data_offset);
void *src = (uint8_t *)data + copy_offset;
log("elf - memcpy(%p, %p, %d)\n", dest, src, copy_size);
memcpy(dest, src, copy_size);
//log("elf - copied 0x%llx bytes from ELF file offset 0x%llx to vaddr 0x%llx (phys 0x%llx)\n",
// copy_size, copy_offset, vaddr + page_data_offset, phys + page_data_offset);
}
}
} }
}
log("elf - loaded ELF program in memory.\n"); uint64_t copy_offset = file_page_offset;
return (program_t*)ret; uint64_t copy_size = PMM_PAGE_SIZE - page_data_offset;
if (copy_offset + copy_size > file_data_end) {
copy_size = file_data_end - copy_offset;
}
if (copy_size > 0) {
void *dest = (void *)(HIGHER_HALF(phys) + page_data_offset);
void *src = (uint8_t *)data + copy_offset;
log("elf - memcpy(%p, %p, %d)\n", dest, src, copy_size);
memcpy(dest, src, copy_size);
// log("elf - copied 0x%llx bytes from ELF file offset 0x%llx to vaddr
// 0x%llx (phys 0x%llx)\n",
// copy_size, copy_offset, vaddr + page_data_offset, phys +
// page_data_offset);
}
}
}
}
log("elf - loaded ELF program in memory.\n");
return (program_t *)ret;
} }

View file

@ -4,48 +4,48 @@
#include <stdint.h> #include <stdint.h>
// ELF magic. // ELF magic.
#define EI_MAG0 0 #define EI_MAG0 0
#define ELFMAG0 0x7f #define ELFMAG0 0x7f
#define EI_MAG1 1 #define EI_MAG1 1
#define ELFMAG1 'E' #define ELFMAG1 'E'
#define EI_MAG2 2 #define EI_MAG2 2
#define ELFMAG2 'L' #define ELFMAG2 'L'
#define EI_MAG3 3 #define EI_MAG3 3
#define ELFMAG3 'F' #define ELFMAG3 'F'
// ELF class // ELF class
#define EI_CLASS 4 #define EI_CLASS 4
#define ELFCLASSNONE 0 #define ELFCLASSNONE 0
#define ELFCLASS32 1 #define ELFCLASS32 1
#define ELFCLASS64 2 #define ELFCLASS64 2
// Is processor-specific data little-endian or big-endian? // Is processor-specific data little-endian or big-endian?
#define EI_DATA 5 #define EI_DATA 5
#define ELFDATANONE 0 #define ELFDATANONE 0
#define ELFDATA2LSB 1 #define ELFDATA2LSB 1
#define ELFDATA2MSB 2 #define ELFDATA2MSB 2
// ELF version // ELF version
#define EI_VERSION 6 #define EI_VERSION 6
#define EV_NONE 0 #define EV_NONE 0
#define EV_CURRENT 1 #define EV_CURRENT 1
// ELF ABI // ELF ABI
#define EI_OSABI 7 #define EI_OSABI 7
#define ELFOSABI_NONE 0 #define ELFOSABI_NONE 0
#define ELFOSABI_SYSV 0 #define ELFOSABI_SYSV 0
#define ELFOSABI_HPUX 1 #define ELFOSABI_HPUX 1
#define ELFOSABI_NETBSD 2 #define ELFOSABI_NETBSD 2
#define ELFOSABI_LINUX 3 #define ELFOSABI_LINUX 3
#define ELFOSABI_SOLARIS 6 #define ELFOSABI_SOLARIS 6
#define ELFOSABI_IRIX 8 #define ELFOSABI_IRIX 8
#define ELFOSABI_FREEBSD 9 #define ELFOSABI_FREEBSD 9
#define ELFOSABI_TRU64 10 #define ELFOSABI_TRU64 10
#define ELFOSABI_ARM 97 #define ELFOSABI_ARM 97
#define ELFOSABI_STANDALONE 255 #define ELFOSABI_STANDALONE 255
// ABI version // ABI version
#define EI_ABIVERSION 8 #define EI_ABIVERSION 8
@ -57,14 +57,14 @@
#define EI_NIDENT 16 #define EI_NIDENT 16
// e_type // e_type
#define ET_NONE 0 #define ET_NONE 0
#define ET_REL 1 #define ET_REL 1
#define ET_EXEC 2 #define ET_EXEC 2
#define ET_DYN 3 #define ET_DYN 3
#define ET_CORE 4 #define ET_CORE 4
// e_machine (we only included machines supported by Soaplin.) // e_machine (we only included machines supported by Soaplin.)
#define EM_X86_64 62 #define EM_X86_64 62
typedef uint64_t Elf64_Addr; typedef uint64_t Elf64_Addr;
typedef uint64_t Elf64_Off; typedef uint64_t Elf64_Off;
@ -78,48 +78,48 @@ typedef int64_t Elf64_Sxword;
typedef uint64_t Elf64_Xword; typedef uint64_t Elf64_Xword;
typedef struct { typedef struct {
unsigned char e_ident[EI_NIDENT]; unsigned char e_ident[EI_NIDENT];
uint16_t e_type; uint16_t e_type;
uint16_t e_machine; uint16_t e_machine;
uint32_t e_version; uint32_t e_version;
Elf64_Addr e_entry; Elf64_Addr e_entry;
Elf64_Off e_phoff; Elf64_Off e_phoff;
Elf64_Off e_shoff; Elf64_Off e_shoff;
uint32_t e_flags; uint32_t e_flags;
uint16_t e_ehsize; uint16_t e_ehsize;
uint16_t e_phentsize; uint16_t e_phentsize;
uint16_t e_phnum; uint16_t e_phnum;
uint16_t e_shentsize; uint16_t e_shentsize;
uint16_t e_shnum; uint16_t e_shnum;
uint16_t e_shstrndx; uint16_t e_shstrndx;
} Elf64_Ehdr; } Elf64_Ehdr;
#define PT_NULL 0 #define PT_NULL 0
#define PT_LOAD 1 #define PT_LOAD 1
#define PT_DYNAMIC 2 #define PT_DYNAMIC 2
#define PT_INTERP 3 #define PT_INTERP 3
#define PT_NOTE 4 #define PT_NOTE 4
#define PT_SHLIB 5 #define PT_SHLIB 5
#define PF_X (1 << 0) #define PF_X (1 << 0)
#define PF_W (1 << 1) #define PF_W (1 << 1)
#define PF_R (1 << 2) #define PF_R (1 << 2)
typedef struct { typedef struct {
uint32_t p_type; uint32_t p_type;
uint32_t p_flags; uint32_t p_flags;
Elf64_Off p_offset; Elf64_Off p_offset;
Elf64_Addr p_vaddr; Elf64_Addr p_vaddr;
Elf64_Addr p_paddr; Elf64_Addr p_paddr;
uint64_t p_filesz; uint64_t p_filesz;
uint64_t p_memsz; uint64_t p_memsz;
uint64_t p_align; uint64_t p_align;
} Elf64_Phdr; } Elf64_Phdr;
typedef struct { typedef struct {
program_t program; program_t program;
Elf64_Ehdr *ehdr; Elf64_Ehdr *ehdr;
} elf_program_t; } elf_program_t;
program_t *elf_load(char *data); program_t *elf_load(char *data, int user);

View file

@ -8,18 +8,21 @@
#define EXEC_TYPE_ELF 0 #define EXEC_TYPE_ELF 0
typedef struct { typedef struct {
// The path to the program/script that will be executed. // The path to the program/script that will be executed.
char *path; char *path;
// The pagemap where the program's code is loaded. // The pagemap where the program's code is loaded.
pagemap_t *pm; pagemap_t *pm;
// The path to the first instruction. This will be passed to the new process's rip register. // The path to the first instruction. This will be passed to the new process's
uint64_t entry; // rip register.
uint64_t entry;
// The program type. Used to get additional, unneeded information out of a program // The program type. Used to get additional, unneeded information out of a
int type; // program
int type;
// That is what Soaplin needs to know. Executable file loaders are encouraged to extend this structure // That is what Soaplin needs to know. Executable file loaders are encouraged
// to include info such as the EHDR for the ELF loader... // to extend this structure to include info such as the EHDR for the ELF
// loader...
} program_t; } program_t;

View file

@ -1,258 +1,343 @@
unsigned char VGA8[] = { unsigned char VGA8[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd,
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff,
0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd,
0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e,
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18,
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18,
0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb,
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0,
0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00,
0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c,
0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18,
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c,
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,
0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18,
0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38,
0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c,
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe,
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18,
0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78,
0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6c,
0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe,
0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60,
0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xee,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6,
0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c,
0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c,
0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c,
0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc,
0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0,
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x60,
0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06,
0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xe0, 0x60,
0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6,
0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0,
0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60,
0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30,
0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66,
0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6,
0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e,
0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18,
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76,
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c,
0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x6c,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3c,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6,
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00,
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c,
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0,
0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3e, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44,
0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa, 0x55, 0xaa, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
}; 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36,
0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0,
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0,
0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8,
0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66,
0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66,
0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60,
0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00,
0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};

View file

@ -5,24 +5,24 @@
#include <stdint.h> #include <stdint.h>
#define VNODE_TYPE_FILE 0 #define VNODE_TYPE_FILE 0
#define VNODE_TYPE_DIR 1 #define VNODE_TYPE_DIR 1
#define VNODE_TYPE_DEV 2 #define VNODE_TYPE_DEV 2
typedef struct __vnode { typedef struct __vnode {
char name[128]; char name[128];
int type; int type;
struct __vnode *children; struct __vnode *children;
struct __vnode *next; struct __vnode *next;
struct __vnode *parent; struct __vnode *parent;
void(*write)(void *buffer, uint64_t off, uint64_t size); void (*write)(void *buffer, uint64_t off, uint64_t size);
void(*read)(void *buffer, uint64_t off, uint64_t size); void (*read)(void *buffer, uint64_t off, uint64_t size);
} vnode; } vnode;
typedef struct __vfs_mount { typedef struct __vfs_mount {
struct vfs_node *mount_point; // The directory in the main VFS where this is mounted struct vfs_node
struct vfs_node *mounted_root; // The root node of the mounted filesystem *mount_point; // The directory in the main VFS where this is mounted
struct vfs_mount *next; // Pointer to next mount point struct vfs_node *mounted_root; // The root node of the mounted filesystem
struct vfs_mount *next; // Pointer to next mount point
} vfs_mount; } vfs_mount;

View file

@ -2,17 +2,16 @@
#include <stdint.h> #include <stdint.h>
typedef struct spinlock typedef struct spinlock {
{ volatile int locked;
volatile int locked;
} spinlock_t; } spinlock_t;
inline void spinlock_acquire(spinlock_t *lock) { inline void spinlock_acquire(spinlock_t *lock) {
while (__sync_lock_test_and_set(&(lock)->locked, 1)) while (__sync_lock_test_and_set(&(lock)->locked, 1))
while ((lock)->locked) while ((lock)->locked)
__asm__ volatile("pause"); __asm__ volatile("pause");
} }
inline void spinlock_release(spinlock_t *lock) { inline void spinlock_release(spinlock_t *lock) {
__sync_lock_release(&(lock)->locked); __sync_lock_release(&(lock)->locked);
} }

175
kernel/src/main.c Executable file → Normal file
View file

@ -1,49 +1,49 @@
#include "exec/elf.h" #include "exec/elf.h"
#include "exec/exec.h" #include "exec/exec.h"
#include "mm/liballoc/liballoc.h"
#include "mm/pmm.h" #include "mm/pmm.h"
#include "mm/vma.h" #include "mm/vma.h"
#include "mm/vmm.h" #include "mm/vmm.h"
#include "mm/liballoc/liballoc.h"
#include "sched/sched.h" #include "sched/sched.h"
#include "sys/acpi.h"
#include "sys/arch/x86_64/pit.h" #include "sys/arch/x86_64/pit.h"
#include "sys/arch/x86_64/sse.h" #include "sys/arch/x86_64/sse.h"
#include "sys/syscall.h" #include "sys/syscall.h"
#include <sys/log.h> #include <font.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <limine.h> #include <limine.h>
#include <sys/printf.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/arch/x86_64/fpu.h>
#include <sys/arch/x86_64/gdt.h> #include <sys/arch/x86_64/gdt.h>
#include <sys/arch/x86_64/idt.h> #include <sys/arch/x86_64/idt.h>
#include <sys/arch/x86_64/fpu.h>
#include <sys/gfx/flanterm/flanterm.h>
#include <sys/gfx/flanterm/backends/fb.h> #include <sys/gfx/flanterm/backends/fb.h>
#include <font.h> #include <sys/gfx/flanterm/flanterm.h>
#include <sys/log.h>
#include <sys/printf.h>
// Set the base revision to 3, this is recommended as this is the latest // Set the base revision to 3, this is recommended as this is the latest
// base revision described by the Limine boot protocol specification. // base revision described by the Limine boot protocol specification.
// See specification for further info. // See specification for further info.
__attribute__((used, section(".limine_requests"))) __attribute__((
static volatile LIMINE_BASE_REVISION(3); used, section(".limine_requests"))) static volatile LIMINE_BASE_REVISION(3);
// The Limine requests can be placed anywhere, but it is important that // The Limine requests can be placed anywhere, but it is important that
// the compiler does not optimise them away, so, usually, they should // the compiler does not optimise them away, so, usually, they should
// be made volatile or equivalent, _and_ they should be accessed at least // be made volatile or equivalent, _and_ they should be accessed at least
// once or marked as used with the "used" attribute as done here. // once or marked as used with the "used" attribute as done here.
__attribute__((used, section(".limine_requests"))) __attribute__((
static volatile struct limine_framebuffer_request framebuffer_request = { used,
.id = LIMINE_FRAMEBUFFER_REQUEST, section(
.revision = 0 ".limine_requests"))) static volatile struct limine_framebuffer_request
}; framebuffer_request = {.id = LIMINE_FRAMEBUFFER_REQUEST, .revision = 0};
__attribute__((used, section(".limine_requests"))) __attribute__((
static volatile struct limine_module_request module_request = { used,
.id = LIMINE_MODULE_REQUEST, section(".limine_requests"))) static volatile struct limine_module_request
.revision = 0 module_request = {.id = LIMINE_MODULE_REQUEST, .revision = 0};
};
/*__attribute__((used, section(".limine_requests"))) /*__attribute__((used, section(".limine_requests")))
static volatile struct limine_entry_point_request entrypoint_request = { static volatile struct limine_entry_point_request entrypoint_request = {
@ -53,24 +53,26 @@ static volatile struct limine_entry_point_request entrypoint_request = {
// Finally, define the start and end markers for the Limine requests. // Finally, define the start and end markers for the Limine requests.
// These can also be moved anywhere, to any .c file, as seen fit. // These can also be moved anywhere, to any .c file, as seen fit.
__attribute__((used, section(".limine_requests_start"))) __attribute__((used,
static volatile LIMINE_REQUESTS_START_MARKER; section(".limine_requests_"
"start"))) static volatile LIMINE_REQUESTS_START_MARKER;
__attribute__((used, section(".limine_requests_end")))
static volatile LIMINE_REQUESTS_END_MARKER;
__attribute__((
used,
section(
".limine_requests_end"))) static volatile LIMINE_REQUESTS_END_MARKER;
// Halt and catch fire function. // Halt and catch fire function.
static void hcf(void) { static void hcf(void) {
for (;;) { for (;;) {
#if defined (__x86_64__) #if defined(__x86_64__)
asm ("hlt"); asm("hlt");
#elif defined (__aarch64__) || defined (__riscv) #elif defined(__aarch64__) || defined(__riscv)
asm ("wfi"); asm("wfi");
#elif defined (__loongarch64) #elif defined(__loongarch64)
asm ("idle 0"); asm("idle 0");
#endif #endif
} }
} }
struct limine_framebuffer *fb; struct limine_framebuffer *fb;
@ -83,66 +85,61 @@ char kstack[8192];
// If renaming kmain() to something else, make sure to change the // If renaming kmain() to something else, make sure to change the
// linker script accordingly. // linker script accordingly.
void kmain(void) { void kmain(void) {
// Ensure the bootloader actually understands our base revision (see spec). // Ensure the bootloader actually understands our base revision (see spec).
/*if (LIMINE_BASE_REVISION_SUPPORTED == false) { /*if (LIMINE_BASE_REVISION_SUPPORTED == false) {
hcf(); hcf();
}*/ }*/
// Ensure we got a framebuffer. // Ensure we got a framebuffer.
if (framebuffer_request.response != NULL) { if (framebuffer_request.response != NULL) {
// Fetch the first framebuffer. // Fetch the first framebuffer.
struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0]; struct limine_framebuffer *framebuffer =
fb = framebuffer; framebuffer_request.response->framebuffers[0];
fb = framebuffer;
ft_ctx = flanterm_fb_init( ft_ctx = flanterm_fb_init(
NULL, NULL, NULL, framebuffer->address, framebuffer->width,
NULL, framebuffer->height, framebuffer->pitch, framebuffer->red_mask_size,
framebuffer->address, framebuffer->width, framebuffer->height, framebuffer->pitch, framebuffer->red_mask_shift, framebuffer->green_mask_size,
framebuffer->red_mask_size, framebuffer->red_mask_shift, framebuffer->green_mask_shift, framebuffer->blue_mask_size,
framebuffer->green_mask_size, framebuffer->green_mask_shift, framebuffer->blue_mask_shift, NULL, NULL, NULL, NULL, &fg, NULL, NULL,
framebuffer->blue_mask_size, framebuffer->blue_mask_shift, VGA8, 8, 16, 0, 0, 0, 0);
NULL, }
NULL, NULL,
NULL, &fg,
NULL, NULL,
VGA8, 8, 16, 0,
0, 0,
0
);
}
printf("\n Soaplin 1.0-sild is booting up your computer...\n\n"); printf("\n Soaplin 1.0-sild is booting up your computer...\n\n");
//printf("Physical kernel EP: %p", entrypoint_request.entry); // printf("Physical kernel EP: %p", entrypoint_request.entry);
gdt_init(&kstack[8192]); gdt_init(&kstack[8192]);
idt_init(); idt_init();
fpu_activate(); fpu_activate();
sse_init(); sse_init();
pmm_init(); pmm_init();
vmm_init(); vmm_init();
kernel_vma_context = vma_create_context(vmm_kernel_pm); kernel_vma_context = vma_create_context(vmm_kernel_pm);
if (!kernel_vma_context) { if (!kernel_vma_context) {
log("kernel - vma ctx creation failed. halting\n"); log("kernel - vma ctx creation failed. halting\n");
asm("cli"); asm("cli");
while (1)
asm("hlt");
}
syscall_init();
pit_init(1000);
sched_init();
//user_init();
struct limine_file *f = module_request.response->modules[0];
log("kmain - %s\n", f->path);
program_t *prog = elf_load((char*)f->address);
sched_create("Init", prog->entry, prog->pm, SCHED_USER_PROCESS);
log("kernel - Soaplin initialized sucessfully.\n");
while (1) while (1)
;;//__asm__ volatile ("hlt"); asm("hlt");
}
// acpi_init();
syscall_init();
pit_init(1000);
sched_init();
// user_init();
struct limine_file *f = module_request.response->modules[0];
log("kmain - %s\n", f->path);
program_t *prog = elf_load((char *)f->address, 1);
sched_create("Init", prog->entry, prog->pm, SCHED_USER_PROCESS);
log("kernel - Soaplin initialized sucessfully.\n");
while (1)
;
; //__asm__ volatile ("hlt");
} }

File diff suppressed because it is too large Load diff

View file

@ -1,40 +1,34 @@
#include "mm/liballoc/liballoc.h" #include "mm/liballoc/liballoc.h"
#include "mm/vmm.h" #include "mm/vmm.h"
#include <mm/vma.h>
#include <lib/spinlock.h> #include <lib/spinlock.h>
#include <mm/vma.h>
#include <stddef.h> #include <stddef.h>
extern vma_context_t *kernel_vma_context; extern vma_context_t *kernel_vma_context;
static spinlock_t liballoc_lock_var = { 0 }; static spinlock_t liballoc_lock_var = {0};
int liballoc_lock() int liballoc_lock() {
{ spinlock_acquire(&liballoc_lock_var);
spinlock_acquire(&liballoc_lock_var); return 0;
return 0;
} }
int liballoc_unlock() int liballoc_unlock() {
{ spinlock_release(&liballoc_lock_var);
spinlock_release(&liballoc_lock_var); return 0;
return 0;
} }
void *liballoc_alloc(size_t pages) void *liballoc_alloc(size_t pages) {
{ return vma_alloc(kernel_vma_context, pages, VMM_PRESENT | VMM_WRITABLE);
return vma_alloc(kernel_vma_context, pages, VMM_PRESENT | VMM_WRITABLE);
} }
int liballoc_free(void *ptr, size_t pages) int liballoc_free(void *ptr, size_t pages) {
{ (void)pages;
(void)pages; vma_free(kernel_vma_context, ptr);
vma_free(kernel_vma_context, ptr); return 0;
return 0;
} }
// void *malloc(size_t s) { return PREFIX(malloc)(s); }
// void *realloc(void *v, size_t s) { return PREFIX(realloc)(v, s); }
//void *malloc(size_t s) { return PREFIX(malloc)(s); } // void *calloc(size_t s1, size_t s) { return PREFIX(calloc)(s1, s); }
//void *realloc(void *v, size_t s) { return PREFIX(realloc)(v, s); } // void free(void *v) { return PREFIX(free)(v); }
//void *calloc(size_t s1, size_t s) { return PREFIX(calloc)(s1, s); }
//void free(void *v) { return PREFIX(free)(v); }

1
kernel/src/mm/memop.c Executable file → Normal file
View file

@ -10,7 +10,6 @@ void *memcpy(void *dest, const void *src, size_t n) {
uint8_t *pdest = (uint8_t *)dest; uint8_t *pdest = (uint8_t *)dest;
const uint8_t *psrc = (const uint8_t *)src; const uint8_t *psrc = (const uint8_t *)src;
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
pdest[i] = psrc[i]; pdest[i] = psrc[i];
} }

147
kernel/src/mm/pmm.c Executable file → Normal file
View file

@ -1,7 +1,7 @@
#include "limine.h" #include "limine.h"
#include <stddef.h>
#include <mm/memop.h> #include <mm/memop.h>
#include <mm/pmm.h> #include <mm/pmm.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <sys/log.h> #include <sys/log.h>
@ -10,105 +10,88 @@ struct limine_memmap_response *_memmap;
uint64_t hhdm_offset = 0x0; uint64_t hhdm_offset = 0x0;
__attribute__((used, section(".limine_requests"))) __attribute__((
struct limine_memmap_request mm_req = { used, section(".limine_requests"))) struct limine_memmap_request mm_req = {
.id = LIMINE_MEMMAP_REQUEST, .id = LIMINE_MEMMAP_REQUEST, .revision = 3};
.revision = 3
};
__attribute__((
used, section(".limine_requests"))) struct limine_hhdm_request hhdm_req = {
.id = LIMINE_HHDM_REQUEST, .revision = 3};
__attribute__((used, section(".limine_requests"))) int pmm_init() {
struct limine_hhdm_request hhdm_req = { uint64_t free_pages = 0;
.id = LIMINE_HHDM_REQUEST, hhdm_offset = hhdm_req.response->offset;
.revision = 3
};
int pmm_init() struct limine_memmap_response *memmap = mm_req.response;
{ _memmap = memmap;
uint64_t free_pages = 0;
hhdm_offset = hhdm_req.response->offset;
struct limine_memmap_response *memmap = mm_req.response; // DEBUG("mm", "----- PMM //INFO -----");
_memmap = memmap; int freemem = 0;
for (uint64_t i = 0; i < memmap->entry_count; i++) {
//DEBUG("mm", "----- PMM //INFO -----"); if (memmap->entries[i]->type == LIMINE_MEMMAP_USABLE) {
int freemem = 0; // DEBUG("mm", " - USABLE ENTRY\t\t@ 0x%.16llx, size: 0x%.16llx",
for (uint64_t i = 0; i < memmap->entry_count; i++) // memmap->entries[i]->base, memmap->entries[i]->length);
{ free_pages += DIV_ROUND_UP(memmap->entries[i]->length, PMM_PAGE_SIZE);
if (memmap->entries[i]->type == LIMINE_MEMMAP_USABLE) freemem += memmap->entries[i]->length;
{
//DEBUG("mm", " - USABLE ENTRY\t\t@ 0x%.16llx, size: 0x%.16llx", memmap->entries[i]->base, memmap->entries[i]->length);
free_pages += DIV_ROUND_UP(memmap->entries[i]->length, PMM_PAGE_SIZE);
freemem += memmap->entries[i]->length;
}
} }
}
uint64_t array_size = ALIGN_UP(free_pages * 8, PMM_PAGE_SIZE); uint64_t array_size = ALIGN_UP(free_pages * 8, PMM_PAGE_SIZE);
for (uint64_t i = 0; i < memmap->entry_count; i++) for (uint64_t i = 0; i < memmap->entry_count; i++) {
{ struct limine_memmap_entry *entry = memmap->entries[i];
struct limine_memmap_entry *entry = memmap->entries[i]; if (entry->length >= array_size && entry->type == LIMINE_MEMMAP_USABLE) {
if (entry->length >= array_size && entry->type == LIMINE_MEMMAP_USABLE) stack.pages = (uintptr_t *)HIGHER_HALF(entry->base);
{ entry->length -= array_size;
stack.pages = (uintptr_t*)HIGHER_HALF(entry->base); entry->base += array_size;
entry->length -= array_size; // DEBUG("mm", " - STACK START\t\t@ 0x%.16llx", stack.pages);
entry->base += array_size; break;
//DEBUG("mm", " - STACK START\t\t@ 0x%.16llx", stack.pages);
break;
}
} }
}
for (uint64_t i = 0; i < memmap->entry_count; i++) for (uint64_t i = 0; i < memmap->entry_count; i++) {
{ struct limine_memmap_entry *entry = memmap->entries[i];
struct limine_memmap_entry *entry = memmap->entries[i]; if (entry->type == LIMINE_MEMMAP_USABLE) {
if (entry->type == LIMINE_MEMMAP_USABLE) for (uint64_t j = 0; j < entry->length; j += PMM_PAGE_SIZE) {
{ stack.pages[stack.idx++] = entry->base + j;
for (uint64_t j = 0; j < entry->length; j += PMM_PAGE_SIZE) }
{
stack.pages[stack.idx++] = entry->base + j;
}
}
} }
}
stack.max = stack.idx; stack.max = stack.idx;
//DEBUG("mm", " - MAX INDEX:\t\t%d", stack.max); // DEBUG("mm", " - MAX INDEX:\t\t%d", stack.max);
//DEBUG("mm", " - CURRENT INDEX:\t%d", stack.idx); // DEBUG("mm", " - CURRENT INDEX:\t%d", stack.idx);
//DEBUG("mm", "--------------------"); // DEBUG("mm", "--------------------");
log("pmm - %dmb is available to us.\n", freemem / (1024 * 1024));
log("pmm - %dmb is available to us.\n", freemem / (1024 * 1024)); return 0;
return 0;
} }
void *pmm_request_page() void *pmm_request_page() {
{ if (stack.idx == 0) {
if (stack.idx == 0) // ERROR("mm", "No more pages available.");
{ log("pmm - out of memory.\n");
//ERROR("mm", "No more pages available."); asm("cli");
log("pmm - out of memory.\n"); while (1) {
asm("cli"); asm("hlt");
while (1) {
asm("hlt");
}
return NULL;
} }
return NULL;
}
uint64_t page_addr = stack.pages[--stack.idx]; uint64_t page_addr = stack.pages[--stack.idx];
memset(HIGHER_HALF(page_addr), 0, PMM_PAGE_SIZE); memset(HIGHER_HALF(page_addr), 0, PMM_PAGE_SIZE);
return (void *)page_addr; return (void *)page_addr;
} }
void pmm_free_page(void *ptr) void pmm_free_page(void *ptr) {
{ if (ptr == NULL)
if (ptr == NULL) return;
return;
if (stack.idx >= stack.max) if (stack.idx >= stack.max) {
{ // ERROR("mm", "Stack overflow attempt while freeing a page.");
//ERROR("mm", "Stack overflow attempt while freeing a page."); log("pmm - could not free the page: stack overflow.\n");
log("pmm - could not free the page: stack overflow.\n"); return;
return; }
}
stack.pages[stack.idx++] = (uint64_t)ptr; stack.pages[stack.idx++] = (uint64_t)ptr;
} }

12
kernel/src/mm/pmm.h Executable file → Normal file
View file

@ -4,16 +4,16 @@
#include <stdint.h> #include <stdint.h>
#define PMM_PAGE_SIZE 4096 #define PMM_PAGE_SIZE 4096
typedef struct pmm_stack typedef struct pmm_stack {
{ uintptr_t *pages;
uintptr_t *pages; uint64_t idx;
uint64_t idx; uint64_t max;
uint64_t max;
} pmm_stack_t; } pmm_stack_t;
extern uint64_t hhdm_offset; extern uint64_t hhdm_offset;
#define DIV_ROUND_UP(x, y) (((uint64_t)(x) + ((uint64_t)(y) - 1)) / (uint64_t)(y)) #define DIV_ROUND_UP(x, y) \
(((uint64_t)(x) + ((uint64_t)(y) - 1)) / (uint64_t)(y))
#define ALIGN_UP(x, y) (DIV_ROUND_UP(x, y) * (uint64_t)(y)) #define ALIGN_UP(x, y) (DIV_ROUND_UP(x, y) * (uint64_t)(y))
#define ALIGN_DOWN(x, y) (((uint64_t)(x) / (uint64_t)(y)) * (uint64_t)(y)) #define ALIGN_DOWN(x, y) (((uint64_t)(x) / (uint64_t)(y)) * (uint64_t)(y))

View file

@ -3,199 +3,179 @@
#include "mm/pmm.h" #include "mm/pmm.h"
#include "mm/vmm.h" #include "mm/vmm.h"
#include <mm/vma.h>
#include <mm/memop.h> #include <mm/memop.h>
#include <mm/vma.h>
#include <sys/log.h> #include <sys/log.h>
vma_context_t *kernel_vma_context; vma_context_t *kernel_vma_context;
vma_context_t *vma_create_context(pagemap_t *pagemap) vma_context_t *vma_create_context(pagemap_t *pagemap) {
{ log("vma - creating VMA context with pagemap: 0x%.16llx\n",
log("vma - creating VMA context with pagemap: 0x%.16llx\n", (uint64_t)pagemap); (uint64_t)pagemap);
vma_context_t *ctx = (vma_context_t *)HIGHER_HALF(pmm_request_page()); vma_context_t *ctx = (vma_context_t *)HIGHER_HALF(pmm_request_page());
if (ctx == NULL) if (ctx == NULL) {
{ log("vma - failed to allocate VMA context\n");
log("vma - failed to allocate VMA context\n"); return NULL;
return NULL; }
} log("vma - allocated VMA context at 0x%.16llx\n", (uint64_t)ctx);
log("vma - allocated VMA context at 0x%.16llx\n", (uint64_t)ctx); memset(ctx, 0, sizeof(vma_context_t));
memset(ctx, 0, sizeof(vma_context_t)); log("vma - zeroed out VMA context at 0x%.16llx\n", (uint64_t)ctx);
log("vma - zeroed out VMA context at 0x%.16llx\n", (uint64_t)ctx);
ctx->root = (vma_region_t *)HIGHER_HALF(pmm_request_page());
if (ctx->root == NULL)
{
log("vma - failed to allocate root region\n");
pmm_free_page((void *)PHYSICAL(ctx));
return NULL;
}
log("vma - allocated root region at 0x%.16llx\n", (uint64_t)ctx->root);
ctx->pagemap = pagemap;
ctx->root->start = PMM_PAGE_SIZE;
ctx->root->size = 0;
log("vma - VMA context created at 0x%.16llx with root region at 0x%.16llx\n", (uint64_t)ctx, (uint64_t)ctx->root);
return ctx;
}
void vma_destroy_context(vma_context_t *ctx)
{
log("vma - destroying VMA context at 0x%.16llx\n", (uint64_t)ctx);
if (ctx->root == NULL || ctx->pagemap == NULL)
{
log("vma - invalid context or root passed to vma_destroy_context\n");
return;
}
vma_region_t *region = ctx->root;
while (region != NULL)
{
log("vma - freeing region at 0x%.16llx\n", (uint64_t)region);
vma_region_t *next = region->next;
pmm_free_page((void *)PHYSICAL(region));
region = next;
}
ctx->root = (vma_region_t *)HIGHER_HALF(pmm_request_page());
if (ctx->root == NULL) {
log("vma - failed to allocate root region\n");
pmm_free_page((void *)PHYSICAL(ctx)); pmm_free_page((void *)PHYSICAL(ctx));
log("vma - destroyed VMA context at 0x%.16llx\n", (uint64_t)ctx); return NULL;
}
log("vma - allocated root region at 0x%.16llx\n", (uint64_t)ctx->root);
ctx->pagemap = pagemap;
ctx->root->start = PMM_PAGE_SIZE;
ctx->root->size = 0;
log("vma - VMA context created at 0x%.16llx with root region at 0x%.16llx\n",
(uint64_t)ctx, (uint64_t)ctx->root);
return ctx;
} }
void *vma_alloc(vma_context_t *ctx, uint64_t size, uint64_t flags) void vma_destroy_context(vma_context_t *ctx) {
{ log("vma - destroying VMA context at 0x%.16llx\n", (uint64_t)ctx);
if (ctx == NULL || ctx->root == NULL || ctx->pagemap == NULL)
{
log("vma - invalid context or root passed to vma_alloc\n");
return NULL;
}
vma_region_t *region = ctx->root; if (ctx->root == NULL || ctx->pagemap == NULL) {
vma_region_t *new_region; log("vma - invalid context or root passed to vma_destroy_context\n");
vma_region_t *last_region = ctx->root; return;
}
while (region != NULL) vma_region_t *region = ctx->root;
{ while (region != NULL) {
if (region->next == NULL || region->start + region->size < region->next->start) log("vma - freeing region at 0x%.16llx\n", (uint64_t)region);
{ vma_region_t *next = region->next;
new_region = (vma_region_t *)HIGHER_HALF(pmm_request_page()); pmm_free_page((void *)PHYSICAL(region));
if (new_region == NULL) region = next;
{ }
log("vma - failed to allocate new VMA region\n");
return NULL;
}
memset(new_region, 0, sizeof(vma_region_t)); pmm_free_page((void *)PHYSICAL(ctx));
new_region->size = size; log("vma - destroyed VMA context at 0x%.16llx\n", (uint64_t)ctx);
new_region->flags = flags; }
new_region->start = region->start + region->size;
new_region->next = region->next;
new_region->prev = region;
region->next = new_region;
for (uint64_t i = 0; i < size; i++) void *vma_alloc(vma_context_t *ctx, uint64_t size, uint64_t flags) {
{ if (ctx == NULL || ctx->root == NULL || ctx->pagemap == NULL) {
uint64_t page = (uint64_t)pmm_request_page(); log("vma - invalid context or root passed to vma_alloc\n");
if (page == 0) return NULL;
{ }
log("vma - failed to allocate physical memory for VMA region\n");
return NULL;
}
vmm_map(ctx->pagemap, new_region->start + i * PMM_PAGE_SIZE, page, new_region->flags); vma_region_t *region = ctx->root;
} vma_region_t *new_region;
vma_region_t *last_region = ctx->root;
return (void *)new_region->start; while (region != NULL) {
} if (region->next == NULL ||
region = region->next; region->start + region->size < region->next->start) {
} new_region = (vma_region_t *)HIGHER_HALF(pmm_request_page());
if (new_region == NULL) {
new_region = (vma_region_t *)HIGHER_HALF(pmm_request_page());
if (new_region == NULL)
{
log("vma - failed to allocate new VMA region\n"); log("vma - failed to allocate new VMA region\n");
return NULL; return NULL;
} }
memset(new_region, 0, sizeof(vma_region_t)); memset(new_region, 0, sizeof(vma_region_t));
new_region->size = size;
new_region->flags = flags;
new_region->start = region->start + region->size;
new_region->next = region->next;
new_region->prev = region;
region->next = new_region;
last_region->next = new_region; for (uint64_t i = 0; i < size; i++) {
new_region->prev = last_region;
new_region->start = last_region->start + last_region->size;
new_region->size = size;
new_region->flags = flags;
new_region->next = NULL;
for (uint64_t i = 0; i < size; i++)
{
uint64_t page = (uint64_t)pmm_request_page(); uint64_t page = (uint64_t)pmm_request_page();
if (page == 0) if (page == 0) {
{ log("vma - failed to allocate physical memory for VMA region\n");
log("vma - failed to allocate physical memory for VMA region\n"); return NULL;
return NULL;
} }
vmm_map(ctx->pagemap, new_region->start + i * PMM_PAGE_SIZE, page, new_region->flags); vmm_map(ctx->pagemap, new_region->start + i * PMM_PAGE_SIZE, page,
new_region->flags);
}
return (void *)new_region->start;
}
region = region->next;
}
new_region = (vma_region_t *)HIGHER_HALF(pmm_request_page());
if (new_region == NULL) {
log("vma - failed to allocate new VMA region\n");
return NULL;
}
memset(new_region, 0, sizeof(vma_region_t));
last_region->next = new_region;
new_region->prev = last_region;
new_region->start = last_region->start + last_region->size;
new_region->size = size;
new_region->flags = flags;
new_region->next = NULL;
for (uint64_t i = 0; i < size; i++) {
uint64_t page = (uint64_t)pmm_request_page();
if (page == 0) {
log("vma - failed to allocate physical memory for VMA region\n");
return NULL;
} }
return (void *)new_region->start; vmm_map(ctx->pagemap, new_region->start + i * PMM_PAGE_SIZE, page,
new_region->flags);
}
return (void *)new_region->start;
} }
void vma_free(vma_context_t *ctx, void *ptr) void vma_free(vma_context_t *ctx, void *ptr) {
{ if (ctx == NULL) {
if (ctx == NULL) log("vma - invalid context passed to vma_free\n");
{ return;
log("vma - invalid context passed to vma_free\n"); }
return;
vma_region_t *region = ctx->root;
while (region != NULL) {
if (region->start == (uint64_t)ptr) {
log("vma - found region to free at 0x%.16llx\n", (uint64_t)region);
break;
} }
region = region->next;
}
vma_region_t *region = ctx->root; if (region == NULL) {
while (region != NULL) log("vma - unable to find region to free at address 0x%.16llx\n",
{ (uint64_t)ptr);
if (region->start == (uint64_t)ptr) return;
{ }
log("vma - found region to free at 0x%.16llx\n", (uint64_t)region);
break; vma_region_t *prev = region->prev;
} vma_region_t *next = region->next;
region = region->next;
for (uint64_t i = 0; i < region->size; i++) {
uint64_t virt = region->start + i * PMM_PAGE_SIZE;
uint64_t phys = virt_to_phys(vmm_kernel_pm, virt);
if (phys != 0) {
pmm_free_page((void *)phys);
vmm_unmap(ctx->pagemap, virt);
} }
}
if (region == NULL) if (prev != NULL) {
{ prev->next = next;
log("vma - unable to find region to free at address 0x%.16llx\n", (uint64_t)ptr); }
return;
}
vma_region_t *prev = region->prev; if (next != NULL) {
vma_region_t *next = region->next; next->prev = prev;
}
for (uint64_t i = 0; i < region->size; i++) if (region == ctx->root) {
{ ctx->root = next;
uint64_t virt = region->start + i * PMM_PAGE_SIZE; }
uint64_t phys = virt_to_phys(vmm_kernel_pm, virt);
if (phys != 0) pmm_free_page((void *)PHYSICAL(region));
{
pmm_free_page((void *)phys);
vmm_unmap(ctx->pagemap, virt);
}
}
if (prev != NULL)
{
prev->next = next;
}
if (next != NULL)
{
next->prev = prev;
}
if (region == ctx->root)
{
ctx->root = next;
}
pmm_free_page((void *)PHYSICAL(region));
} }

View file

@ -3,23 +3,21 @@
#pragma once #pragma once
#include <mm/vmm.h>
#include <mm/pmm.h> #include <mm/pmm.h>
#include <mm/vmm.h>
#include <stdint.h> #include <stdint.h>
typedef struct vma_region typedef struct vma_region {
{ uint64_t start;
uint64_t start; uint64_t size;
uint64_t size; uint64_t flags;
uint64_t flags; struct vma_region *next;
struct vma_region *next; struct vma_region *prev;
struct vma_region *prev;
} vma_region_t; } vma_region_t;
typedef struct vma_context typedef struct vma_context {
{ pagemap_t *pagemap;
pagemap_t *pagemap; vma_region_t *root;
vma_region_t *root;
} vma_context_t; } vma_context_t;
extern vma_context_t *kernel_vma_context; extern vma_context_t *kernel_vma_context;

78
kernel/src/mm/vmm.c Executable file → Normal file
View file

@ -4,6 +4,7 @@
#include "mm/pmm.h" #include "mm/pmm.h"
#include "sys/log.h" #include "sys/log.h"
#include "vmm.h" #include "vmm.h"
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
__attribute__(( __attribute__((
@ -150,15 +151,16 @@ void vmm_load_pagemap(pagemap_t *pm) {
} }
static uint64_t *__vmm_get_next_lvl(uint64_t *level, uint64_t entry, static uint64_t *__vmm_get_next_lvl(uint64_t *level, uint64_t entry,
uint64_t flags) { uint64_t flags, bool alloc) {
if (!(level[entry] & 1)) { if (level[entry] & VMM_PRESENT)
uint64_t *pml = HIGHER_HALF(pmm_request_page()); return HIGHER_HALF(PTE_GET_ADDR(level[entry]));
if (alloc) {
uint64_t *pml = (uint64_t *)HIGHER_HALF(pmm_request_page());
memset(pml, 0, PMM_PAGE_SIZE); memset(pml, 0, PMM_PAGE_SIZE);
level[entry] = (uint64_t)PHYSICAL(pml); level[entry] = (uint64_t)PHYSICAL(pml) | flags;
return pml;
} }
level[entry] |= (flags & 0xFFF); return NULL;
return HIGHER_HALF(PTE_GET_ADDR(level[entry]));
} }
uint64_t vmm_get_flags(pagemap_t *pm, uint64_t vaddr) { uint64_t vmm_get_flags(pagemap_t *pm, uint64_t vaddr) {
@ -167,9 +169,15 @@ uint64_t vmm_get_flags(pagemap_t *pm, uint64_t vaddr) {
uint64_t pml2_entry = (vaddr >> 21) & 0x1ff; uint64_t pml2_entry = (vaddr >> 21) & 0x1ff;
uint64_t pml1_entry = (vaddr >> 12) & 0x1ff; uint64_t pml1_entry = (vaddr >> 12) & 0x1ff;
uint64_t *pml3 = __vmm_get_next_lvl(pm->toplevel, pml4_entry, 0); uint64_t *pml3 = __vmm_get_next_lvl(pm->toplevel, pml4_entry, 0, false);
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_entry, 0); if (!pml3)
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_entry, 0); return 0;
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_entry, 0, false);
if (!pml2)
return 0;
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_entry, 0, false);
if (!pml1)
return 0;
return pml1[pml1_entry] & 0x7000000000000FFF; return pml1[pml1_entry] & 0x7000000000000FFF;
} }
@ -180,14 +188,17 @@ uint64_t virt_to_phys(pagemap_t *pagemap, uint64_t virt) {
uint64_t pml2_idx = (virt >> 21) & 0x1FF; uint64_t pml2_idx = (virt >> 21) & 0x1FF;
uint64_t pml1_idx = (virt >> 12) & 0x1FF; uint64_t pml1_idx = (virt >> 12) & 0x1FF;
uint64_t *pml3 = __vmm_get_next_lvl(pagemap->toplevel, pml4_idx, 0); uint64_t *pml3 = __vmm_get_next_lvl(pagemap->toplevel, pml4_idx, 0, false);
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_idx, 0); if (!pml3)
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_idx, 0); return 0;
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_idx, 0, false);
if (!pml2)
return 0;
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_idx, 0, false);
if (!pml1)
return 0;
uint64_t phys_addr = uint64_t phys_addr = pml1[pml1_idx] & 0x000FFFFFFFFFF000;
pml1[pml1_idx] &
0x000FFFFFFFFFF000; // Masque pour obtenir l'adresse physique (en retirant
// les bits de flags)
return phys_addr; return phys_addr;
} }
@ -198,9 +209,30 @@ void vmm_map(pagemap_t *pm, uint64_t vaddr, uint64_t paddr, uint64_t flags) {
uint64_t pml2_entry = (vaddr >> 21) & 0x1ff; uint64_t pml2_entry = (vaddr >> 21) & 0x1ff;
uint64_t pml1_entry = (vaddr >> 12) & 0x1ff; uint64_t pml1_entry = (vaddr >> 12) & 0x1ff;
uint64_t *pml3 = __vmm_get_next_lvl(pm->toplevel, pml4_entry, flags); uint64_t *pml3 = __vmm_get_next_lvl(pm->toplevel, pml4_entry,
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_entry, flags); VMM_PRESENT | VMM_WRITABLE, true);
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_entry, flags); uint64_t *pml2 =
__vmm_get_next_lvl(pml3, pml3_entry, VMM_PRESENT | VMM_WRITABLE, true);
uint64_t *pml1 =
__vmm_get_next_lvl(pml2, pml2_entry, VMM_PRESENT | VMM_WRITABLE, true);
pml1[pml1_entry] = paddr | flags;
}
void vmm_map_user(pagemap_t *pm, uint64_t vaddr, uint64_t paddr,
uint64_t flags) {
uint64_t pml4_entry = (vaddr >> 39) & 0x1ff;
uint64_t pml3_entry = (vaddr >> 30) & 0x1ff;
uint64_t pml2_entry = (vaddr >> 21) & 0x1ff;
uint64_t pml1_entry = (vaddr >> 12) & 0x1ff;
uint64_t *pml3 =
__vmm_get_next_lvl(pm->toplevel, pml4_entry, flags,
true); // PML3 / Page Directory Pointer Entry
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_entry, flags,
true); // PML2 / Page Directory Entry
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_entry, flags,
true); // PML1 / Page Table Entry
pml1[pml1_entry] = paddr | flags; pml1[pml1_entry] = paddr | flags;
} }
@ -211,13 +243,13 @@ void vmm_unmap(pagemap_t *pm, uint64_t vaddr) {
uint64_t pml3_entry = (vaddr >> 30) & 0x1ff; uint64_t pml3_entry = (vaddr >> 30) & 0x1ff;
uint64_t pml4_entry = (vaddr >> 39) & 0x1ff; uint64_t pml4_entry = (vaddr >> 39) & 0x1ff;
uint64_t *pml3 = __vmm_get_next_lvl(pm->toplevel, pml4_entry, 0); uint64_t *pml3 = __vmm_get_next_lvl(pm->toplevel, pml4_entry, 0, false);
if (pml3 == NULL) if (pml3 == NULL)
return; return;
uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_entry, 0); uint64_t *pml2 = __vmm_get_next_lvl(pml3, pml3_entry, 0, false);
if (pml2 == NULL) if (pml2 == NULL)
return; return;
uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_entry, 0); uint64_t *pml1 = __vmm_get_next_lvl(pml2, pml2_entry, 0, false);
if (pml1 == NULL) if (pml1 == NULL)
return; return;

17
kernel/src/mm/vmm.h Executable file → Normal file
View file

@ -6,10 +6,10 @@
#define PTE_GET_ADDR(VALUE) ((VALUE) & PTE_ADDR_MASK) #define PTE_GET_ADDR(VALUE) ((VALUE) & PTE_ADDR_MASK)
#define PTE_GET_FLAGS(VALUE) ((VALUE) & ~PTE_ADDR_MASK) #define PTE_GET_FLAGS(VALUE) ((VALUE) & ~PTE_ADDR_MASK)
#define VMM_PRESENT (1 << 0) #define VMM_PRESENT (1 << 0)
#define VMM_WRITABLE (1 << 1) #define VMM_WRITABLE (1 << 1)
#define VMM_USER (1 << 2) #define VMM_USER (1 << 2)
#define VMM_NX (1ULL << 63) #define VMM_NX (1ULL << 63)
typedef char sym[]; typedef char sym[];
@ -25,9 +25,8 @@ extern sym rodata_end_ld;
extern sym data_start_ld; extern sym data_start_ld;
extern sym data_end_ld; extern sym data_end_ld;
typedef struct pagemap { typedef struct pagemap {
uint64_t *toplevel; uint64_t *toplevel;
} pagemap_t; } pagemap_t;
extern pagemap_t *vmm_kernel_pm; extern pagemap_t *vmm_kernel_pm;
@ -37,7 +36,11 @@ pagemap_t *vmm_alloc_pm();
void vmm_init(); void vmm_init();
void vmm_release_pm(pagemap_t *pm); void vmm_release_pm(pagemap_t *pm);
void vmm_load_pagemap(pagemap_t *pm); void vmm_load_pagemap(pagemap_t *pm);
uint64_t vmm_get_flags(pagemap_t* pm, uint64_t vaddr); uint64_t vmm_get_flags(pagemap_t *pm, uint64_t vaddr);
uint64_t virt_to_phys(pagemap_t *pagemap, uint64_t virt); uint64_t virt_to_phys(pagemap_t *pagemap, uint64_t virt);
// NOTE: for user mode, please use vmm_map_user instead.
void vmm_map(pagemap_t *pm, uint64_t vaddr, uint64_t paddr, uint64_t flags); void vmm_map(pagemap_t *pm, uint64_t vaddr, uint64_t paddr, uint64_t flags);
void vmm_unmap(pagemap_t *pm, uint64_t vaddr) ; void vmm_map_user(pagemap_t *pm, uint64_t vaddr, uint64_t paddr,
uint64_t flags);
void vmm_unmap(pagemap_t *pm, uint64_t vaddr);

227
kernel/src/sched/sched.c Executable file → Normal file
View file

@ -1,6 +1,6 @@
#include "sched/sched.h" #include "sched/sched.h"
#include "mm/pmm.h"
#include "mm/memop.h" #include "mm/memop.h"
#include "mm/pmm.h"
#include "mm/vmm.h" #include "mm/vmm.h"
#include "sys/arch/x86_64/idt.h" #include "sys/arch/x86_64/idt.h"
#include "sys/log.h" #include "sys/log.h"
@ -11,148 +11,155 @@ sched_process *curr_proc;
int current_pid = 0; int current_pid = 0;
int standby = 0; int standby = 0;
void map_range_to_pagemap(pagemap_t *dest_pagemap, pagemap_t *src_pagemap, uint64_t start, uint64_t size, uint64_t flags) void map_range_to_pagemap(pagemap_t *dest_pagemap, pagemap_t *src_pagemap,
{ uint64_t start, uint64_t size, int user,
for (uint64_t offset = 0; offset < size; offset += PMM_PAGE_SIZE) uint64_t flags) {
{ for (uint64_t offset = 0; offset < size; offset += PMM_PAGE_SIZE) {
uint64_t phys = virt_to_phys(src_pagemap, start + offset); uint64_t phys = virt_to_phys(src_pagemap, start + offset);
if (phys) if (phys) {
{ if (user)
vmm_map(dest_pagemap, start + offset, phys, flags); vmm_map_user(dest_pagemap, start + offset, phys, flags);
} else
vmm_map(dest_pagemap, start + offset, phys, flags);
} }
}
} }
void sched_init() { void sched_init() {
// TODO: It may be good to implement heap memory to save space. // TODO: It may be good to implement heap memory to save space.
// We must initialize the process list. // We must initialize the process list.
// By default, sched_create will append to this list. // By default, sched_create will append to this list.
proc_list = pmm_request_page(); proc_list = pmm_request_page();
memcpy(proc_list->name, "System\0", 7); memcpy(proc_list->name, "System\0", 7);
proc_list->pid = -1; proc_list->pid = -1;
proc_list->type = SCHED_EMPTY; proc_list->type = SCHED_EMPTY;
curr_proc = proc_list; curr_proc = proc_list;
standby = 1; standby = 1;
log("sched - As there's nothing " log("sched - As there's nothing "
"to schedule, the scheduler entered standby" "to schedule, the scheduler entered standby"
"mode.\n"); "mode.\n");
} }
sched_process *sched_create(char *name, uint64_t entry_point, pagemap_t* pm, uint32_t flags) sched_process *sched_create(char *name, uint64_t entry_point, pagemap_t *pm,
{ uint32_t flags) {
// TODO: implement a separate strlen function // TODO: implement a separate strlen function
// as there's like 4 strlen impls in the kernel. // as there's like 4 strlen impls in the kernel.
int i = 0; int i = 0;
while (name[i] != 0) while (name[i] != 0)
i++; i++;
sched_process *proc = pmm_request_page(); sched_process *proc = pmm_request_page();
memset(proc, 0, sizeof(sched_process)); memset(proc, 0, sizeof(sched_process));
memcpy(proc->name, name, i); memcpy(proc->name, name, i);
proc->pid = current_pid; proc->pid = current_pid;
proc->type = SCHED_RUNNING; proc->type = SCHED_RUNNING;
proc->flags = flags; proc->flags = flags;
// We are about to setup the registers ourself. // We are about to setup the registers ourself.
// If it's broken, it's a boom in the ass of your computer // If it's broken, it's a boom in the ass of your computer
// (and a CPU exception) // (and a CPU exception)
proc->pm = pm; proc->pm = pm;
uint64_t *stack_phys = pmm_request_page(); uint64_t *stack_phys = pmm_request_page();
uint64_t *stack_virt = (uint64_t*)0x40000000; uint64_t *stack_virt = (uint64_t *)0x40000000;
if (flags == SCHED_KERNEL_PROCESS) { if (flags == SCHED_KERNEL_PROCESS) {
proc->stack_base = stack_phys; proc->stack_base = stack_phys;
proc->stack_base_physical = stack_phys; proc->stack_base_physical = stack_phys;
proc->stack_end = proc_list->stack_base + PMM_PAGE_SIZE; proc->stack_end = proc_list->stack_base + PMM_PAGE_SIZE;
} else if (flags == SCHED_USER_PROCESS) { } else if (flags == SCHED_USER_PROCESS) {
vmm_map(proc->pm, (uint64_t)stack_virt, (uint64_t)stack_phys, VMM_PRESENT | VMM_WRITABLE | VMM_USER); vmm_map_user(proc->pm, (uint64_t)stack_virt, (uint64_t)stack_phys,
proc->stack_base = stack_virt; VMM_PRESENT | VMM_WRITABLE | VMM_USER);
proc->stack_base_physical = stack_phys; proc->stack_base = stack_virt;
proc->stack_end = proc_list->stack_base + PMM_PAGE_SIZE; proc->stack_base_physical = stack_phys;
} proc->stack_end = proc_list->stack_base + PMM_PAGE_SIZE;
proc->regs.rip = (uint64_t)entry_point; }
proc->regs.rip = (uint64_t)entry_point;
if (flags == SCHED_KERNEL_PROCESS) { if (flags == SCHED_KERNEL_PROCESS) {
proc->regs.cs = 0x28; // Run in kernel mode proc->regs.cs = 0x28; // Run in kernel mode
proc->regs.ss = 0x30; proc->regs.ss = 0x30;
} } else if (flags == SCHED_USER_PROCESS) {
else if (flags == SCHED_USER_PROCESS) { proc->regs.cs = 0x43; // Run in user mode
proc->regs.cs = 0x43; // Run in user mode proc->regs.ss = 0x3B;
proc->regs.ss = 0x3B; }
} proc->regs.rflags = 0x202; // Enable interrupts
proc->regs.rflags = 0x202; // Enable interrupts proc->regs.rsp = (uint64_t)proc->stack_end;
proc->regs.rsp = (uint64_t)proc->stack_end; proc->regs.rbp = 0;
proc->regs.rbp = 0;
proc->next = curr_proc->next; proc->next = curr_proc->next;
curr_proc->next = proc; curr_proc->next = proc;
current_pid++; current_pid++;
map_range_to_pagemap(pm, vmm_kernel_pm, 0x1000, 0x10000, VMM_PRESENT | VMM_WRITABLE | VMM_USER); if (flags == SCHED_USER_PROCESS)
map_range_to_pagemap(pm, vmm_kernel_pm, 0x1000, 0x10000, 1,
VMM_PRESENT | VMM_WRITABLE | VMM_USER);
else
map_range_to_pagemap(pm, vmm_kernel_pm, 0x1000, 0x10000, 0,
VMM_PRESENT | VMM_WRITABLE);
if (standby) { if (standby) {
// Disable standby mode as there's actually something to // Disable standby mode as there's actually something to
// run, now. // run, now.
standby = 0; standby = 0;
log("sched - Standby mode has been" log("sched - Standby mode has been"
"disabled.\n"); "disabled.\n");
} }
log("sched - created process '%s' (pid: %d, rip: %p)\n", proc->name, proc->pid, proc->regs.rip); log("sched - created process '%s' (pid: %d, rip: %p)\n", proc->name,
return proc; proc->pid, proc->regs.rip);
return proc;
} }
void sched_exit(int exit_code) { void sched_exit(int exit_code) {
log("sched - Process %d exited with code %d!", curr_proc->pid, exit_code); log("sched - Process %d exited with code %d!", curr_proc->pid, exit_code);
curr_proc->type = SCHED_DIED; curr_proc->type = SCHED_DIED;
schedule(&curr_proc->regs); schedule(&curr_proc->regs);
} }
void schedule(registers_t *regs) void schedule(registers_t *regs) {
{ if (standby) {
if (standby) { // log("sched - Sched is in standby.\n");
//log("sched - Sched is in standby.\n"); return;
return; }
memcpy(&curr_proc->regs, regs, sizeof(registers_t));
if (curr_proc->type == SCHED_DIED) {
sched_process *prev_proc = proc_list;
while (prev_proc->next != curr_proc) {
prev_proc = prev_proc->next;
} }
memcpy(&curr_proc->regs, regs, sizeof(registers_t)); prev_proc->next = curr_proc->next;
if (curr_proc->type == SCHED_DIED) { // Now, it is safe to free the process's memory.
sched_process *prev_proc = proc_list; vmm_release_pm(curr_proc->pm);
while (prev_proc->next != curr_proc) { pmm_free_page(curr_proc->stack_base_physical);
prev_proc = prev_proc->next;
}
prev_proc->next = curr_proc->next; // R.I.P. process
pmm_free_page(curr_proc);
// Now, it is safe to free the process's memory. return;
vmm_release_pm(curr_proc->pm); }
pmm_free_page(curr_proc->stack_base_physical);
// R.I.P. process curr_proc = curr_proc->next;
pmm_free_page(curr_proc); if (curr_proc == NULL)
curr_proc = proc_list;
return; // log("sched - I choosed process %d\n", curr_proc->pid);
} memcpy(regs, &curr_proc->regs, sizeof(registers_t));
curr_proc = curr_proc->next; // Finally, load our pagemap
if (curr_proc == NULL) // if (memcmp(curr_proc->name, "Init", 4)== 0) {
curr_proc = proc_list; vmm_load_pagemap(curr_proc->pm);
// asm("cli");
//log("sched - I choosed process %d\n", curr_proc->pid); // while (1)
memcpy(regs, &curr_proc->regs, sizeof(registers_t)); // asm("hlt");}
// Finally, load our pagemap
//if (memcmp(curr_proc->name, "Init", 4)== 0) {
vmm_load_pagemap(curr_proc->pm);
//asm("cli");
//while (1)
// asm("hlt");}
} }

35
kernel/src/sched/sched.h Executable file → Normal file
View file

@ -4,28 +4,26 @@
#include "sys/arch/x86_64/idt.h" #include "sys/arch/x86_64/idt.h"
#define SCHED_KERNEL_PROCESS 0 // A process that runs in kernel mode. #define SCHED_KERNEL_PROCESS 0 // A process that runs in kernel mode.
#define SCHED_USER_PROCESS 1 // A process that runs in userspace. The code MUST be mapped directly after creating the process. #define SCHED_USER_PROCESS \
1 // A process that runs in userspace. The code MUST be mapped directly after
// creating the process.
typedef enum { typedef enum { SCHED_RUNNING, SCHED_DIED, SCHED_EMPTY } sched_proc_type;
SCHED_RUNNING,
SCHED_DIED,
SCHED_EMPTY
} sched_proc_type;
typedef struct _sched_process { typedef struct _sched_process {
char name[128]; char name[128];
int pid; int pid;
int type; int type;
int flags; int flags;
registers_t regs; registers_t regs;
pagemap_t *pm; pagemap_t *pm;
uint64_t *stack_end; uint64_t *stack_end;
uint64_t *stack_base; uint64_t *stack_base;
uint64_t *stack_base_physical; uint64_t *stack_base_physical;
struct _sched_process *next; struct _sched_process *next;
} sched_process; } sched_process;
extern sched_process *curr_proc; extern sched_process *curr_proc;
@ -33,9 +31,10 @@ extern sched_process *proc_list;
// The idle process is ditched in favor of standby mode, // The idle process is ditched in favor of standby mode,
// which activates when there's nothing to run. // which activates when there's nothing to run.
//extern sched_process *idle_process; // extern sched_process *idle_process;
void sched_init(); void sched_init();
sched_process *sched_create(char *name, uint64_t entry_point, pagemap_t *pm, uint32_t flags); sched_process *sched_create(char *name, uint64_t entry_point, pagemap_t *pm,
uint32_t flags);
void sched_exit(int exit_code); void sched_exit(int exit_code);
void schedule(registers_t *regs); void schedule(registers_t *regs);

95
kernel/src/sys/acpi.c Normal file
View file

@ -0,0 +1,95 @@
#include "limine.h"
#include "mm/pmm.h"
#include "sys/log.h"
#include <mm/memop.h>
#include <stddef.h>
#include <sys/acpi.h>
__attribute__((
used,
section(".limine_requests"))) static volatile struct limine_rsdp_request
rsdp_req = {.revision = 0, .id = LIMINE_RSDP_REQUEST};
rsdp_t *rsdp;
int acpi_available = 0;
int is_xsdt = 0;
xsdt_t *xsdt;
rsdt_t *rsdt;
int item_count = 0;
static int acpi_validate_rsdp(char *byte_array, size_t size) {
uint32_t sum = 0;
for (int i = 0; i < size; i++) {
sum += byte_array[i];
}
return (sum & 0xFF) == 0;
}
void *acpi_find_table(char *sign, int sign_size) {
if (!acpi_available)
return NULL;
if (is_xsdt) {
for (int i = 0; i < item_count; i++) {
uint64_t *lst =
(uint64_t *)HIGHER_HALF((uint64_t)xsdt->PointerToOtherSDT);
acpi_table_header_t *ptr = (acpi_table_header_t *)HIGHER_HALF(lst[i]);
if (!memcmp(ptr->Signature, sign, sign_size))
return (void *)ptr;
}
} else {
for (int i = 0; i < item_count; i++) {
acpi_table_header_t *ptr = (acpi_table_header_t *)HIGHER_HALF(
(uint64_t)rsdt->PointerToOtherSDT[i]);
if (!memcmp(ptr->Signature, sign, sign_size))
return (void *)ptr;
}
}
return NULL;
}
void acpi_init() {
rsdp_t *rsdp = (rsdp_t *)HIGHER_HALF(rsdp_req.response->address);
if (!rsdp) {
log("acpi - not available: RSDP is NULL!\n");
return;
}
if (rsdp->rev < 2) {
if (!acpi_validate_rsdp((char *)rsdp, sizeof(rsdp_t))) {
log("acpi - not available: Was the RSDP hijacked?\n");
return;
}
rsdt = (rsdt_t *)HIGHER_HALF((uint64_t)rsdp->rsdt_addr);
log("acpi - RSDT found at %p\n", rsdt);
item_count = (rsdt->h.Length - sizeof(acpi_table_header_t)) / 4;
log("acpi - RSDT contains %d entries\n", item_count);
} else {
is_xsdt = 1;
if (!acpi_validate_rsdp((char *)rsdp, sizeof(xsdp_t))) {
log("acpi - not available: Was the XSDP hijacked?\n");
return;
}
xsdt = (xsdt_t *)HIGHER_HALF((uint64_t)((xsdp_t *)rsdp)->xsdt_addr);
log("acpi - XSDT found at %p\n", xsdt);
item_count = (xsdt->h.Length - sizeof(acpi_table_header_t)) / 8;
log("acpi - XSDT contains %d entries\n", item_count);
}
acpi_available = 1;
void *fadt = acpi_find_table("FACP", 4);
if (!fadt) {
log("acpi - FADT not found\n");
acpi_available = 0;
return;
} else {
log("acpi - FADT found at %p\n", fadt);
log("acpi - ACPI initialized successfully\n");
}
}

51
kernel/src/sys/acpi.h Normal file
View file

@ -0,0 +1,51 @@
#pragma once
#include <stdint.h>
#define ACPI_RSDP_SIGNATURE "RSD PTR "
#define ACPI_RSDP_SIGNATURE_LEN 7
typedef struct __acpi_table_header {
char Signature[4];
uint32_t Length;
uint8_t Revision;
uint8_t Checksum;
char OEMID[6];
char OEMTableID[8];
uint32_t OEMRevision;
uint32_t CreatorID;
uint32_t CreatorRevision;
} acpi_table_header_t;
typedef struct __rsdp {
char signature[8];
uint8_t chksum;
char oemid[6];
uint8_t rev;
uint32_t rsdt_addr;
} __attribute__((packed)) rsdp_t;
typedef struct __xsdp {
char signature[8];
uint8_t chksum;
char oemid[6];
uint8_t rev;
uint32_t rsdt_addr; // deprecated since version 2.0
uint32_t len;
uint64_t xsdt_addr;
uint8_t chksum_ex;
uint8_t reserved[3];
} __attribute__((packed)) xsdp_t;
typedef struct __rsdt {
acpi_table_header_t h;
uint32_t *PointerToOtherSDT;
} rsdt_t;
typedef struct __xsdt {
acpi_table_header_t h;
uint64_t *PointerToOtherSDT;
} xsdt_t;
void acpi_init();

948
kernel/src/sys/arch/x86_64/cpuid.h Executable file → Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,12 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
void fpu_set_cw(const uint16_t cw) { void fpu_set_cw(const uint16_t cw) { asm volatile("fldcw %0" ::"m"(cw)); }
asm volatile("fldcw %0" :: "m"(cw));
}
void fpu_activate() { void fpu_activate() {
size_t cr4; size_t cr4;
asm volatile ("mov %%cr4, %0" : "=r"(cr4)); asm volatile("mov %%cr4, %0" : "=r"(cr4));
cr4 |= 0x200; cr4 |= 0x200;
asm volatile ("mov %0, %%cr4" :: "r"(cr4)); asm volatile("mov %0, %%cr4" ::"r"(cr4));
fpu_set_cw(0x37F); fpu_set_cw(0x37F);
} }

45
kernel/src/sys/arch/x86_64/gdt.c Executable file → Normal file
View file

@ -1,32 +1,29 @@
//#include "sys/log.h" // #include "sys/log.h"
#include <mm/memop.h>
#include <stdint.h> #include <stdint.h>
#include <sys/arch/x86_64/gdt.h> #include <sys/arch/x86_64/gdt.h>
#include <sys/log.h> #include <sys/log.h>
#include <mm/memop.h>
gdt_table def_table = { gdt_table def_table = {{
{ 0x0000000000000000, // 0x00
0x0000000000000000, // 0x00
0x00009a000000ffff, // 0x08 16 bit code 0x00009a000000ffff, // 0x08 16 bit code
0x000093000000ffff, // 0x10 16 bit data 0x000093000000ffff, // 0x10 16 bit data
0x00cf9a000000ffff, // 0x18 32 bit code 0x00cf9a000000ffff, // 0x18 32 bit code
0x00cf93000000ffff, // 0x20 32 bit data 0x00cf93000000ffff, // 0x20 32 bit data
0x00af9b000000ffff, // 0x28 64 bit code cs 0x00af9b000000ffff, // 0x28 64 bit code cs
0x00af93000000ffff, // 0x30 64 bit data ss 0x00af93000000ffff, // 0x30 64 bit data ss
0x00aff3000000ffff, // 0x38 data ss 0x00aff3000000ffff, // 0x38 data ss
0x00affb000000ffff, // 0x40 user mode code cs 0x00affb000000ffff, // 0x40 user mode code cs
}, },
{ {}};
}
};
tssr tss_list[256]; // One tssr per CPU tssr tss_list[256]; // One tssr per CPU
void gdt_init( char* kstack ) { void gdt_init(char *kstack) {
// TODO: adapt for multiprocessor kernel // TODO: adapt for multiprocessor kernel
tss_list[0].rsp[0] = (uint64_t)kstack; tss_list[0].rsp[0] = (uint64_t)kstack;
@ -41,14 +38,12 @@ void gdt_init( char* kstack ) {
def_table.tss_entry.base3 = (uint32_t)(tss >> 32); def_table.tss_entry.base3 = (uint32_t)(tss >> 32);
def_table.tss_entry.resv = 0; def_table.tss_entry.resv = 0;
gdtr gdt = (gdtr){ gdtr gdt =
.size = (sizeof(gdt_table)) - 1, (gdtr){.size = (sizeof(gdt_table)) - 1, .address = (uint64_t)&def_table};
.address = (uint64_t)&def_table
};
__asm__ volatile ("lgdt %0\n\t" : : "m"(gdt) : "memory"); __asm__ volatile("lgdt %0\n\t" : : "m"(gdt) : "memory");
__asm__ volatile ("ltr %0\n\t" : : "r"((uint16_t)0x48)); __asm__ volatile("ltr %0\n\t" : : "r"((uint16_t)0x48));
//logln(progress, "kinit stage 1", "GDT initialized\n"); // logln(progress, "kinit stage 1", "GDT initialized\n");
log("gdt - initialized.\n"); log("gdt - initialized.\n");
} }

11
kernel/src/sys/arch/x86_64/gdt.h Executable file → Normal file
View file

@ -5,10 +5,10 @@
typedef struct { typedef struct {
uint16_t length; uint16_t length;
uint16_t base; uint16_t base;
uint8_t base1; uint8_t base1;
uint8_t flags; uint8_t flags;
uint8_t flags1; uint8_t flags1;
uint8_t base2; uint8_t base2;
uint32_t base3; uint32_t base3;
uint32_t resv; uint32_t resv;
} __attribute__((packed)) tss_entry; } __attribute__((packed)) tss_entry;
@ -23,7 +23,6 @@ typedef struct {
uint64_t address; uint64_t address;
} __attribute__((packed)) gdtr; } __attribute__((packed)) gdtr;
typedef struct { typedef struct {
uint32_t resv; uint32_t resv;
uint64_t rsp[4]; uint64_t rsp[4];
@ -34,4 +33,4 @@ typedef struct {
uint16_t iopb; uint16_t iopb;
} __attribute__((packed)) tssr; // Per CPU } __attribute__((packed)) tssr; // Per CPU
void gdt_init(char* kstack); void gdt_init(char *kstack);

61
kernel/src/sys/arch/x86_64/idt.c Executable file → Normal file
View file

@ -1,50 +1,51 @@
//#include "sys/log.h" // #include "sys/log.h"
#include "sys/arch/x86_64/pic.h" #include "sys/arch/x86_64/pic.h"
#include <sys/arch/x86_64/idt.h> #include <sys/arch/x86_64/idt.h>
#include <sys/log.h> #include <sys/log.h>
__attribute__((aligned(0x10))) __attribute__((aligned(0x10))) static idt_entry_t idt[256];
static idt_entry_t idt[256];
static idtr_t idtr; static idtr_t idtr;
void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags) { void idt_set_descriptor(uint8_t vector, void *isr, uint8_t flags) {
idt_entry_t* descriptor = &idt[vector]; idt_entry_t *descriptor = &idt[vector];
descriptor->isr_low = (uint64_t)isr & 0xFFFF; descriptor->isr_low = (uint64_t)isr & 0xFFFF;
descriptor->kernel_cs = 0x28; descriptor->kernel_cs = 0x28;
descriptor->ist = 0; descriptor->ist = 0;
descriptor->attributes = flags; descriptor->attributes = flags;
descriptor->isr_mid = ((uint64_t)isr >> 16) & 0xFFFF; descriptor->isr_mid = ((uint64_t)isr >> 16) & 0xFFFF;
descriptor->isr_high = ((uint64_t)isr >> 32) & 0xFFFFFFFF; descriptor->isr_high = ((uint64_t)isr >> 32) & 0xFFFFFFFF;
descriptor->reserved = 0; descriptor->reserved = 0;
} }
static int vectors[256]; static int vectors[256];
extern void* isr_stub_table[]; extern void *isr_stub_table[];
void idt_init() { void idt_init() {
idtr.base = (uintptr_t)&idt[0]; idtr.base = (uintptr_t)&idt[0];
idtr.limit = (uint16_t)sizeof(idt_entry_t) * 256 - 1; idtr.limit = (uint16_t)sizeof(idt_entry_t) * 256 - 1;
for (uint16_t vector = 0; vector <= 256; vector++) { for (uint16_t vector = 0; vector <= 256; vector++) {
if (vector == 0x80) if (vector == 0x80)
continue; // We skip the syscall handler, since it should be called from user space. continue; // We skip the syscall handler, since it should be called from
idt_set_descriptor(vector, isr_stub_table[vector], 0x8E); // user space.
vectors[vector] = 1; idt_set_descriptor(vector, isr_stub_table[vector], 0x8E);
}
uint16_t vector = 0x80;
idt_set_descriptor(vector, isr_stub_table[vector], 0xEE);
vectors[vector] = 1; vectors[vector] = 1;
}
pic_init(); uint16_t vector = 0x80;
pic_unmask_irq(1); idt_set_descriptor(vector, isr_stub_table[vector], 0xEE);
vectors[vector] = 1;
__asm__ volatile ("lidt %0" : : "m"(idtr)); // load the new IDT pic_init();
__asm__ volatile ("sti"); // set the interrupt flag pic_unmask_irq(1);
//logln(progress, "kinit stage 1", "IDT initialized! Time to receive interrupts!\n"); __asm__ volatile("lidt %0" : : "m"(idtr)); // load the new IDT
log("idt - initialized\n"); __asm__ volatile("sti"); // set the interrupt flag
// logln(progress, "kinit stage 1", "IDT initialized! Time to receive
// interrupts!\n");
log("idt - initialized\n");
} }

25
kernel/src/sys/arch/x86_64/idt.h Executable file → Normal file
View file

@ -28,24 +28,27 @@ typedef struct {
} __attribute__((packed)) registers_t; } __attribute__((packed)) registers_t;
typedef struct stackframe { typedef struct stackframe {
struct stackframe* rbp; struct stackframe *rbp;
uint64_t rip; uint64_t rip;
} stackframe_t; } stackframe_t;
typedef struct { typedef struct {
uint16_t isr_low; // The lower 16 bits of the ISR's address uint16_t isr_low; // The lower 16 bits of the ISR's address
uint16_t kernel_cs; // The GDT segment selector that the CPU will load into CS before calling the ISR uint16_t kernel_cs; // The GDT segment selector that the CPU will load into CS
uint8_t ist; // The IST in the TSS that the CPU will load into RSP; set to zero for now // before calling the ISR
uint8_t attributes; // Type and attributes; see the IDT page uint8_t ist; // The IST in the TSS that the CPU will load into RSP; set to
uint16_t isr_mid; // The higher 16 bits of the lower 32 bits of the ISR's address // zero for now
uint32_t isr_high; // The higher 32 bits of the ISR's address uint8_t attributes; // Type and attributes; see the IDT page
uint32_t reserved; // Set to zero uint16_t
isr_mid; // The higher 16 bits of the lower 32 bits of the ISR's address
uint32_t isr_high; // The higher 32 bits of the ISR's address
uint32_t reserved; // Set to zero
} __attribute__((packed)) idt_entry_t; } __attribute__((packed)) idt_entry_t;
typedef struct { typedef struct {
uint16_t limit; uint16_t limit;
uint64_t base; uint64_t base;
} __attribute__((packed)) idtr_t; } __attribute__((packed)) idtr_t;
void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags); void idt_set_descriptor(uint8_t vector, void *isr, uint8_t flags);
void idt_init(void); void idt_init(void);

101
kernel/src/sys/arch/x86_64/interrupts.c Executable file → Normal file
View file

@ -1,5 +1,5 @@
//#include "mm/pmm.h" // #include "mm/pmm.h"
//#include "mm/vmm.h" // #include "mm/vmm.h"
#include "mm/pmm.h" #include "mm/pmm.h"
#include "mm/vmm.h" #include "mm/vmm.h"
#include "sched/sched.h" #include "sched/sched.h"
@ -7,75 +7,72 @@
#include "sys/arch/x86_64/rtc.h" #include "sys/arch/x86_64/rtc.h"
#include "sys/log.h" #include "sys/log.h"
#include "sys/syscall.h" #include "sys/syscall.h"
//#include "sys/sched.h" // #include "sys/sched.h"
#include <stdint.h> #include <stdint.h>
#include <sys/arch/x86_64/idt.h> #include <sys/arch/x86_64/idt.h>
#include <sys/arch/x86_64/io.h> #include <sys/arch/x86_64/io.h>
//#include <sys/errhand/panic.h> // #include <sys/errhand/panic.h>
int pit_millis = 0; int pit_millis = 0;
int pit_secs = 0; int pit_secs = 0;
extern int vmm_kernel_pm_exists;
struct Idt_StackFrame { struct Idt_StackFrame {
struct Idt_StackFrame* rbp; struct Idt_StackFrame *rbp;
uint64_t rip; uint64_t rip;
}__attribute__((packed)); } __attribute__((packed));
void dump_backtrace(registers_t *r) void dump_backtrace(registers_t *r) {
{ log("ints - backtrace : \n");
log("ints - backtrace : \n"); struct Idt_StackFrame *frame = (struct Idt_StackFrame *)r->rbp;
struct Idt_StackFrame* frame = (struct Idt_StackFrame*)r->rbp;
while (frame) { while (frame) {
log("ints - %s (ip: %p)\n", frame->rip); log("ints - %s (ip: %p)\n", frame->rip);
frame = frame->rbp; frame = frame->rbp;
} }
log("ints - <end of backtrace>\n"); log("ints - <end of backtrace>\n");
} }
void pit_handler(registers_t *regs); void pit_handler(registers_t *regs);
void exception_handler(registers_t *regs) { void exception_handler(registers_t *regs) {
vmm_load_pagemap(vmm_kernel_pm); vmm_load_pagemap(vmm_kernel_pm);
if (regs->int_no < 32) { if (regs->int_no < 32) {
//panic(kmode_cpu_exception, regs); // panic(kmode_cpu_exception, regs);
log("ints - %d (RIP: %p, ERR: %d)\n", regs->int_no, regs->rip, regs->err_code); log("ints - %d (RIP: %p, ERR: %d)\n", regs->int_no, regs->rip,
regs->err_code);
if(regs->int_no == 0xe) { if (regs->int_no == 0xe && vmm_kernel_pm_exists) {
uint64_t cr2; uint64_t cr2;
asm ("mov %%cr2, %0" : "=r"(cr2)); asm("mov %%cr2, %0" : "=r"(cr2));
log("ints - PF: Faulting location: %p (%p)\n", cr2, virt_to_phys(vmm_current_pm, cr2)); log("ints - PF: Faulting location: %p (%p)\n", cr2,
log("ints - PF: Faulting page flags: %p\n", vmm_get_flags(vmm_current_pm, cr2)); virt_to_phys(vmm_current_pm, cr2));
log("ints - PF: Faulting page map: %p\n", PHYSICAL(vmm_current_pm)); log("ints - PF: Faulting page flags: %p\n",
} vmm_get_flags(vmm_current_pm, cr2));
log("ints - PF: Faulting page map: %p\n", PHYSICAL(vmm_current_pm));
// dump_backtrace(regs);
asm ("cli");
while (1)
asm ("hlt");
} }
if (regs->int_no == 1 + 32) // dump_backtrace(regs);
{ asm("cli");
if (inb(0x60) & 0x80) while (1)
{ asm("hlt");
pic_ack(regs->int_no - 32); }
return;
}
log("ints - keyboard\n"); if (regs->int_no == 1 + 32) {
if (inb(0x60) & 0x80) {
pic_ack(regs->int_no - 32);
return;
} }
else if (regs->int_no == 32 + 8) {
rtc_handle_interrupt(regs); log("ints - keyboard\n");
} } else if (regs->int_no == 32 + 8) {
else if (regs->int_no == 0x80 - 32 || regs->int_no == 32) { rtc_handle_interrupt(regs);
pit_handler(regs); } else if (regs->int_no == 0x80 - 32 || regs->int_no == 32) {
} pit_handler(regs);
else if (regs->int_no == 0x80) } else if (regs->int_no == 0x80) {
{ syscall_handle(regs);
syscall_handle(regs); }
} // logln(info, "arch/ints", "Received interrupt %d\n", regs->int_no);
//logln(info, "arch/ints", "Received interrupt %d\n", regs->int_no); pic_ack(regs->int_no - 32);
pic_ack(regs->int_no - 32);
} }

8
kernel/src/sys/arch/x86_64/pic.c Executable file → Normal file
View file

@ -1,11 +1,11 @@
//#include "sys/log.h" // #include "sys/log.h"
#include <sys/arch/x86_64/pic.h> #include <sys/arch/x86_64/pic.h>
//#include <sys/acpi.h> // #include <sys/acpi.h>
#include <sys/arch/x86_64/io.h> #include <sys/arch/x86_64/io.h>
void pic_init() { void pic_init() {
//if (acpi_available) // if (acpi_available)
// return; // return;
uint8_t a1, a2; uint8_t a1, a2;

64
kernel/src/sys/arch/x86_64/pit.c Executable file → Normal file
View file

@ -1,60 +1,52 @@
#include "sched/sched.h" #include "sched/sched.h"
#include "sys/arch/x86_64/idt.h" #include "sys/arch/x86_64/idt.h"
#include "sys/arch/x86_64/pic.h" #include "sys/arch/x86_64/pic.h"
#include <sys/log.h>
#include <stdint.h> #include <stdint.h>
#include <sys/log.h>
#ifdef __x86_64__ #ifdef __x86_64__
#include <sys/arch/x86_64/pit.h>
#include <sys/arch/x86_64/idt.h> #include <sys/arch/x86_64/idt.h>
//#include <sipaa/sched.h> #include <sys/arch/x86_64/pit.h>
// #include <sipaa/sched.h>
uint32_t tick = 0; uint32_t tick = 0;
void pit_handler(registers_t *regs) void pit_handler(registers_t *regs) {
{ tick++;
tick++;
schedule(regs); schedule(regs);
//Scheduler_Schedule(regs); // Scheduler_Schedule(regs);
} }
void pit_init(uint32_t frequency) void pit_init(uint32_t frequency) {
{ uint32_t divisor = PIT_FREQUENCY / frequency;
uint32_t divisor = PIT_FREQUENCY / frequency; outb(0x43, 0x34);
outb(0x43, 0x34); outb(0x40, (uint8_t)(divisor & 0xFF));
outb(0x40, (uint8_t)(divisor & 0xFF)); outb(0x40, (uint8_t)((divisor >> 8) & 0xFF));
outb(0x40, (uint8_t)((divisor >> 8) & 0xFF));
pic_unmask_irq(0); pic_unmask_irq(0);
} }
void sleep(uint32_t seconds) void sleep(uint32_t seconds) {
{ uint32_t eticks = tick + seconds * HZ;
uint32_t eticks = tick + seconds * HZ; while (tick < eticks) {
while (tick < eticks) __asm__ __volatile__("hlt");
{ }
__asm__ __volatile__("hlt");
}
} }
void sleep_ms(uint32_t milliseconds) void sleep_ms(uint32_t milliseconds) {
{ uint32_t eticks = tick + (milliseconds * HZ) / 1000;
uint32_t eticks = tick + (milliseconds * HZ) / 1000; while (tick < eticks) {
while (tick < eticks) __asm__ __volatile__("hlt");
{ }
__asm__ __volatile__("hlt");
}
} }
// todo: unistd: add usleep function // todo: unistd: add usleep function
void usleep(uint32_t usecs) void usleep(uint32_t usecs) {
{ uint32_t eticks = tick + (usecs * HZ);
uint32_t eticks = tick + (usecs * HZ); while (tick < eticks) {
while (tick < eticks) __asm__ __volatile__("hlt");
{ }
__asm__ __volatile__("hlt");
}
} }
#endif #endif

30
kernel/src/sys/arch/x86_64/rtc.c Executable file → Normal file
View file

@ -1,26 +1,28 @@
#include "sys/arch/x86_64/idt.h" #include "sys/arch/x86_64/idt.h"
#include "sys/arch/x86_64/io.h" #include "sys/arch/x86_64/io.h"
#include <sys/arch/x86_64/rtc.h>
#include <sys/arch/x86_64/pic.h> #include <sys/arch/x86_64/pic.h>
#include <sys/arch/x86_64/rtc.h>
#include <sys/printf.h> #include <sys/printf.h>
void rtc_init() { void rtc_init() {
asm("cli"); asm("cli");
outb(0x70, 0x8A); outb(0x70, 0x8A);
outb(0x71, 0x20); outb(0x71, 0x20);
asm("sti"); asm("sti");
asm("cli"); // disable interrupts asm("cli"); // disable interrupts
outb(0x70, 0x8B); // select register B, and disable NMI outb(0x70, 0x8B); // select register B, and disable NMI
char prev=inb(0x71); // read the current value of register B char prev = inb(0x71); // read the current value of register B
outb(0x70, 0x8B); // set the index again (a read will reset the index to register D) outb(0x70,
outb(0x71, prev | 0x40); // write the previous value ORed with 0x40. This turns on bit 6 of register B 0x8B); // set the index again (a read will reset the index to register D)
asm("sti"); outb(0x71, prev | 0x40); // write the previous value ORed with 0x40. This
// turns on bit 6 of register B
asm("sti");
//pic_unmask_irq(8); // pic_unmask_irq(8);
} }
void rtc_handle_interrupt(registers_t *regs) { void rtc_handle_interrupt(registers_t *regs) {
(void)regs; (void)regs;
printf("RTC!\n"); printf("RTC!\n");
} }

View file

@ -1,6 +1,4 @@
#include "sys/arch/x86_64/smp.h" #include "sys/arch/x86_64/smp.h"
#include "limine.h" #include "limine.h"
void smp_init() { void smp_init() {}
}

86
kernel/src/sys/arch/x86_64/sse.c Executable file → Normal file
View file

@ -1,59 +1,59 @@
#include <sys/arch/x86_64/sse.h> #include <sys/arch/x86_64/sse.h>
#include <sys/printf.h>
#include <sys/log.h> #include <sys/log.h>
#include <sys/printf.h>
int cpuid_check_bit(int reg, int bit) { int cpuid_check_bit(int reg, int bit) {
int eax, ebx, ecx, edx; int eax, ebx, ecx, edx;
// Minimal inline assembly to execute CPUID // Minimal inline assembly to execute CPUID
__asm__ volatile ( __asm__ volatile("cpuid" // Execute CPUID instruction
"cpuid" // Execute CPUID instruction : "=a"(eax), "=b"(ebx), "=c"(ecx),
: "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) // Output registers "=d"(edx) // Output registers
: "a"(0x1) // Input: EAX = 0x1 (query feature flags) : "a"(0x1) // Input: EAX = 0x1 (query feature flags)
: // No clobbered registers : // No clobbered registers
); );
// Check bit 25 of EDX (SSE support) in plain C // Check bit 25 of EDX (SSE support) in plain C
if (reg == 0) { if (reg == 0) {
if (edx & (1 << bit)) { if (edx & (1 << bit)) {
return 1; // SSE is supported return 1; // SSE is supported
} else { } else {
return 0; // SSE is not supported return 0; // SSE is not supported
}
}else if (reg == 1) {
if (ecx & (1 << bit)) {
return 1; // SSE is supported
} else {
return 0; // SSE is not supported
}
} }
} else if (reg == 1) {
if (ecx & (1 << bit)) {
return 1; // SSE is supported
} else {
return 0; // SSE is not supported
}
}
return 0; return 0;
} }
void sse_init() { void sse_init() {
int sse = cpuid_check_bit(0, 25); int sse = cpuid_check_bit(0, 25);
int sse2 = cpuid_check_bit(0, 26); int sse2 = cpuid_check_bit(0, 26);
int sse3 = cpuid_check_bit(1, 0); int sse3 = cpuid_check_bit(1, 0);
int ssse3 = cpuid_check_bit(1, 9); int ssse3 = cpuid_check_bit(1, 9);
if (sse) if (sse)
log("sse - sse is supported!\n"); log("sse - sse is supported!\n");
else else
log("sse - sse isn't supported!\n"); log("sse - sse isn't supported!\n");
if (sse2) if (sse2)
log("sse - sse2 is supported!\n"); log("sse - sse2 is supported!\n");
else else
log("sse - sse2 isn't supported!\n"); log("sse - sse2 isn't supported!\n");
if (sse3) if (sse3)
log("sse - sse3 is supported!\n"); log("sse - sse3 is supported!\n");
else else
log("sse - sse3 isn't supported!\n"); log("sse - sse3 isn't supported!\n");
if (ssse3) if (ssse3)
log("sse - ssse3 is supported!\n"); log("sse - ssse3 is supported!\n");
else else
log("sse - ssse3 isn't supported!\n"); log("sse - ssse3 isn't supported!\n");
} }

View file

@ -1,3 +1 @@
void panic_ctx() { void panic_ctx() {}
}

File diff suppressed because it is too large Load diff

View file

@ -26,9 +26,9 @@
#ifndef FLANTERM_FB_H #ifndef FLANTERM_FB_H
#define FLANTERM_FB_H 1 #define FLANTERM_FB_H 1
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -43,23 +43,24 @@ extern "C" {
#endif #endif
struct flanterm_context *flanterm_fb_init( struct flanterm_context *flanterm_fb_init(
/* If _malloc and _free are nulled, use the bump allocated instance (1 use only). */ /* If _malloc and _free are nulled, use the bump allocated instance (1 use
only). */
void *(*_malloc)(size_t size), void *(*_malloc)(size_t size),
void (*_free)(void *ptr, size_t size), void (*_free)(void *ptr, size_t size), uint32_t *framebuffer, size_t width,
uint32_t *framebuffer, size_t width, size_t height, size_t pitch, size_t height, size_t pitch, uint8_t red_mask_size, uint8_t red_mask_shift,
uint8_t red_mask_size, uint8_t red_mask_shift, uint8_t green_mask_size, uint8_t green_mask_shift, uint8_t blue_mask_size,
uint8_t green_mask_size, uint8_t green_mask_shift, uint8_t blue_mask_shift, uint32_t *canvas, /* If nulled, no canvas. */
uint8_t blue_mask_size, uint8_t blue_mask_shift, uint32_t *ansi_colours,
uint32_t *canvas, /* If nulled, no canvas. */ uint32_t *ansi_bright_colours, /* If nulled, default. */
uint32_t *ansi_colours, uint32_t *ansi_bright_colours, /* If nulled, default. */
uint32_t *default_bg, uint32_t *default_fg, /* If nulled, default. */ uint32_t *default_bg, uint32_t *default_fg, /* If nulled, default. */
uint32_t *default_bg_bright, uint32_t *default_fg_bright, /* If nulled, default. */ uint32_t *default_bg_bright,
/* If font is null, use default font and font_width and font_height ignored. */ uint32_t *default_fg_bright, /* If nulled, default. */
/* If font is null, use default font and font_width and font_height ignored.
*/
void *font, size_t font_width, size_t font_height, size_t font_spacing, void *font, size_t font_width, size_t font_height, size_t font_spacing,
/* If scale_x and scale_y are 0, automatically scale font based on resolution. */ /* If scale_x and scale_y are 0, automatically scale font based on
size_t font_scale_x, size_t font_scale_y, resolution. */
size_t margin size_t font_scale_x, size_t font_scale_y, size_t margin);
);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -30,9 +30,9 @@
#error "Do not use fb_private.h. Use interfaces defined in fb.h only." #error "Do not use fb_private.h. Use interfaces defined in fb.h only."
#endif #endif
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -41,77 +41,78 @@ extern "C" {
#define FLANTERM_FB_FONT_GLYPHS 256 #define FLANTERM_FB_FONT_GLYPHS 256
struct flanterm_fb_char { struct flanterm_fb_char {
uint32_t c; uint32_t c;
uint32_t fg; uint32_t fg;
uint32_t bg; uint32_t bg;
}; };
struct flanterm_fb_queue_item { struct flanterm_fb_queue_item {
size_t x, y; size_t x, y;
struct flanterm_fb_char c; struct flanterm_fb_char c;
}; };
struct flanterm_fb_context { struct flanterm_fb_context {
struct flanterm_context term; struct flanterm_context term;
void (*plot_char)(struct flanterm_context *ctx, struct flanterm_fb_char *c, size_t x, size_t y); void (*plot_char)(struct flanterm_context *ctx, struct flanterm_fb_char *c,
size_t x, size_t y);
size_t font_width; size_t font_width;
size_t font_height; size_t font_height;
size_t glyph_width; size_t glyph_width;
size_t glyph_height; size_t glyph_height;
size_t font_scale_x; size_t font_scale_x;
size_t font_scale_y; size_t font_scale_y;
size_t offset_x, offset_y; size_t offset_x, offset_y;
volatile uint32_t *framebuffer; volatile uint32_t *framebuffer;
size_t pitch; size_t pitch;
size_t width; size_t width;
size_t height; size_t height;
size_t bpp; size_t bpp;
uint8_t red_mask_size, red_mask_shift; uint8_t red_mask_size, red_mask_shift;
uint8_t green_mask_size, green_mask_shift; uint8_t green_mask_size, green_mask_shift;
uint8_t blue_mask_size, blue_mask_shift; uint8_t blue_mask_size, blue_mask_shift;
size_t font_bits_size; size_t font_bits_size;
uint8_t *font_bits; uint8_t *font_bits;
size_t font_bool_size; size_t font_bool_size;
bool *font_bool; bool *font_bool;
uint32_t ansi_colours[8]; uint32_t ansi_colours[8];
uint32_t ansi_bright_colours[8]; uint32_t ansi_bright_colours[8];
uint32_t default_fg, default_bg; uint32_t default_fg, default_bg;
uint32_t default_fg_bright, default_bg_bright; uint32_t default_fg_bright, default_bg_bright;
size_t canvas_size; size_t canvas_size;
uint32_t *canvas; uint32_t *canvas;
size_t grid_size; size_t grid_size;
size_t queue_size; size_t queue_size;
size_t map_size; size_t map_size;
struct flanterm_fb_char *grid; struct flanterm_fb_char *grid;
struct flanterm_fb_queue_item *queue; struct flanterm_fb_queue_item *queue;
size_t queue_i; size_t queue_i;
struct flanterm_fb_queue_item **map; struct flanterm_fb_queue_item **map;
uint32_t text_fg; uint32_t text_fg;
uint32_t text_bg; uint32_t text_bg;
size_t cursor_x; size_t cursor_x;
size_t cursor_y; size_t cursor_y;
uint32_t saved_state_text_fg; uint32_t saved_state_text_fg;
uint32_t saved_state_text_bg; uint32_t saved_state_text_bg;
size_t saved_state_cursor_x; size_t saved_state_cursor_x;
size_t saved_state_cursor_y; size_t saved_state_cursor_y;
size_t old_cursor_x; size_t old_cursor_x;
size_t old_cursor_y; size_t old_cursor_y;
}; };
#ifdef __cplusplus #ifdef __cplusplus

File diff suppressed because it is too large Load diff

View file

@ -26,9 +26,9 @@
#ifndef FLANTERM_H #ifndef FLANTERM_H
#define FLANTERM_H 1 #define FLANTERM_H 1
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -62,14 +62,19 @@ struct flanterm_context;
#endif #endif
void flanterm_write(struct flanterm_context *ctx, const char *buf, size_t count); void flanterm_write(struct flanterm_context *ctx, const char *buf,
size_t count);
void flanterm_flush(struct flanterm_context *ctx); void flanterm_flush(struct flanterm_context *ctx);
void flanterm_full_refresh(struct flanterm_context *ctx); void flanterm_full_refresh(struct flanterm_context *ctx);
void flanterm_deinit(struct flanterm_context *ctx, void (*_free)(void *ptr, size_t size)); void flanterm_deinit(struct flanterm_context *ctx,
void (*_free)(void *ptr, size_t size));
void flanterm_get_dimensions(struct flanterm_context *ctx, size_t *cols, size_t *rows); void flanterm_get_dimensions(struct flanterm_context *ctx, size_t *cols,
size_t *rows);
void flanterm_set_autoflush(struct flanterm_context *ctx, bool state); void flanterm_set_autoflush(struct flanterm_context *ctx, bool state);
void flanterm_set_callback(struct flanterm_context *ctx, void (*callback)(struct flanterm_context *, uint64_t, uint64_t, uint64_t, uint64_t)); void flanterm_set_callback(struct flanterm_context *ctx,
void (*callback)(struct flanterm_context *, uint64_t,
uint64_t, uint64_t, uint64_t));
uint64_t flanterm_get_oob_output(struct flanterm_context *ctx); uint64_t flanterm_get_oob_output(struct flanterm_context *ctx);
void flanterm_set_oob_output(struct flanterm_context *ctx, uint64_t oob_output); void flanterm_set_oob_output(struct flanterm_context *ctx, uint64_t oob_output);

View file

@ -27,12 +27,13 @@
#define FLANTERM_PRIVATE_H 1 #define FLANTERM_PRIVATE_H 1
#ifndef FLANTERM_IN_FLANTERM #ifndef FLANTERM_IN_FLANTERM
#error "Do not use flanterm_private.h. Use interfaces defined in flanterm.h only." #error \
"Do not use flanterm_private.h. Use interfaces defined in flanterm.h only."
#endif #endif
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -41,76 +42,78 @@ extern "C" {
#define FLANTERM_MAX_ESC_VALUES 16 #define FLANTERM_MAX_ESC_VALUES 16
struct flanterm_context { struct flanterm_context {
/* internal use */ /* internal use */
size_t tab_size; size_t tab_size;
bool autoflush; bool autoflush;
bool cursor_enabled; bool cursor_enabled;
bool scroll_enabled; bool scroll_enabled;
bool control_sequence; bool control_sequence;
bool escape; bool escape;
bool osc; bool osc;
bool osc_escape; bool osc_escape;
bool rrr; bool rrr;
bool discard_next; bool discard_next;
bool bold; bool bold;
bool bg_bold; bool bg_bold;
bool reverse_video; bool reverse_video;
bool dec_private; bool dec_private;
bool insert_mode; bool insert_mode;
uint64_t code_point; uint64_t code_point;
size_t unicode_remaining; size_t unicode_remaining;
uint8_t g_select; uint8_t g_select;
uint8_t charsets[2]; uint8_t charsets[2];
size_t current_charset; size_t current_charset;
size_t escape_offset; size_t escape_offset;
size_t esc_values_i; size_t esc_values_i;
size_t saved_cursor_x; size_t saved_cursor_x;
size_t saved_cursor_y; size_t saved_cursor_y;
size_t current_primary; size_t current_primary;
size_t current_bg; size_t current_bg;
size_t scroll_top_margin; size_t scroll_top_margin;
size_t scroll_bottom_margin; size_t scroll_bottom_margin;
uint32_t esc_values[FLANTERM_MAX_ESC_VALUES]; uint32_t esc_values[FLANTERM_MAX_ESC_VALUES];
uint64_t oob_output; uint64_t oob_output;
bool saved_state_bold; bool saved_state_bold;
bool saved_state_bg_bold; bool saved_state_bg_bold;
bool saved_state_reverse_video; bool saved_state_reverse_video;
size_t saved_state_current_charset; size_t saved_state_current_charset;
size_t saved_state_current_primary; size_t saved_state_current_primary;
size_t saved_state_current_bg; size_t saved_state_current_bg;
/* to be set by backend */ /* to be set by backend */
size_t rows, cols; size_t rows, cols;
void (*raw_putchar)(struct flanterm_context *, uint8_t c); void (*raw_putchar)(struct flanterm_context *, uint8_t c);
void (*clear)(struct flanterm_context *, bool move); void (*clear)(struct flanterm_context *, bool move);
void (*set_cursor_pos)(struct flanterm_context *, size_t x, size_t y); void (*set_cursor_pos)(struct flanterm_context *, size_t x, size_t y);
void (*get_cursor_pos)(struct flanterm_context *, size_t *x, size_t *y); void (*get_cursor_pos)(struct flanterm_context *, size_t *x, size_t *y);
void (*set_text_fg)(struct flanterm_context *, size_t fg); void (*set_text_fg)(struct flanterm_context *, size_t fg);
void (*set_text_bg)(struct flanterm_context *, size_t bg); void (*set_text_bg)(struct flanterm_context *, size_t bg);
void (*set_text_fg_bright)(struct flanterm_context *, size_t fg); void (*set_text_fg_bright)(struct flanterm_context *, size_t fg);
void (*set_text_bg_bright)(struct flanterm_context *, size_t bg); void (*set_text_bg_bright)(struct flanterm_context *, size_t bg);
void (*set_text_fg_rgb)(struct flanterm_context *, uint32_t fg); void (*set_text_fg_rgb)(struct flanterm_context *, uint32_t fg);
void (*set_text_bg_rgb)(struct flanterm_context *, uint32_t bg); void (*set_text_bg_rgb)(struct flanterm_context *, uint32_t bg);
void (*set_text_fg_default)(struct flanterm_context *); void (*set_text_fg_default)(struct flanterm_context *);
void (*set_text_bg_default)(struct flanterm_context *); void (*set_text_bg_default)(struct flanterm_context *);
void (*set_text_fg_default_bright)(struct flanterm_context *); void (*set_text_fg_default_bright)(struct flanterm_context *);
void (*set_text_bg_default_bright)(struct flanterm_context *); void (*set_text_bg_default_bright)(struct flanterm_context *);
void (*move_character)(struct flanterm_context *, size_t new_x, size_t new_y, size_t old_x, size_t old_y); void (*move_character)(struct flanterm_context *, size_t new_x, size_t new_y,
void (*scroll)(struct flanterm_context *); size_t old_x, size_t old_y);
void (*revscroll)(struct flanterm_context *); void (*scroll)(struct flanterm_context *);
void (*swap_palette)(struct flanterm_context *); void (*revscroll)(struct flanterm_context *);
void (*save_state)(struct flanterm_context *); void (*swap_palette)(struct flanterm_context *);
void (*restore_state)(struct flanterm_context *); void (*save_state)(struct flanterm_context *);
void (*double_buffer_flush)(struct flanterm_context *); void (*restore_state)(struct flanterm_context *);
void (*full_refresh)(struct flanterm_context *); void (*double_buffer_flush)(struct flanterm_context *);
void (*deinit)(struct flanterm_context *, void (*)(void *, size_t)); void (*full_refresh)(struct flanterm_context *);
void (*deinit)(struct flanterm_context *, void (*)(void *, size_t));
/* to be set by client */ /* to be set by client */
void (*callback)(struct flanterm_context *, uint64_t, uint64_t, uint64_t, uint64_t); void (*callback)(struct flanterm_context *, uint64_t, uint64_t, uint64_t,
uint64_t);
}; };
void flanterm_context_reinit(struct flanterm_context *ctx); void flanterm_context_reinit(struct flanterm_context *ctx);

59
kernel/src/sys/log.c Executable file → Normal file
View file

@ -1,45 +1,52 @@
#include "sys/arch/x86_64/io.h" #include "sys/arch/x86_64/io.h"
#include "sys/gfx/flanterm/flanterm.h" #include "sys/gfx/flanterm/flanterm.h"
#include <lib/spinlock.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/printf.h> #include <sys/printf.h>
#include <lib/spinlock.h>
extern struct flanterm_context *ft_ctx; extern struct flanterm_context *ft_ctx;
static spinlock_t log_lock = {0}; static spinlock_t log_lock = {0};
void log(char *format, ...) { void log(char *format, ...) {
//spinlock_acquire(&log_lock); // spinlock_acquire(&log_lock);
// TODO: replace this call with a call to printf() when the RTC is implemented. // TODO: replace this call with a call to printf() when the RTC is
char *date = "1970-01-01 00:00:00 | "; // implemented.
int i2 = 0; for (i2; date[i2] != 0; i2++);; char *date = "1970-01-01 00:00:00 | ";
if (ft_ctx) int i2 = 0;
flanterm_write(ft_ctx, date, i2); for (i2; date[i2] != 0; i2++)
;
;
if (ft_ctx)
flanterm_write(ft_ctx, date, i2);
char buf[2048]; char buf[2048];
va_list l; va_list l;
va_start(l, format); va_start(l, format);
npf_vsnprintf(buf, 2048, format, l); npf_vsnprintf(buf, 2048, format, l);
va_end(l); va_end(l);
int i = 0; for (i; buf[i] != 0; i++);; int i = 0;
if (ft_ctx) for (i; buf[i] != 0; i++)
flanterm_write(ft_ctx, buf, i); ;
;
if (ft_ctx)
flanterm_write(ft_ctx, buf, i);
for (int i=0;;i++) { for (int i = 0;; i++) {
if (date[i] == '\0') if (date[i] == '\0')
break; break;
outb(0xE9, date[i]); outb(0xE9, date[i]);
} }
for (int i=0;;i++) { for (int i = 0;; i++) {
if (buf[i] == '\0') if (buf[i] == '\0')
break; break;
outb(0xE9, buf[i]); outb(0xE9, buf[i]);
} }
//spinlock_release(&log_lock); // spinlock_release(&log_lock);
} }

21
kernel/src/sys/printf.c Executable file → Normal file
View file

@ -18,15 +18,18 @@
extern struct flanterm_context *ft_ctx; extern struct flanterm_context *ft_ctx;
void printf(char *format, ...) { void printf(char *format, ...) {
char buf[2048]; char buf[2048];
va_list lst; va_list lst;
va_start(lst, format); va_start(lst, format);
npf_vsnprintf(buf, 2048, format, lst); npf_vsnprintf(buf, 2048, format, lst);
va_end(lst); va_end(lst);
//rt_print(buf); // rt_print(buf);
int i = 0; for (i; buf[i] != 0; i++);; int i = 0;
for (i; buf[i] != 0; i++)
;
;
if (ft_ctx) if (ft_ctx)
flanterm_write(ft_ctx, buf, i); flanterm_write(ft_ctx, buf, i);
} }

View file

@ -1,6 +1,6 @@
#include "sched/sched.h" #include "sched/sched.h"
#include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <sys/log.h> #include <sys/log.h>
#include <sys/syscall.h> #include <sys/syscall.h>
@ -12,41 +12,45 @@ static int syscall_initialized = 0;
static uint64_t __syscall_undefined() { return 0; } static uint64_t __syscall_undefined() { return 0; }
void syscall_handle(registers_t *regs) { void syscall_handle(registers_t *regs) {
if (regs->rax > 1024) { if (regs->rax > 1024) {
log("syscall - syscall_handle was called with rax better than what Soaplin supports (1024). did you forget to set rax?\n"); log("syscall - syscall_handle was called with rax better than what Soaplin "
return; "supports (1024). did you forget to set rax?\n");
}
if (curr_proc == NULL || curr_proc->regs.cs != 0x43) {
log("syscall - syscall_handle was called by the kernel. is this wanted?\n");
return;
}
if (syscall_table[regs->rax] == (syscall)__syscall_undefined) {
log("syscall - syscall_handle was called with an undefined system call. (%d)\n", regs->rax);
return;
}
regs->rax = syscall_table[regs->rax](regs->rdi, regs->rsi, regs->rdx, regs->rcx, regs->r8, regs->r9);
return; return;
}
if (curr_proc == NULL || curr_proc->regs.cs != 0x43) {
log("syscall - syscall_handle was called by the kernel. is this wanted?\n");
return;
}
if (syscall_table[regs->rax] == (syscall)__syscall_undefined) {
log("syscall - syscall_handle was called with an undefined system call. "
"(%d)\n",
regs->rax);
return;
}
regs->rax = syscall_table[regs->rax](regs->rdi, regs->rsi, regs->rdx,
regs->rcx, regs->r8, regs->r9);
return;
} }
void syscall_register(int id, syscall handler) { void syscall_register(int id, syscall handler) {
if (syscall_table[id] != (syscall)__syscall_undefined) if (syscall_table[id] != (syscall)__syscall_undefined) {
{ log("syscall - warning: syscall_register has been called to try replacing "
log("syscall - warning: syscall_register has been called to try replacing an existing syscall.\n"); "an existing syscall.\n");
return; return;
} }
syscall_table[id] = handler; syscall_table[id] = handler;
log("syscall - System call %d has been set to %p\n", id, handler); log("syscall - System call %d has been set to %p\n", id, handler);
} }
extern void syscall_exit(int exit_code); extern void syscall_exit(int exit_code);
void syscall_init() { void syscall_init() {
for (int i = 0; i < 1024; i++) for (int i = 0; i < 1024; i++)
syscall_table[i] = (syscall)__syscall_undefined; syscall_table[i] = (syscall)__syscall_undefined;
syscall_register(0, (syscall)syscall_exit); syscall_register(0, (syscall)syscall_exit);
} }

View file

@ -4,15 +4,17 @@
#include <stdint.h> #include <stdint.h>
/// A function that defines a system call. /// A function that defines a system call.
/// NOTE: Arguments are defined as uint64_t, but you can simply put your own type, and then cast your function to syscall. /// NOTE: Arguments are defined as uint64_t, but you can simply put your own
typedef uint64_t(*syscall)(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9); /// type, and then cast your function to syscall.
typedef uint64_t (*syscall)(uint64_t rdi, uint64_t rsi, uint64_t rdx,
uint64_t rcx, uint64_t r8, uint64_t r9);
/// Registers a system call. /// Registers a system call.
/// NOTE: an existing system call cannot be replaced by another. /// NOTE: an existing system call cannot be replaced by another.
void syscall_register(int id, syscall handler); void syscall_register(int id, syscall handler);
/// Called by the interupt handler, or the "syscall" instruction handler /// Called by the interupt handler, or the "syscall" instruction handler
void syscall_handle(registers_t*); void syscall_handle(registers_t *);
/// Initialize the system calls. /// Initialize the system calls.
void syscall_init(); void syscall_init();

View file

@ -1,6 +1,6 @@
#include <sched/sched.h> #include <sched/sched.h>
int syscall_exit(int exit_code) { int syscall_exit(int exit_code) {
//sched_exit(exit_code); // sched_exit(exit_code);
return 0; return 0;
} }

View file

@ -1,13 +1,13 @@
#pragma once #pragma once
typedef struct __uname { typedef struct __uname {
char sysname[128]; /* Operating system name */ char sysname[128]; /* Operating system name */
char nodename[128]; /* Name within communications network char nodename[128]; /* Name within communications network
to which the node is attached, if any */ to which the node is attached, if any */
char release[128]; /* Operating system release */ char release[128]; /* Operating system release */
char version[128]; /* Operating system version */ char version[128]; /* Operating system version */
char machine[128]; /* Hardware type identifier */ char machine[128]; /* Hardware type identifier */
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
char domainname[]; /* NIS or YP domain name */ char domainname[]; /* NIS or YP domain name */
#endif #endif
} uname_t; } uname_t;