This commit is contained in:
Murphy 2025-04-04 12:33:14 -04:00
parent 58f4980105
commit b6e1e94060
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17
3 changed files with 43 additions and 42 deletions
kernel
cpu
fs
include/comus

View file

@ -89,7 +89,8 @@ static void isr_print_regs(regs_t *regs)
printf("r14: %#016lx (%lu)\n", regs->r14, regs->r14); printf("r14: %#016lx (%lu)\n", regs->r14, regs->r14);
printf("r15: %#016lx (%lu)\n", regs->r15, regs->r15); printf("r15: %#016lx (%lu)\n", regs->r15, regs->r15);
printf("rip: %#016lx (%lu)\n", regs->rip, regs->rip); printf("rip: %#016lx (%lu)\n", regs->rip, regs->rip);
printf("rflags: %#016lx (%lu)\n", (uint64_t)regs->rflags.raw, (uint64_t)regs->rflags.raw); printf("rflags: %#016lx (%lu)\n", (uint64_t)regs->rflags.raw,
(uint64_t)regs->rflags.raw);
puts("rflags: "); puts("rflags: ");
if (regs->rflags.cf) if (regs->rflags.cf)
puts("CF "); puts("CF ");
@ -170,8 +171,7 @@ char *EXCEPTIONS[] = {
"Reserved", "Reserved",
}; };
void idt_exception_handler(uint64_t exception, uint64_t code, void idt_exception_handler(uint64_t exception, uint64_t code, regs_t *state)
regs_t *state)
{ {
uint64_t cr2; uint64_t cr2;

View file

@ -4,8 +4,8 @@
struct disk fs_disks[MAX_DISKS]; struct disk fs_disks[MAX_DISKS];
struct file_system fs_loaded_file_systems[MAX_DISKS]; struct file_system fs_loaded_file_systems[MAX_DISKS];
void fs_init(void) { void fs_init(void)
{
// zero structures // zero structures
memsetv(fs_disks, 0, sizeof(fs_disks)); memsetv(fs_disks, 0, sizeof(fs_disks));
memsetv(fs_loaded_file_systems, 0, sizeof(fs_loaded_file_systems)); memsetv(fs_loaded_file_systems, 0, sizeof(fs_loaded_file_systems));
@ -13,10 +13,10 @@ void fs_init(void) {
// TODO: go though ide and/or sata drivers to load all disks into `fs_disks` structures // TODO: go though ide and/or sata drivers to load all disks into `fs_disks` structures
// TODO: go though each disk and attempt to load a file system // TODO: go though each disk and attempt to load a file system
} }
struct disk *fs_get_root_disk(void) { struct disk *fs_get_root_disk(void)
{
// NOTE: currently im just getting the first disk // NOTE: currently im just getting the first disk
// found, is this fine? // found, is this fine?
@ -29,7 +29,8 @@ struct disk *fs_get_root_disk(void) {
return NULL; return NULL;
} }
struct file_system *fs_get_root_file_system(void) { struct file_system *fs_get_root_file_system(void)
{
// NOTE: currently im just getting the first file system // NOTE: currently im just getting the first file system
// found, is this fine? // found, is this fine?
@ -44,36 +45,36 @@ struct file_system *fs_get_root_file_system(void) {
struct file *fs_find_file_abs(struct file_system *fs, char *abs_path) struct file *fs_find_file_abs(struct file_system *fs, char *abs_path)
{ {
(void) fs; (void)fs;
(void) abs_path; (void)abs_path;
panic("fs_find_file_abs NOT YET IMPLEMENTED"); panic("fs_find_file_abs NOT YET IMPLEMENTED");
} }
struct file *fs_find_file_rel(struct file *rel, char *rel_path) struct file *fs_find_file_rel(struct file *rel, char *rel_path)
{ {
(void) rel; (void)rel;
(void) rel_path; (void)rel_path;
panic("fs_find_file_rel NOT YET IMPLEMENTED"); panic("fs_find_file_rel NOT YET IMPLEMENTED");
} }
int disk_read(struct disk *disk, size_t offset, size_t len, uint8_t *buffer) int disk_read(struct disk *disk, size_t offset, size_t len, uint8_t *buffer)
{ {
(void) disk; (void)disk;
(void) offset; (void)offset;
(void) len; (void)len;
(void) buffer; (void)buffer;
panic("disk_read NOT YET IMPLEMENTED"); panic("disk_read NOT YET IMPLEMENTED");
} }
int disk_write(struct disk *disk, size_t offset, size_t len, uint8_t *buffer) int disk_write(struct disk *disk, size_t offset, size_t len, uint8_t *buffer)
{ {
(void) disk; (void)disk;
(void) offset; (void)offset;
(void) len; (void)len;
(void) buffer; (void)buffer;
panic("disk_write NOT YET IMPLEMENTED"); panic("disk_write NOT YET IMPLEMENTED");
} }

View file

@ -14,28 +14,28 @@
typedef union { typedef union {
uint64_t raw; uint64_t raw;
struct { struct {
uint64_t cf : 1; uint64_t cf : 1;
uint64_t : 1; uint64_t : 1;
uint64_t pf : 1; uint64_t pf : 1;
uint64_t : 1; uint64_t : 1;
uint64_t af : 1; uint64_t af : 1;
uint64_t : 1; uint64_t : 1;
uint64_t zf : 1; uint64_t zf : 1;
uint64_t sf : 1; uint64_t sf : 1;
uint64_t tf : 1; uint64_t tf : 1;
uint64_t if_ : 1; uint64_t if_ : 1;
uint64_t df : 1; uint64_t df : 1;
uint64_t of : 1; uint64_t of : 1;
uint64_t iopl : 2; uint64_t iopl : 2;
uint64_t nt : 1; uint64_t nt : 1;
uint64_t md : 1; uint64_t md : 1;
uint64_t rf : 1; uint64_t rf : 1;
uint64_t vm : 1; uint64_t vm : 1;
uint64_t ac : 1; uint64_t ac : 1;
uint64_t vif : 1; uint64_t vif : 1;
uint64_t vip : 1; uint64_t vip : 1;
uint64_t id : 1; uint64_t id : 1;
uint64_t : 42; uint64_t : 42;
}; };
} rflags_t; } rflags_t;