Fix vfs saying the message was sent from init's stdio mailbox.

Unfortunately, this breaks the VFS, so the rest of this commit attempts 
(and fails) to fix it.
This commit is contained in:
pjht 2019-07-27 11:11:28 -05:00
parent 7974c1e026
commit 823a255e1a
7 changed files with 6595 additions and 57 deletions

View File

@ -1,15 +1,15 @@
set pagination off
target remote localhost:1234
symbol-file kernel/kernel.elf
add-symbol-file init/init
add-symbol-file fsdrv/fsdrv
b tasking.c:123
commands
silent
disable breakpoints
symbol-file kernel/kernel.elf
p task->pid
if task->pid==1
add-symbol-file init/init
if task->pid==3
add-symbol-file fsdrv/fsdrv
enable breakpoints
else
enable breakpoints 1

View File

@ -1,57 +1,17 @@
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, iodebug=1
config_interface: textconfig
display_library: sdl2
memory: host=32, guest=32
romimage: file="/usr/local/Cellar/bochs/2.6.9_2/share/bochs/BIOS-bochs-latest", address=0x0, options=none
vgaromimage: file="/usr/local/Cellar/bochs/2.6.9_2/share/bochs/VGABIOS-lgpl-latest"
boot: cdrom
floppy_bootsig_check: disabled=0
# no floppya
# no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=none, path=ext2.img, mode=flat, cylinders=65, heads=16, spt=63, model="Generic 1234", biosdetect=auto, translation=auto
ata0-slave: type=cdrom, path=os.iso, status=inserted, model="Generic 1234", biosdetect=auto
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=none
ata1-slave: type=none
ata2: enabled=0
ata3: enabled=0
optromimage1: file=none
optromimage2: file=none
optromimage3: file=none
optromimage4: file=none
optramimage1: file=none
optramimage2: file=none
optramimage3: file=none
optramimage4: file=none
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=5, realtime=1
cpu: count=1:1:1, ips=640000000, quantum=16, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0
cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, avx_f16c=0, avx_fma=0, bmi=0, xop=0, fma4=0
cpuid: tbm=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0, smep=0, smap=0, mwait=1, vmx=1
print_timestamps: enabled=0
debugger_log: -
magic_break: enabled=1
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local, rtc_sync=0
# no cmosimage
# no loader
log: bochsout.txt
logprefix: %t%e%d
debug: action=ignore, pci=report, pci2isa=report, pci_ide=report
debug: action=ignore
info: action=report
error: action=report
panic: action=ask
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
mouse: type=ps2, enabled=1, toggle=ctrl+mbutton
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
speaker: enabled=1, mode=gui
parport1: enabled=1, file=none
parport2: enabled=0
com1: enabled=0
com2: enabled=0
com3: enabled=0
com4: enabled=0
cpu: count=1 ips=200000000, reset_on_triple_fault=0

57
bochsrc.txt.old Normal file
View File

@ -0,0 +1,57 @@
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, iodebug=1
config_interface: textconfig
display_library: sdl2
memory: host=32, guest=32
romimage: file="/usr/local/Cellar/bochs/2.6.9_2/share/bochs/BIOS-bochs-latest", address=0x0, options=none
vgaromimage: file="/usr/local/Cellar/bochs/2.6.9_2/share/bochs/VGABIOS-lgpl-latest"
boot: cdrom
floppy_bootsig_check: disabled=0
# no floppya
# no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=none, path=ext2.img, mode=flat, cylinders=65, heads=16, spt=63, model="Generic 1234", biosdetect=auto, translation=auto
ata0-slave: type=cdrom, path=os.iso, status=inserted, model="Generic 1234", biosdetect=auto
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=none
ata1-slave: type=none
ata2: enabled=0
ata3: enabled=0
optromimage1: file=none
optromimage2: file=none
optromimage3: file=none
optromimage4: file=none
optramimage1: file=none
optramimage2: file=none
optramimage3: file=none
optramimage4: file=none
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=5, realtime=1
cpu: count=1:1:1, ips=640000000, quantum=16, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0
cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, avx_f16c=0, avx_fma=0, bmi=0, xop=0, fma4=0
cpuid: tbm=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0, smep=0, smap=0, mwait=1, vmx=1
print_timestamps: enabled=0
debugger_log: -
magic_break: enabled=1
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local, rtc_sync=0
# no cmosimage
# no loader
log: bochsout.txt
logprefix: %t%e%d
debug: action=ignore, pci=report, pci2isa=report, pci_ide=report
info: action=report
error: action=report
panic: action=ask
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
mouse: type=ps2, enabled=1, toggle=ctrl+mbutton
speaker: enabled=1, mode=gui
parport1: enabled=1, file=none
parport2: enabled=0
com1: enabled=0
com2: enabled=0
com3: enabled=0
com4: enabled=0

