diff options
| -rw-r--r-- | fs/fd.c | 9 | ||||
| -rw-r--r-- | grubiso/boot/grub/grub.cfg | 2 | ||||
| -rw-r--r-- | kernel/interrupts.c | 8 | ||||
| -rw-r--r-- | kernel/kernel.c | 2 | ||||
| -rw-r--r-- | kernel/kernel.h | 2 | ||||
| -rw-r--r-- | kernel/scheduler.c | 14 | ||||
| -rw-r--r-- | kernel/syscalls.c | 11 | ||||
| -rw-r--r-- | userspace/Makefile | 2 | ||||
| -rw-r--r-- | userspace/files/file.txt | 4 | ||||
| -rw-r--r-- | userspace/fsh.c | 5 | ||||
| -rw-r--r-- | userspace/init.c | 6 | ||||
| -rw-r--r-- | userspace/xterm/xterm.c | 7 |
12 files changed, 51 insertions, 21 deletions
@@ -133,7 +133,7 @@ void pipe_r_close(uint8_t *data) { uint8_t *mem=data+sizeof(ringbuffer); *mem-=1; - klog("closing read end of pipe, ref count=%d",*mem); + klog("closing read end of pipe at 0x%08x, ref count=%d",mem,*mem); /* if(*mem==0) // TODO : check other end too! and close on w_close { @@ -149,14 +149,14 @@ void pipe_w_close(uint8_t *data) uint8_t *mem=data+sizeof(ringbuffer); mem+=4; *mem-=1; - klog("closing write end of pipe, ref count=%d",*mem); + klog("closing write end of pipe at 0x%08x, ref count=%d",mem,*mem); } static fd pipe_r_dupl(fd *f) { uint8_t *mem=f->data+sizeof(ringbuffer); *mem+=1; - klog("duplicating read end of pipe, ref count=%d",*mem); + klog("duplicating read end of pipe at 0x%08x, ref count=%d",mem,*mem); return *f; } @@ -165,7 +165,7 @@ static fd pipe_w_dupl(fd *f) uint8_t *mem=f->data+sizeof(ringbuffer); mem+=4; *mem+=1; - klog("duplicating write end of pipe, ref count=%d",*mem); + klog("duplicating write end of pipe at 0x%08x, ref count=%d",mem,*mem); return *f; } @@ -209,7 +209,6 @@ bool pipe_eof(uint8_t *data) uint8_t *mem=data+sizeof(ringbuffer); mem+=4; - //we assume EOF if there is no data anymore AND no writers! return (!ringbuffer_has(data))&&(*mem==0); } diff --git a/grubiso/boot/grub/grub.cfg b/grubiso/boot/grub/grub.cfg index f16c3a0..ad49f88 100644 --- a/grubiso/boot/grub/grub.cfg +++ b/grubiso/boot/grub/grub.cfg @@ -1,4 +1,4 @@ -set timeout=1 //seconds +set timeout=0 //seconds if loadfont ${prefix}/fonts/unicode.pf2 diff --git a/kernel/interrupts.c b/kernel/interrupts.c index ce1d7c7..aed1a50 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -64,6 +64,8 @@ void interrupt_register(uint32_t irq, uint32_t func_addr) */ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) { + uint32_t cpu=smp_get(SMP_APIC_ID); + if(handlers[irq]!=0) { uint32_t (*f)(uint32_t esp)=handlers[irq]; @@ -76,7 +78,11 @@ uint32_t interrupt_handler(uint32_t esp, uint32_t irq) if(irq==INTERRUPT_APIC_TIMER) { - compositor_wake(); + if(cpu==0) + { + compositor_wake(); + scheduler_wake_worker(esp); + } } if(irq==INTERRUPT_APIC_TIMER || irq==INTERRUPT_IPI) diff --git a/kernel/kernel.c b/kernel/kernel.c index cf65e18..7c06ebf 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -163,7 +163,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) klog("Compositor init ..."); compositor_init(cfg_multiboot->framebuffer_width,cfg_multiboot->framebuffer_height,cfg_multiboot->framebuffer_pitch); - compositor_set_background("/home/miguel/bg.ppm"); + compositor_set_background("/home/miguel/bg2.ppm"); // -- KB -- // klog("Keyboard init ..."); diff --git a/kernel/kernel.h b/kernel/kernel.h index 03429f4..fad803c 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -31,7 +31,7 @@ REFERENCES //#define FOOLOS_COLORLESS // Turn off colors in log #define HIDE_FIXME -#define FOOLOS_APIC_FREQ 3 // how many apic ticks per second +#define FOOLOS_APIC_FREQ 15 // how many apic ticks per second #define MAX_MOUNTS 10 diff --git a/kernel/scheduler.c b/kernel/scheduler.c index 6ee4416..12c4ffd 100644 --- a/kernel/scheduler.c +++ b/kernel/scheduler.c @@ -207,8 +207,15 @@ void scheduler_func() while(1) { + if(cpu==0) + { task_syscall_worker(); } + else + { + asm("hlt"); // sleeper task + } + } //task_list[cpu][0].syscall=true; // sleep //__asm__("int $0x81"); // wake scheduler! with IPI @@ -231,7 +238,7 @@ void scheduler_func() uint64_t t0=x86_rdtscp(); asm("hlt"); // sleeper task uint64_t t1=x86_rdtscp(); - klog("task 1 / slept cycles: l:%d h:%d",(t1-t0)); +// klog("task 1 / slept cycles: l:%d h:%d",(t1-t0)); } } @@ -242,7 +249,7 @@ void scheduler_func() uint64_t t0=x86_rdtscp(); asm("hlt"); // sleeper task uint64_t t1=x86_rdtscp(); - klog("task 2 (sleeper) / slept cycles: l:%d h:%d",(t1-t0)); + // klog("task 2 (sleeper) / slept cycles: l:%d h:%d",(t1-t0)); } } @@ -339,7 +346,8 @@ void task_syscall_worker() wake_mouse|=mouse_worker(); //x86_sti(); - if(wake_mouse)compositor_swap_buffers(); + //if(wake_mouse) + compositor_swap_buffers(); if(wake)scheduler_wake_all(); //if(cpu==0)compositor_swap_buffers(); diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 130e6dd..8ff6241 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -38,8 +38,15 @@ fd *get_fd(uint32_t pid,uint32_t file) void fd_init_std_streams(uint32_t pid) { - // fds[pid][0]=fd_from_ringbuffer(); - // open_fd[pid][0]=true; + fds[pid][0]=fd_from_ringbuffer(); + open_fd[pid][0]=true; + + fds[pid][1]=fd_from_ringbuffer(); + open_fd[pid][1]=true; + + fds[pid][2]=fd_from_ringbuffer(); + open_fd[pid][2]=true; + return; static bool first=true; diff --git a/userspace/Makefile b/userspace/Makefile index b1b077d..af799fb 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -1,4 +1,4 @@ -IMAGESIZE=20000 #ext2.img size in Kb +IMAGESIZE=30000 #ext2.img size in Kb ####################### diff --git a/userspace/files/file.txt b/userspace/files/file.txt index 8cdd524..7a8a521 100644 --- a/userspace/files/file.txt +++ b/userspace/files/file.txt @@ -80,3 +80,7 @@ both eyes so that they made a half-garland on the projecting steel. There was no part of the hook that a great fish could feel which was not sweet smelling and good tasting. +smelling and good tasting. +smelling and good tasting. +smelling and good tasting. + diff --git a/userspace/fsh.c b/userspace/fsh.c index 62cd27e..76c0954 100644 --- a/userspace/fsh.c +++ b/userspace/fsh.c @@ -33,6 +33,7 @@ void version() { puts("Fool's Shell version git-commit:" GIT_REVISION "\ncompiled on " __DATE__ " at " __TIME__); } + void help() { puts( "\nfoolshell: supported built-in commands/functions:\n\n" @@ -58,6 +59,8 @@ void prompt() int main(int argc, char **argv) { + while(1); + for(int i=0;i<argc;i++) { if(!strcmp(argv[i],"--version")) @@ -242,7 +245,7 @@ bool process(char *buf) int last=0; for(last=0;token[last+1]!=NULL;last++); - printf("last: %s\n",token[last]); + //printf("last: %s\n",token[last]); if(strcmp(token[last],"&"))_wait(pid); } diff --git a/userspace/init.c b/userspace/init.c index 645acd9..a2b2425 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -6,11 +6,7 @@ int main(int argc, char **argv) { - - // loop forever and spawn shells if the top-shell exits - int fds[2]; - _pipe(fds); - + _execve("/bin/xterm",NULL,NULL); int pid=_fork(); diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c index 96389a9..31feea7 100644 --- a/userspace/xterm/xterm.c +++ b/userspace/xterm/xterm.c @@ -16,6 +16,7 @@ int main() int pid=_fork(); + if(!pid) { _close(xterm_in[1]); @@ -25,9 +26,13 @@ int main() _dup2(xterm_out[1],1);// stdout _dup2(xterm_out[1],2);// stderr + while(1); + char *argv1[]={"/bin/fsh",0}; char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0}; + while(1); + _execve("/bin/fsh",argv1,env1); // replace process with our foolshell :) } @@ -36,6 +41,8 @@ int main() _dup2(xterm_in[1],1); // compositor writes here. + while(1); + while(1) { char buf[1]; |
