0.0.2d: Added BGA support, graphics!

This commit is contained in:
2026-06-05 16:14:14 -05:00
parent 5971218b56
commit f3b2f95af5
40 changed files with 1007 additions and 1197 deletions

View File

@ -1,49 +0,0 @@
#include <types.h>
#include <string.h>
#include <drivers/ide.h>
#include <fs/ekfs.h>
/* work on this later */
#if 0
/* note: __l being 0 is allowed, because that way read() can be used to tell if a file exists (with return value 0) */
int ekfs_read(struct ekfs_file* __f, void* __b, size_t __l)
{
int rv = 0;
if (!__f || !__b || (!__f->f_inode))
{
return -1;
}
/* we assume drive 0 is already mounted */
char buffer[512];
memset(buffer, 0, 512);
int num_sectors = __f->f_inode->i_len / 512;
if ((__l / 512) > num_sectors)
{
return EKFS_E_FILETOOSMALL;
}
int read_sectors = num_sectors;
for (int i = 0; i < read_sectors; i++);
{
rv = read_sector(__f->f_inode->i_start, buffer);
if (rv != 0)
{
break;
}
}
return rv;
}
#endif

View File

@ -20,6 +20,8 @@ int fat16_mount(uint8_t drive)
return -1;
}
(void) drive;
fs.bytes_per_sector = boot_sector[11] | (boot_sector[12] << 8);
fs.sectors_per_cluster = boot_sector[13];
fs.reserved_sector_count = boot_sector[14] | (boot_sector[15] << 8);
@ -53,7 +55,7 @@ static int read_fat_entry(uint16_t cluster, uint16_t* out_value)
return -1;
}
if (idx == fs.bytes_per_sector - 1)
if (idx == (uint32_t)(fs.bytes_per_sector - 1))
{
/* entry spans boundary -> read next sector */
uint8_t next_sector[SECTOR_SIZE];

View File

@ -7,25 +7,7 @@
/* we use something similar to the Linux kernel in terms of a VFS system */
#define MAX_FDS 64
struct inode {
size_t size;
int permissions;
void *fs_data; /* FS-specific */
};
struct file_ops {
int (*read)(struct file*, char*, size_t);
int (*write)(struct file*, const char*, size_t);
};
struct file {
struct inode* f_inode;
size_t f_offset;
size_t f_refcount;
const struct file_ops f_ops;
};
@ -35,17 +17,9 @@ struct fdtable {
int vfs_handle_stdout(struct file* __f, const char* __s, size_t __l)
{
(void) __f;
terminal_write(__s, __l);
return 0;
}
#if 0
struct fdtable* vfs_init_kernel_fdtable(void)
{
#if 0
struct fdtable* ft = malloc(sizeof(struct fdtable));
struct file* _stdout = malloc(sizeof(struct file));
struct file* _stdin = malloc(sizeof(struct file));
@ -59,9 +33,9 @@ struct fdtable* vfs_init_kernel_fdtable(void)
_stdout->f_offset = 0;
_stdout->f_refcount = 1;
_stdout->f_ops = { .read = NULL, .write = vfs_handle_stdout };
#endif
return NULL;
}
#endif
int init_vfs(int argc, char** argv)
{