1502
fsdrv/log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -136,6 +136,10 @@ void isr_handler(registers_t r) {
char str[11];
int_to_ascii(getPID(),str);
vga_write_string(str);
vga_write_string(" and address ");
str[0]='\0';
hex_to_ascii(r.eip,str);
vga_write_string(str);
if (r.err_code==0) {
vga_write_string(", kernel process tried to read a non-present page entry at address ");
} else if (r.err_code==1) {
@ -156,7 +160,12 @@ void isr_handler(registers_t r) {
str[0]='\0';
hex_to_ascii(addr,str);
vga_write_string(str);
vga_write_string("\n");
vga_write_string(".");
vga_write_string(" Stack is at ");
str[0]='\0';
hex_to_ascii(r.useresp,str);
vga_write_string(str);
vga_write_string(".\n");
// if ((r.err_code&1)==0) {
// // int dir_entry=(addr&0xFFC00000)>>22;
// // int table_entry=(addr&0x3FF000)>12;

5012
kernel/log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,8 +28,8 @@ static vfs_mapping* head_mapping;
static vfs_mapping* tail_mapping;
vfs_file* fd_tables[32768];
uint16_t open_fds[32768];
vfs_message* get_message(Message* msg,uint32_t box) {
uint32_t box;
vfs_message* get_message(Message* msg) {
msg->msg=malloc(sizeof(vfs_message));
mailbox_get_msg(box,msg,sizeof(vfs_message));
while (msg->from==0 && msg->size==0) {
@ -37,8 +37,6 @@ vfs_message* get_message(Message* msg,uint32_t box) {
yield();
}
vfs_message* vfs_msg=(vfs_message*)msg->msg;
msg->to=msg->from;
msg->from=box;
return vfs_msg;
}
@ -98,13 +96,13 @@ char vfs_fopen(vfs_message* vfs_msg,uint32_t from) {
vfs_msg->path[i]=path_buf[i+mntpnt_len];
}
free(path_buf);
msg.from=1;
msg.from=box;
msg.to=drvs[mntpnt->type];
msg.size=sizeof(vfs_message);
msg.msg=vfs_msg;
mailbox_send_msg(&msg);
yield();
vfs_message* vfs_msg=get_message(&msg,1);
vfs_message* vfs_msg=get_message(&msg);
if (vfs_msg->flags!=0) {
return vfs_msg->flags;
}
@ -138,13 +136,13 @@ char vfs_putc(vfs_message* vfs_msg,uint32_t from) {
strcpy(&vfs_msg->mode[0],file_info.mode);
vfs_msg->pos=file_info.pos;
Message msg;
msg.from=1;
msg.from=box;
msg.to=file_info.mntpnt->type;
msg.size=sizeof(vfs_message);
msg.msg=vfs_msg;
mailbox_send_msg(&msg);
yield();
vfs_msg=get_message(&msg,1);
vfs_msg=get_message(&msg);
if (vfs_msg->flags!=0) {
return vfs_msg->flags;
}
@ -154,11 +152,11 @@ char vfs_putc(vfs_message* vfs_msg,uint32_t from) {
int main() {
init_vfs();
uint32_t box=mailbox_new(16);
box=mailbox_new(16);
yield();
while (1) {
Message msg;
vfs_message* vfs_msg=get_message(&msg,box);
vfs_message* vfs_msg=get_message(&msg);
switch (vfs_msg->type) {
case VFS_OPEN:
vfs_msg->flags=vfs_fopen(vfs_msg,msg.from);