os/fsdrv/main.c

39 lines
847 B
C
Raw Normal View History

#include <tasking.h>
2019-07-13 10:40:23 -05:00
#include <stdlib.h>
#include <mailboxes.h>
#include <ipc/vfs.h>
#include <memory.h>
2019-07-31 19:46:01 -05:00
#include <grub/text_fb_info.h>
#include "vga.h"
2019-08-03 15:50:23 -05:00
#include <vfs.h>
int main() {
2019-07-31 19:46:01 -05:00
text_fb_info info;
info.address=map_phys((void*)0xB8000,10);
info.width=80;
info.height=25;
vga_init(info);
2019-07-13 10:40:23 -05:00
uint32_t box=mailbox_new(16);
register_fs("devfs",box);
mount("","devfs","/dev");
2019-07-13 10:40:23 -05:00
for (;;) {
yield();
2019-07-13 10:40:23 -05:00
Message msg;
msg.msg=malloc(sizeof(vfs_message));
mailbox_get_msg(box,&msg,sizeof(vfs_message));
if (msg.from==0) {
yield();
2019-07-13 10:40:23 -05:00
} else {
vfs_message* vfs_msg=(vfs_message*)msg.msg;
2019-07-31 19:46:01 -05:00
char str[]={(char)vfs_msg->data,'\0'};
vga_write_string(&str[0]);
2019-07-13 10:40:23 -05:00
msg.to=msg.from;
msg.from=box;
vfs_msg->flags=0;
2019-07-13 10:40:23 -05:00
mailbox_send_msg(&msg);
yield();
}
free(msg.msg);
}
}