diff options
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | kernel/config.h | 12 | ||||
| -rw-r--r-- | kernel/kernel.c | 50 | ||||
| -rw-r--r-- | kernel/syscalls.c | 2 | ||||
| -rw-r--r-- | kernel/task.c | 2 | ||||
| -rw-r--r-- | userspace/Makefile | 7 | ||||
| -rw-r--r-- | userspace/clear.c | 9 | ||||
| -rw-r--r-- | userspace/shell.c | 30 | ||||
| -rw-r--r-- | userspace/smalltest.c | 4 | ||||
| -rw-r--r-- | video/console.c | 2 |
10 files changed, 77 insertions, 49 deletions
@@ -155,3 +155,11 @@ REFERENCES * http://wiki.osdev.org/Virtual_8086_Mode * http://wiki.xomb.org/index.php?title=ACPI_Tables * and many many more... + +NOTES +===== +in freestanding mode we can just use this c lib headers: +stdbool,sddef,stdint, +float,iso646,limits,stdarg + + diff --git a/kernel/config.h b/kernel/config.h index e48c63c..fb68dec 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -4,11 +4,15 @@ * ********************************************/ -//#define FOOLOS_COMPILE_FLOPPY // compile floppy drivers -#define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line -#define FOOLOS_LOG_OFF // do not log anything -#define FOOLOS_CONSOLE // otherwise VESA will be used! +#ifndef FOOLOS_CONFIG_H +#define FOOLOS_CONFIG_H + +#define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line +#define FOOLOS_LOG_OFF // do not log anything +#define FOOLOS_CONSOLE // otherwise VESA will be used! #define MEM_PRINT_MEMORYMAP #define LOG_BUF_SIZE 4069 #define LOG_SYSCALLS +#endif + diff --git a/kernel/kernel.c b/kernel/kernel.c index f788cee..66ca21a 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,22 +1,17 @@ -/* - * in freestanding mode we can just use this c lib headers - * stdbool,sddef,stdint, - * float,iso646,limits,stdarg - */ +#define FOOLOS_MODULE_NAME "kernel" #ifdef __linux__ #error "Watchout! this is not Linux but FoolOS. Use a cross-compiler" #endif -#define FOOLOS_MODULE_NAME "kernel" +#include "config.h" #include <stdint.h> -#include "config.h" #include "asm/asm.h" #include "lib/logger/log.h" -#include "lib/bool/bool.h" + #include "lib/buffer/ringbuffer.h" #include "smp.h" @@ -37,17 +32,10 @@ #include "task.h" -// -// KERNEL MAIN -// +// mp informs us if this if this is the main processor void kernel_main(uint32_t initial_stack, int mp) { // - // Configuring the PIT timer. - // - timer_init(); - - // // Memory Init // // after this is set up we will be able to allocate and deallocate @@ -59,9 +47,14 @@ void kernel_main(uint32_t initial_stack, int mp) mem_init(0x7c00+1,*((uint16_t *)(0x7c00))); // + // Configuring the PIT timer. + // + timer_init(); + + // // Activate Virtual Memory (paging) // - //vmem_init(); + vmem_init(); // // init output to screen @@ -74,7 +67,7 @@ void kernel_main(uint32_t initial_stack, int mp) // - // Setup PIC + // Setup PIC (interrupts) // pic_setup(); @@ -110,6 +103,11 @@ void kernel_main(uint32_t initial_stack, int mp) // ringbuffer for stdin! ringbuffer_init(); + // load and run inode 15 (shell) + // we will come back into the kernel only on interrupts... + syscall_execve(15,0,0); + + // // Start the other Processors (also before paging for some reason!) // @@ -118,7 +116,6 @@ void kernel_main(uint32_t initial_stack, int mp) // but it will be copied over mbr - // // Scan the PCI Bus // @@ -128,30 +125,17 @@ void kernel_main(uint32_t initial_stack, int mp) //pci_init(); // - // Initialize Floppy Disk if activated in config.h - // Sadly we won't use it anyway so its uncommented anyway. - // - //#ifdef FOOLOS_COMPILE_FLOPPY - //floppy_init(); - //#endif - - // // Initialize Multitasking // // For now this starts three "tasks" which are scheduled // round robin style. // - syscall_execve(15,0,0); // run fool-shell! (execve needs inode id) //task_init(); - // - //vesa_init_doublebuff(); - - // Just hang around here, if its reached. // we do our tasks anyway. on the next clock tick. - while(1); + // while(1); } diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 0e4ee66..401a5aa 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -344,7 +344,7 @@ int syscall_exit(int ret, int none1, int none2) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"exit (ret=%d)", ret); #endif - static char *argv[]={"test",NULL}; + static char *argv[]={"shell","--silent",NULL}; syscall_execve(15,argv,0); // start shell } diff --git a/kernel/task.c b/kernel/task.c index ef25b05..df48afb 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -32,7 +32,7 @@ void task_test1() cc2=c2; cc3=c3; - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"tasks progress: %d %dn", cc2, cc3); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"tasks progress: %d %d", cc2, cc3); asm("sti"); c1++; diff --git a/userspace/Makefile b/userspace/Makefile index d66afd2..55e78bc 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -1,7 +1,10 @@ CC=i686-foolos-gcc -CFLAGS=-w -PROGS=shell simple brainfuck add checker ls +CFLAGS= +CFLAGS+=-w +CFLAGS+=-std=gnu11 + +PROGS=shell simple brainfuck add checker ls clear ext2.img: $(PROGS) dd if=/dev/zero of=ext2.img bs=512 count=5000 diff --git a/userspace/clear.c b/userspace/clear.c new file mode 100644 index 0000000..ab0eb51 --- /dev/null +++ b/userspace/clear.c @@ -0,0 +1,9 @@ +int main() +{ + for(int i=0;i<24;i++) + { + puts(); + } + + return 0; +} diff --git a/userspace/shell.c b/userspace/shell.c index 83f1e6f..bb8b873 100644 --- a/userspace/shell.c +++ b/userspace/shell.c @@ -1,12 +1,30 @@ #include <stdio.h> #include <stdint.h> +#include <stdbool.h> #include <string.h> - +// ascci art: http://patorjk.com/software/taag/#p=testall&f=Cards&t=Fool%20OS +// void hello() { puts( - "Welcome to FoolShell v0.1" + + " ______ __ ____ _____\n" + " / ____/___ ____ / / / __ \\/ ___/\n" + " / /_ / __ \\/ __ \\/ / / / / /\\__ \\ \n" + " / __/ / /_/ / /_/ / / / /_/ /___/ / \n" + " /_/ \\____/\\____/_/ \\____//____/ \n" + "\n" + + + + + + + "Welcome to FoolShell v0.2 (Compiled on " __DATE__ " at " __TIME__ "\n" + "--------------------------------------------------------------------\n\n" + "type 'help' anytime to show shell built-ins\n" + "or execute programms/commands that are on your $PATH (e.g. ls)\n" ); } @@ -20,7 +38,13 @@ void prompt() int main(int argc, char **argv) { -// hello(); + bool silent=false; + for(int i=0;i<argc;i++) + { + if(!strcmp(argv[i],"--silent"))silent=true; + } + + if(!silent)hello(); char *buf=malloc(256); diff --git a/userspace/smalltest.c b/userspace/smalltest.c deleted file mode 100644 index 905869d..0000000 --- a/userspace/smalltest.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() -{ - return 0; -} diff --git a/video/console.c b/video/console.c index ae5d720..5b6e103 100644 --- a/video/console.c +++ b/video/console.c @@ -113,7 +113,7 @@ void scr_put_char(char ch,char col) if(ch=='\n')scr_nextline(); else if(posx<SCR_WIDTH) { - print_char_col(posx,posy,ch,SCR_WHITE); + print_char_col(posx,posy,ch,SCR_GREEN); posx++; } |
