Qemu crashing; troubleshooting

This commit is contained in:
notsomeidiot123 2026-06-26 19:15:37 -04:00
parent c2f258f1bb
commit daa915363d
5 changed files with 18 additions and 9 deletions

View File

@ -86,6 +86,7 @@ void pci_make_file(uint32_t class, uint8_t bus, uint8_t slot, uint8_t func){
file = fcreate(cpy, 0); file = fcreate(cpy, 0);
// file->read = pci_read_file; // file->read = pci_read_file;
// file->write = pci_write_file; // file->write = pci_write_file;
if(file == 0) continue;
file->fileops = &pci_fileops; file->fileops = &pci_fileops;
if(tries >= 254){ if(tries >= 254){
mlog(MODULE_NAME, "Failed to make PCI file for device!\n", MLOG_PRINT); mlog(MODULE_NAME, "Failed to make PCI file for device!\n", MLOG_PRINT);

View File

@ -58,16 +58,18 @@ extern void kmain(kernel_info_t *kernel_info){
pic_setmask(0x0, PIC1_DATA); pic_setmask(0x0, PIC1_DATA);
pic_setmask(0x0, PIC2_DATA); pic_setmask(0x0, PIC2_DATA);
fcreate("/dev", FS_FILE_IS_DIR); // fcreate("/dev", FS_FILE_IS_DIR);
fcreate("/dev/disk", FS_FILE_IS_DIR); // fcreate("/dev/disk", FS_FILE_IS_DIR);
fcreate("/tmp", FS_FILE_IS_DIR); // fcreate("/tmp", FS_FILE_IS_DIR);
fcreate("/boot", FS_FILE_IS_DIR); // fcreate("/boot", FS_FILE_IS_DIR);
mlog("KERNEL", "Initializing Scheduler & starting PID 1\n", MLOG_PRINT); mlog("KERNEL", "Initializing Scheduler & starting PID 1\n", MLOG_PRINT);
boot_info = kernel_info; boot_info = kernel_info;
scheduler_init(); scheduler_init();
disable_interrupts();
//scheduler doesn't work if there is no PID0, and I don't know why. //scheduler doesn't work if there is no PID0, and I don't know why.
thread_start(pid0); thread_start(pid0);
thread_start(sysinit); thread_start(sysinit);
for(;;);
enable_interrupts(); enable_interrupts();
for(;;);//we actually **shouldn't** return, like, ever. That's bad. for(;;);//we actually **shouldn't** return, like, ever. That's bad.
return; return;

View File

@ -97,7 +97,8 @@ uint32_t module_api(uint32_t func, ...){
buffer = va_arg(vars, void *); buffer = va_arg(vars, void *);
offset = va_arg(vars, uint32_t); offset = va_arg(vars, uint32_t);
count = va_arg(vars, uint32_t); count = va_arg(vars, uint32_t);
return_value = readdir(file, buffer, offset, count); // return_value = readdir(file, buffer, offset, count);
return_value = 0;
break; break;
case MODULE_API_MAP: case MODULE_API_MAP:
return_value = 0; return_value = 0;

View File

@ -23,10 +23,15 @@ void ramfs_init(){
mlog(MODULE_NAME, "Initializing VFS\n", MLOG_PRINT); mlog(MODULE_NAME, "Initializing VFS\n", MLOG_PRINT);
root_dir.private = kmalloc(1); root_dir.private = kmalloc(1);
root_dir.size = PAGE_SIZE_BYTES;//one page is 4096 bytes root_dir.size = PAGE_SIZE_BYTES;//one page is 4096 bytes
// printf("Sizeof VFILE_T: %d", sizeof(vfile_t));
} }
vfile_t *resolve_path(char *pathname){ //resolves the path relative to start
vfile_t *resolve_path(char *pathname, vfile_t *start){
// vfile_t **buffer = (vfile_t *)start->private;
// for(int i = 0; i < start->size/4, i++){
// }
} }
vfile_t *ramfs_create(char *path, FS_FILE_FLAGS flags){ vfile_t *ramfs_create(char *path, FS_FILE_FLAGS flags){

View File

@ -32,7 +32,7 @@ typedef struct virtual_file{
uint32_t id;//for use in drivers uint32_t id;//for use in drivers
void *private; //also for use in drivers void *private; //also for use in drivers
uint32_t size; uint32_t size; //should be in bytes
uint32_t offset; //for use in drivers uint32_t offset; //for use in drivers
}vfile_t; }vfile_t;
@ -46,5 +46,5 @@ int fread(vfile_t *file_entry, void *byte_array, uint32_t offset, uint32_t count
vfile_t *vfcreate(vfile_t *parent, char *relpath, FS_FILE_FLAGS flags); vfile_t *vfcreate(vfile_t *parent, char *relpath, FS_FILE_FLAGS flags);
vfile_t *rfopen(char *name, vfile_t *dir); vfile_t *rfopen(char *name, vfile_t *dir);
vfile_t *fclose(vfile_t *);
vfile_t *fopen(char *path); vfile_t *fopen(char *path);