diff options
| -rw-r--r-- | .ycm_extra_conf.py | 67 | ||||
| -rw-r--r-- | Makefile | 7 | ||||
| -rw-r--r-- | kernel/console.c | 4 | ||||
| -rw-r--r-- | kernel/console.h | 2 | ||||
| -rw-r--r-- | kernel/kernel.c | 34 | ||||
| -rw-r--r-- | kernel/multiboot.c | 1 | ||||
| -rw-r--r-- | kernel/vmem.c | 61 | ||||
| -rw-r--r-- | userspace/sys/libfool.a | bin | 7420 -> 35776 bytes | |||
| -rw-r--r-- | userspace/sys/sys.o | bin | 3744 -> 17956 bytes | |||
| -rw-r--r-- | userspace/sys/syscalls.o | bin | 2948 -> 17092 bytes |
10 files changed, 33 insertions, 143 deletions
diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index d4c475d..dffda83 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -3,61 +3,37 @@ import os import ycm_core -# These are the compilation flags that will be used in case there's no -# compilation database set (by default, one is not set). -# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. flags = [ '-Wall', '-Wextra', '-Werror', '-fexceptions', '-DNDEBUG', -# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which -# language to use when compiling headers. So it will guess. Badly. So C++ -# headers will be compiled as C headers. You don't want that so ALWAYS specify -# a "-std=<something>". -# For a C project, you would set this to something like 'c99' instead of -# 'c++11'. -'-std=c++11', -# ...and the same thing goes for the magic -x option which specifies the -# language that the files to be compiled are written in. This is mostly -# relevant for c++ headers. -# For a C project, you would set this to 'c' instead of 'c++'. + +'-std=c99' '-x', -'c++', -'-isystem', -'/usr/include', -'-isystem', -'/usr/local/include', -'-isystem', -'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1', +'c', + '-isystem', -'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include', -] +'/home/miguel/_int/dev/FoolOs/', +'-isystem', +'/home/miguel/_int/dev/FoolOs/kernel/include', -# Set this to the absolute path to the folder (NOT the file!) containing the -# compile_commands.json file to use that instead of 'flags'. See here for -# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html -# -# Most projects will NOT need to set this to anything; you can just change the -# 'flags' list of compilation flags. -compilation_database_folder = '' +] -if os.path.exists( compilation_database_folder ): - database = ycm_core.CompilationDatabase( compilation_database_folder ) -else: - database = None +database = None SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] def DirectoryOfThisScript(): return os.path.dirname( os.path.abspath( __file__ ) ) - def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): + if not working_directory: return list( flags ) + new_flags = [] make_next_absolute = False path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] @@ -88,7 +64,6 @@ def IsHeaderFile( filename ): extension = os.path.splitext( filename )[ 1 ] return extension in [ '.h', '.hxx', '.hpp', '.hh' ] - def GetCompilationInfoForFile( filename ): # The compilation_commands.json file generated by CMake does not have entries # for header files. So we do our best by asking the db for flags for a @@ -110,22 +85,12 @@ def GetCompilationInfoForFile( filename ): # This is the entry point; this function is called by ycmd to produce flags for # a file. def FlagsForFile( filename, **kwargs ): - if database: - # Bear in mind that compilation_info.compiler_flags_ does NOT return a - # python list, but a "list-like" StringVec object - compilation_info = GetCompilationInfoForFile( filename ) - if not compilation_info: - return None - - final_flags = MakeRelativePathsInFlagsAbsolute( - compilation_info.compiler_flags_, - compilation_info.compiler_working_dir_ ) - else: + relative_to = DirectoryOfThisScript() final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) - return { - 'flags': final_flags, - 'do_cache': True - } + return { + 'flags': final_flags, + 'do_cache': True + } @@ -156,9 +156,12 @@ run-bochs: all run-qemu: all qemu -enable-kvm $(FOOLOS) -run-qemu-debug: all +run-qemu-debug: all # qemu -enable-kvm -s -S ~/temp/FoolOs/disk.img - qemu -enable-kvm -s disk.img + qemu -enable-kvm -s disk.img + +stop: + killall qemu ############ create bootable usb image ############ diff --git a/kernel/console.c b/kernel/console.c index 2244345..c46737e 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -7,15 +7,15 @@ #include "lib/logger/log.h" #include "fs/ext2.h" + #define FOOLOS_MODULE_NAME "console" #ifdef FOOLOS_CONSOLE #include "video/console.h" -uint32_t console_init(uint32_t mode, uint32_t control){ +uint32_t console_init(){ scr_clear(); - //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"init console"); return 0; } void console_del_char(){scr_backspace();} diff --git a/kernel/console.h b/kernel/console.h index 3da996c..e68a3b7 100644 --- a/kernel/console.h +++ b/kernel/console.h @@ -3,7 +3,7 @@ #include <stdint.h> -uint32_t console_init(uint32_t mode, uint32_t control); +uint32_t console_init(); void console_put_char_white(char); void console_put_char_red(char); void console_put_char_green(char); diff --git a/kernel/kernel.c b/kernel/kernel.c index 224f98b..486ec19 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -4,6 +4,7 @@ #error "Watchout! this is not Linux but FoolOS. Use a cross-compiler" #endif + #include "kernel.h" #include <stdint.h> @@ -17,6 +18,7 @@ #include "interrupts.h" #include "multiboot.h" + #include "console.h" #include <stddef.h> @@ -32,25 +34,21 @@ void kernel_main(uint32_t eax,uint32_t ebx) // // Init Console // - - uint32_t physbase=console_init(0,0); + console_init(); // // PR // - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",KERNEL_VERSION,__DATE__,__TIME__); // // Configuring the PIT timer. // - timer_init(); // // Process Multiboot Header // - multiboot_information *info=get_multiboot(eax, ebx); // @@ -59,32 +57,12 @@ void kernel_main(uint32_t eax,uint32_t ebx) // after this is set up we will be able to allocate and deallocate // blocks of physical memory :) // - // we know that here, the bootloader placed the memory map and - // its length - // - mem_init(info); //info->mmap_addr,info->mmap_length); - - // - // Video TODO - // - - /* - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"VBE Info: 0x%04X (0x%08X 0x%08X)",info->vbe_mode,info->vbe_control_info, info->vbe_mode_info); - vbeinfo *vbe=info->vbe_mode_info; - //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%c%c",'X',vbe->VbeSignature[0]); - uint16_t VbeVersion; // == 0x0300 for VBE 3.0 - uint16_t OemStringPtr[2]; // isa vbeFarPtr - uint8_t Capabilities[4]; - uint16_t VideoModePtr[2]; // isa vbeFarPtr - uint16_t TotalMemory; // as # of 64KB blocks - */ - + mem_init(info); // // Activate Virtual Memory (paging) // - pdirectory *dir=vmem_init(physbase); - + pdirectory *dir=vmem_init(0); // @@ -93,8 +71,6 @@ void kernel_main(uint32_t eax,uint32_t ebx) int_init(0x08); - while(1); - // // Scan the PCI Bus diff --git a/kernel/multiboot.c b/kernel/multiboot.c index c294ee2..4272f0f 100644 --- a/kernel/multiboot.c +++ b/kernel/multiboot.c @@ -1,4 +1,3 @@ - #define FOOLOS_MODULE_NAME "multiboot" #include "multiboot.h" #include "lib/logger/log.h" diff --git a/kernel/vmem.c b/kernel/vmem.c index ffd39c8..402580a 100644 --- a/kernel/vmem.c +++ b/kernel/vmem.c @@ -9,8 +9,6 @@ #include "lib/logger/log.h" // logger facilities #define FOOLOS_MODULE_NAME "vmem" -static uint32_t phys; - // TODO : why is the frame not 0xfffff?? enum PAGE_PTE_FLAGS { @@ -226,8 +224,9 @@ void vmem_free_dir(pdirectory *dir) x86_paging_enable(); } -// vmem init and also copies all the shit for FORK -// for now it allocates always 3 * 1024 * 4096 bytes at for the kernel +// +// vmem init and also copies all the shit for FORK +// for now it allocates always 3 * 1024 * 4096 bytes at for the kernel // virtual / physical 0x0-0xc00000 (~12MB) // 2*1024*4096 for the loaded prog // virtual 0x8000000-0x8800000 (~8MB) @@ -293,57 +292,6 @@ pdirectory* vmem_new_space_dir(pdirectory *copy_dir) virt_addr+=1024*4096; } - if(phys!=0) - { - phys_addr=phys; - virt_addr=phys; - // vesa - for(int j=0;j<5;j++) - { - - // this is the table for our page directory. It maps 1024*4096 bytes - ptable* table; - - // create new tables on init - if(copy_dir==NULL) - { - // alloc space for our new table - table = (ptable*) pmmngr_alloc_block (); - if (!table)panic(FOOLOS_MODULE_NAME,"unable to alloc table"); - - //! idenitity mapping - for (int i=0, frame=phys_addr, virt=virt_addr; i<1024; i++, frame+=4096, virt+=4096) - { - //! create a new page - pt_entry page=0; - pt_entry_add_attrib (&page, I86_PTE_PRESENT); - pt_entry_add_attrib (&page, I86_PTE_WRITABLE); - pt_entry_set_frame (&page, frame); - - //! ...and add it to the page table - table->m_entries [PAGE_TABLE_INDEX (virt) ] = page; - } - - pd_entry* entry = &dir->m_entries [PAGE_DIRECTORY_INDEX (virt_addr) ]; - *entry=0; - pd_entry_add_attrib (entry, I86_PDE_PRESENT); - pd_entry_add_attrib (entry, I86_PDE_WRITABLE); - pd_entry_set_frame (entry, (physical_addr)table); - - } - // otherwise simply take existing stuff from pdir 0 - else - { - dir->m_entries[PAGE_DIRECTORY_INDEX(virt_addr)]= - copy_dir->m_entries[PAGE_DIRECTORY_INDEX(virt_addr)]; - - } - - phys_addr+=1024*4096; - virt_addr+=1024*4096; - } - } - // programm space virt_addr=0x8000000; for(int j=0;j<2;j++) @@ -471,9 +419,8 @@ void vmem_set_dir(pdirectory *dir) -pdirectory* vmem_init(uint32_t physbase) +pdirectory* vmem_init(uint32_t mem_block_start) { - phys=physbase; log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"init paging"); pdirectory *dir=vmem_new_space_dir(0); vmem_set_dir(dir); diff --git a/userspace/sys/libfool.a b/userspace/sys/libfool.a Binary files differindex 31fee46..7c47ee4 100644 --- a/userspace/sys/libfool.a +++ b/userspace/sys/libfool.a diff --git a/userspace/sys/sys.o b/userspace/sys/sys.o Binary files differindex 14413b2..d04089e 100644 --- a/userspace/sys/sys.o +++ b/userspace/sys/sys.o diff --git a/userspace/sys/syscalls.o b/userspace/sys/syscalls.o Binary files differindex 371b8af..2176036 100644 --- a/userspace/sys/syscalls.o +++ b/userspace/sys/syscalls.o |
