summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2015-05-14 10:42:15 +0200
committerMichal Idziorek <m.i@gmx.at>2015-05-14 10:42:15 +0200
commit7df4060ae807dd27f3ae0a11f243897f36053ba1 (patch)
treecb06f018a60fe373e13b03d552fe27a5c42c134d /kernel
parentb74c5c8fb4de3b2847bc942e57dcf8f0dea705be (diff)
experimenting with grub vbe
Diffstat (limited to 'kernel')
-rw-r--r--kernel/config.h2
-rw-r--r--kernel/console.c13
-rw-r--r--kernel/console.h2
-rw-r--r--kernel/kernel.c34
-rw-r--r--kernel/kernel.h2
-rw-r--r--kernel/multiboot.h1
-rw-r--r--kernel/syscalls.c6
7 files changed, 41 insertions, 19 deletions
diff --git a/kernel/config.h b/kernel/config.h
index 2e2a169..8329457 100644
--- a/kernel/config.h
+++ b/kernel/config.h
@@ -8,7 +8,7 @@
#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_LOG_OFF // do not log anything
#define FOOLOS_CONSOLE // otherwise VESA will be used!
#define FOOLSOS_SHOW_VESAMODES
#define MEM_PRINT_MEMORYMAP
diff --git a/kernel/console.c b/kernel/console.c
index 9db1c0b..c33c205 100644
--- a/kernel/console.c
+++ b/kernel/console.c
@@ -13,11 +13,9 @@
#include "video/console.h"
-uint32_t console_init(){
+uint32_t console_init(uint32_t mode, uint32_t control){
scr_clear();
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"init console");
-//int inode_nr=ext2_filename_to_inode(EXT2_RAM_ADDRESS,"/binfont.bin");
- // if(inode_nr!=-1)ext2_inode_content(EXT2_RAM_ADDRESS,inode_nr,0x8000000,0xffff); // load font;
return 0;
}
void console_del_char(){scr_backspace();}
@@ -34,11 +32,12 @@ void console_put_str_red(char *s){scr_put_string(s,SCR_RED);}
#include "video/vesa.h"
-uint32_t console_init(){
+uint32_t console_init(uint32_t mode, uint32_t control){
int inode_nr=ext2_filename_to_inode(EXT2_RAM_ADDRESS,"/binfont.bin");
- if(inode_nr!=-1)ext2_inode_content(EXT2_RAM_ADDRESS,inode_nr,0x1300000,0xffff); // load font;
- uint32_t vesa_physbase=vesa_init(0xb000,0xc000,0x1300000);
+ ext2_inode_content(EXT2_RAM_ADDRESS,inode_nr,0x700000,0xffff); // load font;
+ //uint32_t vesa_physbase=vesa_init(0xb000,0xc000,0x700000);
+ uint32_t vesa_physbase=vesa_init(mode,control,0x700000);
return vesa_physbase;
}
@@ -55,3 +54,5 @@ void console_put_str_green(char *s){PutConsole(s,0xffffff);}
void console_put_str_red(char *s){PutConsole(s,0xffffff);}
#endif
+
+
diff --git a/kernel/console.h b/kernel/console.h
index e68a3b7..3da996c 100644
--- a/kernel/console.h
+++ b/kernel/console.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-uint32_t console_init();
+uint32_t console_init(uint32_t mode, uint32_t control);
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 97847e6..657b69a 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -4,6 +4,8 @@
#error "Watchout! this is not Linux but FoolOS. Use a cross-compiler"
#endif
+#include "kernel.h"
+
#include <stdint.h>
#include "config.h"
#include "types.h"
@@ -22,11 +24,16 @@
// for built-in shell
#include "lib/buffer/ringbuffer.h"
#include "task.h"
-
+#include "video/vesa.h"
void kernel_main(uint32_t eax,uint32_t ebx)
{
-
+ //
+ // PR
+ //
+
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s",KERNEL_VERSION);
+
//
// Configuring the PIT timer.
//
@@ -59,7 +66,6 @@ void kernel_main(uint32_t eax,uint32_t ebx)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"cmdline: \"%s\"",info->cmdline);
}
-
//
// Memory Init
//
@@ -96,21 +102,39 @@ void kernel_main(uint32_t eax,uint32_t ebx)
mod++;
}
}
+
+ //
+ // Video
+ //
+
+ 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
+ */
//
// init output to screen
//
- uint32_t physbase=console_init();
+
+ uint32_t physbase=console_init(info->vbe_mode_info,info->vbe_control_info);
//
// Activate Virtual Memory (paging)
+ //
pdirectory *dir=vmem_init(physbase);
// log buffered messages to console
log_log();
+ while(1);
//
// Setup Interrupts (code segment: 0x08)
@@ -152,8 +176,6 @@ void kernel_main(uint32_t eax,uint32_t ebx)
//
task_init(dir); //; this will never return!
//
- while(1);
- //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,".");
}
diff --git a/kernel/kernel.h b/kernel/kernel.h
index d5b5a0f..59e3d4c 100644
--- a/kernel/kernel.h
+++ b/kernel/kernel.h
@@ -1,7 +1,7 @@
#ifndef FOOLOS_KERNEL_H
#define FOOLOS_KERNEL_H
-#define KERNEL_VERSION "FoolOs 0.1.1"
+#define KERNEL_VERSION "FoolOs 0.2.1"
#endif
diff --git a/kernel/multiboot.h b/kernel/multiboot.h
index c82d7e2..292b6f3 100644
--- a/kernel/multiboot.h
+++ b/kernel/multiboot.h
@@ -51,4 +51,5 @@ typedef struct multiboot_mod_struct
}multiboot_mod;
+
#endif
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
index 38f7161..9671469 100644
--- a/kernel/syscalls.c
+++ b/kernel/syscalls.c
@@ -10,7 +10,6 @@
#include <stdbool.h>
#include <stddef.h>
-
int syscall_unhandled(int nr)
{
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"syscall: %d", nr);
@@ -29,7 +28,6 @@ int syscall_lseek(int file,int ptr,int dir)
}
-
// TODO: /dev/console or /dev/tty1 - /dev/ttyN
int syscall_write(int file, char *buf, int len)
{
@@ -150,6 +148,7 @@ int copy_args(char **in, char **out)
return count;
}
+
int syscall_execve(char *name, char **argv1, char **env1)
{
#ifdef LOG_SYSCALLS
@@ -158,7 +157,6 @@ int syscall_execve(char *name, char **argv1, char **env1)
uint32_t alloc;
uint32_t entry_global=load_elf(name,&alloc);
-
task_set_brk(alloc);
if(!entry_global)
@@ -188,13 +186,13 @@ int syscall_execve(char *name, char **argv1, char **env1)
// this is never reached!
}
+
int syscall_open(char *name, int flags, int mode)
{
#ifdef LOG_SYSCALLS
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"open (name=0x%08X(\"%s\"), flags=%d, mode=%d)",name, name,flags,mode);
#endif
panic(FOOLOS_MODULE_NAME,"unhandled syscall: open");
-
}