Finished Aurix Protocol, AxBoot logs to file now

This commit is contained in:
Jozef Nagy 2025-05-24 21:12:40 +02:00
parent b1d59e02eb
commit d1a5d7d43d
Signed by untrusted user who does not match committer: crz
GPG key ID: 459A4811CEAC7068
37 changed files with 744 additions and 221 deletions

28
boot/include/acpi/acpi.h Normal file
View file

@ -0,0 +1,28 @@
/*********************************************************************************/
/* Module Name: acpi.h */
/* Project: AurixOS */
/* */
/* Copyright (c) 2024-2025 Jozef Nagy */
/* */
/* This source is subject to the MIT License. */
/* See License.txt in the root of this repository. */
/* All other rights reserved. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
/* SOFTWARE. */
/*********************************************************************************/
#ifndef _ACPI_ACPI_H
#define _ACPI_ACPI_H
#include <stdint.h>
uintptr_t platform_get_rsdp(void);
uintptr_t platform_get_smbios(void);
#endif /* _ACPI_ACPI_H */

View file

@ -1,5 +1,5 @@
/*********************************************************************************/
/* Module Name: ini.h */
/* Module Name: idt.h */
/* Project: AurixOS */
/* */
/* Copyright (c) 2024-2025 Jozef Nagy */
@ -17,70 +17,17 @@
/* SOFTWARE. */
/*********************************************************************************/
#ifndef _CONFIG_INI_H
#define _CONFIG_INI_H
#ifndef _ARCH_CPU_IDT_H
#define _ARCH_CPU_IDT_H
enum token_type {
SECTION,
KEY,
VALUE,
#include <stdint.h>
EOF,
ILLEGAL,
struct idt_descriptor {
};
struct string_view {
char *data;
unsigned int len;
struct idtr {
uint16_t limit;
uint64_t base;
};
struct token {
enum token_type type;
struct string_view lit;
};
struct token_array {
struct token *items;
unsigned int count;
unsigned int capacity;
};
struct lexer {
char *input;
unsigned int pos;
unsigned int read_pos;
char ch;
};
struct parser {
struct token_array *tokens;
unsigned int pos;
unsigned int read_pos;
struct token *cur_token;
};
struct key_value {
struct string_view key;
struct string_view value;
};
struct section {
struct string_view name;
struct key_value *items;
unsigned int count;
unsigned int capacity;
};
struct ini_file {
struct section root;
struct section *items;
unsigned int count;
unsigned int capacity;
};
void parse_ini(struct ini_file *ini, char *buf);
char *ini_get_value(struct ini_file *ini, char *section, char *key);
int ini_get_value_int(struct ini_file *ini, char *section, char *key);
#endif /* _CONFIG_INI_H */
#endif /* _ARCH_CPU_IDT_H */

View file

@ -34,4 +34,9 @@
void axboot_init(void);
// I really had no idea where to put this
#ifdef AXBOOT_UEFI
void uefi_exit_bs(void);
#endif
#endif /* _AXBOOT_H */

View file

@ -32,6 +32,7 @@ struct axboot_cfg {
int ui_mode;
int entry_count;
char *bootlog_filename;
};
struct axboot_entry {

View file

@ -32,8 +32,8 @@ struct driver {
EFI_MEMMAP_DEVICE_PATH devpath[2];
};
#endif
void load_drivers();
#endif
#endif /* _DRIVER_H */

View file

@ -26,5 +26,6 @@
struct vfs_drive *sfs_init(char *mountpoint);
size_t sfs_read(char *filename, char **buffer, struct vfs_drive *dev, void *fsdata);
uint8_t sfs_write(char *filename, char *buffer, size_t size, struct vfs_drive *dev, void *fsdata);
#endif /* _FS_UEFI_SFS_H */

View file

@ -73,6 +73,6 @@ struct elf_program_header {
#define PF_W 0x2
#define PF_R 0x4
uintptr_t elf_load(char *kernel, pagetable *pagemap);
uintptr_t elf_load(char *kernel, uintptr_t *addr, pagetable *pagemap);
#endif /* _LOADER_ELF_H */

View file

@ -46,6 +46,6 @@ typedef struct _axboot_memmap {
int type;
} axboot_memmap;
axboot_memmap *get_memmap(pagetable *pm);
uint32_t get_memmap(axboot_memmap **map, pagetable *pm);
#endif /* _MEM_MEMMAP_H */

View file

@ -17,9 +17,68 @@
/* SOFTWARE. */
/*********************************************************************************/
#ifndef _PROTO_AURIX_H
#define _PROTO_AURIX_H
#ifndef _AURIX_H
#define _AURIX_H
#include <stdint.h>
#define AURIX_PROTOCOL_REVISION 1
enum aurix_memmap_entry {
AURIX_MMAP_RESERVED = 0,
AURIX_MMAP_ACPI_RECLAIMABLE = 1,
AURIX_MMAP_ACPI_MAPPED_IO = 2,
AURIX_MMAP_ACPI_MAPPED_IO_PORTSPACE = 3,
AURIX_MMAP_ACPI_NVS = 4,
AURIX_MMAP_BOOTLOADER_RECLAIMABLE = 6,
AURIX_MMAP_USABLE = 7
};
enum aurix_framebuffer_format {
AURIX_FB_RGBA = 0,
AURIX_FB_BGRA = 1
};
struct aurix_memmap {
uintptr_t base;
uint32_t size;
uint8_t type;
};
struct aurix_framebuffer {
uintptr_t addr;
uint32_t width;
uint32_t height;
uint8_t bpp; // bits!
uint32_t pitch;
int format;
};
struct aurix_parameters {
// PROTOCOL INFO
uint8_t revision;
// MEMORY
struct aurix_memmap *mmap;
uint32_t mmap_entries;
uintptr_t kernel_addr; // physical address
// RSDP and SMBIOS
uintptr_t rsdp_addr;
uintptr_t smbios_addr;
// FRAMEBUFFER
struct aurix_framebuffer *framebuffer;
};
#ifdef _AXBOOT
#include <mm/vmm.h>
void aurix_load(char *kernel);
void aurix_arch_handoff(void *kernel_entry, pagetable *pm, void *stack, uint32_t stack_size, struct aurix_parameters *parameters);
#endif
#endif /* _PROTO_AURIX_H */

View file

@ -24,8 +24,8 @@
#include <stdbool.h>
enum fb_format {
FB_RGBA,
FB_BGRA
FB_RGBA = 0,
FB_BGRA = 1
};
struct fb_mode {