summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/inc')
-rw-r--r--src/loader/inc/cfg.h39
-rw-r--r--src/loader/inc/config.h39
-rw-r--r--src/loader/inc/device.h (renamed from src/loader/inc/dev.h)26
-rw-r--r--src/loader/inc/disk.h (renamed from src/loader/inc/dsk.h)6
-rw-r--r--src/loader/inc/elf.h2
-rw-r--r--src/loader/inc/fs/ext2.h2
-rw-r--r--src/loader/inc/interrupt.h (renamed from src/loader/inc/int.h)20
-rw-r--r--src/loader/inc/library.h (renamed from src/loader/inc/lib.h)0
-rw-r--r--src/loader/inc/log.h5
-rw-r--r--src/loader/inc/mbr.h2
-rw-r--r--src/loader/inc/mem.h32
-rw-r--r--src/loader/inc/memory.h32
-rw-r--r--src/loader/inc/panic.h (renamed from src/loader/inc/pnc.h)0
-rw-r--r--src/loader/inc/pic.h2
-rw-r--r--src/loader/inc/protocol.h (renamed from src/loader/inc/impl.h)2
-rw-r--r--src/loader/inc/protocols/all.h (renamed from src/loader/inc/impl/all.h)6
-rw-r--r--src/loader/inc/protocols/mb1.h (renamed from src/loader/inc/impl/mb1.h)14
-rw-r--r--src/loader/inc/protocols/mb2.h (renamed from src/loader/inc/impl/mb2.h)8
-rw-r--r--src/loader/inc/real.h (renamed from src/loader/inc/rem.h)8
19 files changed, 123 insertions, 122 deletions
diff --git a/src/loader/inc/cfg.h b/src/loader/inc/cfg.h
deleted file mode 100644
index cb91ab2..0000000
--- a/src/loader/inc/cfg.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// MIT License, Copyright (c) 2021 Marvin Borner
-
-#ifndef CFG_H
-#define CFG_H
-
-#include <def.h>
-#include <impl.h>
-
-extern u8 boot_disk;
-
-// Global config element index (can actually be anything but wth)
-#define CFG_GLOBAL 0
-
-enum cfg_key {
- CFG_NONE,
- CFG_NAME,
- CFG_TIMEOUT,
- CFG_PATH,
-};
-
-struct cfg_entry {
- u8 exists : 1;
- char name[64];
- char full_path[64]; // With disk name
- const char *path; // Without disk name
- struct dev *dev;
- struct impl impl;
-};
-
-struct cfg {
- u32 timeout;
- struct cfg_entry entry[16]; // Up to 16 different entries
-};
-
-void cfg_foreach(u8 (*cb)(struct cfg_entry *));
-void cfg_exec(struct cfg_entry *entry);
-void cfg_read(void);
-
-#endif
diff --git a/src/loader/inc/config.h b/src/loader/inc/config.h
new file mode 100644
index 0000000..4f2d7dc
--- /dev/null
+++ b/src/loader/inc/config.h
@@ -0,0 +1,39 @@
+// MIT License, Copyright (c) 2021 Marvin Borner
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include <def.h>
+#include <protocol.h>
+
+extern u8 boot_disk;
+
+// Global config element index (can actually be anything but wth)
+#define CONFIG_GLOBAL 0
+
+enum config_key {
+ CONFIG_NONE,
+ CONFIG_NAME,
+ CONFIG_TIMEOUT,
+ CONFIG_PATH,
+};
+
+struct config_entry {
+ u8 exists : 1;
+ char name[64];
+ char full_path[64]; // With disk name
+ const char *path; // Without disk name
+ struct dev *dev;
+ struct impl impl;
+};
+
+struct cfg {
+ u32 timeout;
+ struct config_entry entry[16]; // Up to 16 different entries
+};
+
+void config_foreach(u8 (*cb)(struct config_entry *));
+void config_exec(struct config_entry *entry);
+void config_read(void);
+
+#endif
diff --git a/src/loader/inc/dev.h b/src/loader/inc/device.h
index cbefe99..5081cb7 100644
--- a/src/loader/inc/dev.h
+++ b/src/loader/inc/device.h
@@ -1,20 +1,20 @@
// MIT License, Copyright (c) 2021 Marvin Borner
-#ifndef DEV_H
-#define DEV_H
+#ifndef DEVICE_H
+#define DEVICE_H
#include <def.h>
-#include <dsk.h>
+#include <disk.h>
-enum dev_type {
- DEV_NONE,
- DEV_DISK,
- DEV_FB,
+enum device_type {
+ DEVICE_NONE,
+ DEVICE_DISK,
+ DEVICE_FB,
};
struct dev {
u8 id;
- enum dev_type type;
+ enum device_type type;
char name[16];
s32 (*read)(void *, u32, u32, struct dev *);
@@ -30,12 +30,12 @@ struct dev {
u32 data; // Optional (device-specific) data/information
};
-struct dev *dev_get_by_id(u8 id);
-struct dev *dev_get_by_name(const char *name, u32 len);
-void dev_foreach(enum dev_type type, u8 (*cb)(struct dev *)); // cb=1 => break
-u8 dev_register(enum dev_type type, char *name, u32 data,
+struct dev *device_get_by_id(u8 id);
+struct dev *device_get_by_name(const char *name, u32 len);
+void device_foreach(enum device_type type, u8 (*cb)(struct dev *)); // cb=1 => break
+u8 device_register(enum device_type type, char *name, u32 data,
s32 (*read)(void *, u32, u32, struct dev *),
s32 (*write)(const void *, u32, u32, struct dev *));
-void dev_print(void);
+void device_print(void);
#endif
diff --git a/src/loader/inc/dsk.h b/src/loader/inc/disk.h
index 5b2dec9..e4fb285 100644
--- a/src/loader/inc/dsk.h
+++ b/src/loader/inc/disk.h
@@ -1,7 +1,7 @@
// MIT License, Copyright (c) 2021 Marvin Borner
-#ifndef DSK_H
-#define DSK_H
+#ifndef DISK_H
+#define DISK_H
#include <def.h>
@@ -16,6 +16,6 @@ struct fs {
s32 (*read)(const char *, void *, u32, u32, struct dev *);
};
-void dsk_detect(struct dev *dev);
+void disk_detect(struct dev *dev);
#endif
diff --git a/src/loader/inc/elf.h b/src/loader/inc/elf.h
index 4b19f2f..9cf5c2b 100644
--- a/src/loader/inc/elf.h
+++ b/src/loader/inc/elf.h
@@ -5,7 +5,7 @@
#define ELF_H
#include <def.h>
-#include <dev.h>
+#include <device.h>
#define ELF_MAG0 0x7F
#define ELF_MAG1 'E'
diff --git a/src/loader/inc/fs/ext2.h b/src/loader/inc/fs/ext2.h
index 0c2052a..ce19ddb 100644
--- a/src/loader/inc/fs/ext2.h
+++ b/src/loader/inc/fs/ext2.h
@@ -4,7 +4,7 @@
#define FS_EXT2_H
#include <def.h>
-#include <dev.h>
+#include <device.h>
#define EXT2_BOOT 0
#define EXT2_SUPER 1
diff --git a/src/loader/inc/int.h b/src/loader/inc/interrupt.h
index ccd9ea8..4706dbe 100644
--- a/src/loader/inc/int.h
+++ b/src/loader/inc/interrupt.h
@@ -1,13 +1,13 @@
// MIT License, Copyright (c) 2021 Marvin Borner
-#ifndef INT_H
-#define INT_H
+#ifndef INTERRUPT_H
+#define INTERRUPT_H
#include <def.h>
-#define INT_GATE 0x8e
-#define INT_TRAP 0xef
-#define INT_USER 0x60
+#define INTERRUPT_GATE 0x8e
+#define INTERRUPT_TRAP 0xef
+#define INTERRUPT_USER 0x60
#define IDT_ENTRY(offset, selector, type) \
(struct idt_entry) \
{ \
@@ -15,17 +15,17 @@
.base_high = (u16)(((offset) >> 16) & 0xffff), \
}
-struct int_frame {
+struct interrupt_frame {
u32 gs, fs, es, ds;
u32 edi, esi, ebp, esp, ebx, edx, ecx, eax;
- u32 int_no, err_code;
+ u32 interrupt_no, err_code;
u32 eip, cs, eflags;
} PACKED;
-struct int_frame_user {
+struct interrupt_frame_user {
u32 gs, fs, es, ds;
u32 edi, esi, ebp, esp, ebx, edx, ecx, eax;
- u32 int_no, err_code;
+ u32 interrupt_no, err_code;
u32 eip, cs, eflags;
u32 useresp, ss;
} PACKED;
@@ -44,6 +44,6 @@ struct idt_ptr {
} PACKED;
void idt_install(void);
-void int_event_handler_add(u32 int_no, void (*handler)(void));
+void interrupt_event_handler_add(u32 interrupt_no, void (*handler)(void));
#endif
diff --git a/src/loader/inc/lib.h b/src/loader/inc/library.h
index 2f49007..2f49007 100644
--- a/src/loader/inc/lib.h
+++ b/src/loader/inc/library.h
diff --git a/src/loader/inc/log.h b/src/loader/inc/log.h
index cb1acd8..f6a28e1 100644
--- a/src/loader/inc/log.h
+++ b/src/loader/inc/log.h
@@ -5,13 +5,14 @@
#include <def.h>
+u32 vsnprintf(char *str, u32 size, const char *format, va_list ap);
+
void serial_install(void);
void serial_print(const char *data);
+void log(const char *format, ...);
void vga_put_at(char ch, u8 x, u8 y, u8 color);
void vga_clear(void);
-
-void log(const char *format, ...);
void vga_log(const char *format, ...);
#endif
diff --git a/src/loader/inc/mbr.h b/src/loader/inc/mbr.h
index a9befe5..ec51944 100644
--- a/src/loader/inc/mbr.h
+++ b/src/loader/inc/mbr.h
@@ -4,7 +4,7 @@
#define MBR_H
#include <def.h>
-#include <dev.h>
+#include <device.h>
struct mbr_entry {
u8 attributes;
diff --git a/src/loader/inc/mem.h b/src/loader/inc/mem.h
deleted file mode 100644
index 7153465..0000000
--- a/src/loader/inc/mem.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// MIT License, Copyright (c) 2021 Marvin Borner
-
-#ifndef MEM_H
-#define MEM_H
-
-#include <def.h>
-
-enum mem_entry_type {
- MEM_NONE,
- MEM_USABLE,
- MEM_RESERVED,
- MEM_RECLAIMABLE,
- MEM_ACPI_NVS,
- MEM_UNUSABLE,
-};
-
-// Generalised memory map entry struct
-struct mem_entry {
- u32 base;
- u32 length;
- u32 type;
-};
-
-struct mem_map {
- struct mem_entry *entry;
- u32 count;
-};
-
-void mem_map(void);
-struct mem_map *mem_map_get(void);
-
-#endif
diff --git a/src/loader/inc/memory.h b/src/loader/inc/memory.h
new file mode 100644
index 0000000..1a74884
--- /dev/null
+++ b/src/loader/inc/memory.h
@@ -0,0 +1,32 @@
+// MIT License, Copyright (c) 2021 Marvin Borner
+
+#ifndef MEMORY_H
+#define MEMORY_H
+
+#include <def.h>
+
+enum memory_entry_type {
+ MEMORY_NONE,
+ MEMORY_USABLE,
+ MEMORY_RESERVED,
+ MEMORY_RECLAIMABLE,
+ MEMORY_ACPI_NVS,
+ MEMORY_UNUSABLE,
+};
+
+// Generalised memory map entry struct
+struct memory_entry {
+ u32 base;
+ u32 length;
+ u32 type;
+};
+
+struct memory_map {
+ struct memory_entry *entry;
+ u32 count;
+};
+
+void memory_map(void);
+struct memory_map *memory_map_get(void);
+
+#endif
diff --git a/src/loader/inc/pnc.h b/src/loader/inc/panic.h
index 73819c9..73819c9 100644
--- a/src/loader/inc/pnc.h
+++ b/src/loader/inc/panic.h
diff --git a/src/loader/inc/pic.h b/src/loader/inc/pic.h
index c2a7d87..d662454 100644
--- a/src/loader/inc/pic.h
+++ b/src/loader/inc/pic.h
@@ -6,6 +6,6 @@
#include <def.h>
void pic_install(void);
-void pic_ack(u32 int_no);
+void pic_ack(u32 interrupt_no);
#endif
diff --git a/src/loader/inc/impl.h b/src/loader/inc/protocol.h
index 58ae706..a667467 100644
--- a/src/loader/inc/impl.h
+++ b/src/loader/inc/protocol.h
@@ -3,7 +3,7 @@
#ifndef IMPL_H
#define IMPL_H
-#include <dev.h>
+#include <device.h>
enum impl_type {
IMPL_NONE,
diff --git a/src/loader/inc/impl/all.h b/src/loader/inc/protocols/all.h
index 01565a6..9b6e750 100644
--- a/src/loader/inc/impl/all.h
+++ b/src/loader/inc/protocols/all.h
@@ -3,10 +3,10 @@
#ifndef IMPL_ALL_H
#define IMPL_ALL_H
-#include <cfg.h>
+#include <config.h>
#include <def.h>
-u8 impl_detect(struct cfg_entry *cfg);
-void impl_exec(struct cfg_entry *cfg);
+u8 impl_detect(struct config_entry *cfg);
+void impl_exec(struct config_entry *cfg);
#endif
diff --git a/src/loader/inc/impl/mb1.h b/src/loader/inc/protocols/mb1.h
index 5e68ece..2a85bc0 100644
--- a/src/loader/inc/impl/mb1.h
+++ b/src/loader/inc/protocols/mb1.h
@@ -3,9 +3,9 @@
#ifndef IMPL_MB1_H
#define IMPL_MB1_H
-#include <cfg.h>
+#include <config.h>
#include <def.h>
-#include <dev.h>
+#include <device.h>
#define MB1_MAGIC 0x1badb002 // Identifies kernel
#define MB1_LOAD_MAGIC 0x2badb002 // Passed to kernel
@@ -16,7 +16,7 @@
#define MB1_INFO_MODS 0x00000008
#define MB1_INFO_AOUT_SYMS 0x00000010
#define MB1_INFO_ELF_SHDR 0x00000020
-#define MB1_INFO_MEM_MAP 0x00000040
+#define MB1_INFO_MEMORY_MAP 0x00000040
#define MB1_INFO_DRIVE_INFO 0x00000080
#define MB1_INFO_CONFIG_TABLE 0x00000100
#define MB1_INFO_BOOT_LOADER_NAME 0x00000200
@@ -53,8 +53,8 @@ struct mb1_elf_section_header_table {
struct mb1_info {
u32 flags;
- u32 mem_lower;
- u32 mem_upper;
+ u32 memory_lower;
+ u32 memory_upper;
u32 boot_device;
@@ -128,7 +128,7 @@ struct mb1_mod_list {
u32 pad;
};
-u8 mb1_detect(struct cfg_entry *cfg);
-void mb1_exec(struct cfg_entry *cfg);
+u8 mb1_detect(struct config_entry *cfg);
+void mb1_exec(struct config_entry *cfg);
#endif
diff --git a/src/loader/inc/impl/mb2.h b/src/loader/inc/protocols/mb2.h
index 3f64dbd..b471b0f 100644
--- a/src/loader/inc/impl/mb2.h
+++ b/src/loader/inc/protocols/mb2.h
@@ -3,9 +3,9 @@
#ifndef IMPL_MB2_H
#define IMPL_MB2_H
-#include <cfg.h>
+#include <config.h>
#include <def.h>
-#include <dev.h>
+#include <device.h>
#define MB2_MAGIC 0xe85250d6 // Identifies kernel
#define MB2_LOAD_MAGIC 0x36d76289 // Passed to kernel
@@ -55,7 +55,7 @@ enum mb2_tags {
MB2_TAG_ACPI_2 = 15,
};
-u8 mb2_detect(struct cfg_entry *cfg);
-void mb2_exec(struct cfg_entry *cfg);
+u8 mb2_detect(struct config_entry *cfg);
+void mb2_exec(struct config_entry *cfg);
#endif
diff --git a/src/loader/inc/rem.h b/src/loader/inc/real.h
index 61eb30a..a9d36dc 100644
--- a/src/loader/inc/rem.h
+++ b/src/loader/inc/real.h
@@ -1,15 +1,15 @@
// MIT License, Copyright (c) 2021 Marvin Borner
// Real mode emulation - Implementation by Napalm (see rem.asm)
-#ifndef REM_H
-#define REM_H
+#ifndef REAL_H
+#define REAL_H
#include <def.h>
#define EFLAGS_CF (1 << 0) // Carry flag
#define EFLAGS_ZF (1 << 6) // Zero flag
-struct rem_regs {
+struct real_regs {
u16 gs;
u16 fs;
u16 es;
@@ -24,6 +24,6 @@ struct rem_regs {
u32 eax;
} PACKED;
-void rem_int(u8 int_num, struct rem_regs *out_regs, struct rem_regs *in_regs);
+void real_int(u8 interrupt_num, struct real_regs *out_regs, struct real_regs *in_regs);
#endif