diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-14 20:24:21 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-14 20:24:21 +0200 |
| commit | fb8a5f18835e8811dd1a98b8eb5352151fc2df31 (patch) | |
| tree | ccc6d426c8d342374fbad1e3243449a8de278770 /kernel | |
| parent | ce3968aa4a941e272171f8fcd389c4909a7a23a5 (diff) | |
little improvements and setting py file for completer
Diffstat (limited to 'kernel')
| -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 |
5 files changed, 12 insertions, 90 deletions
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); |
