summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile29
-rw-r--r--asm/NOTES2
-rw-r--r--asm/multiboot.s12
-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
10 files changed, 65 insertions, 38 deletions
diff --git a/Makefile b/Makefile
index 8d8b957..7b5018f 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,9 @@
#####################
-
# main phony targets
-.PHONY: all new run newrun stick clean tags
-
+.PHONY: all new run newrun stick clean tags mount umount
############ some constants ############
@@ -139,21 +137,15 @@ $(FOOLOS): $(KERNEL_IMG) $(SUBDIRS)
sudo cp $(IMG_USERSPACE) /mnt/vdi/boot
sync
-# dd if=$(BIN_MBR) of=$@ bs=512 seek=0 conv=notrunc
-# dd if=$(BIN_STAGE2) of=$@ bs=512 seek=1 conv=notrunc
-# # kernel will start at 0x100000 in ram (this is what the booloader starts loading secotr: 10)
-# dd if=$(BIN_KERNEL) of=$@ bs=512 seek=10 conv=notrunc # kernel can be about 128KB (incl bss)
-# # the data will starts at 0x120000 in ram
-# dd if=$(IMG_USERSPACE) of=$@ bs=512 seek=266 conv=notrunc
############ virtual machines stuff ############
# vdi image for VirtualBox
-$(FOOLOS_VDI): $(FOOLOS)
+$(FOOLOS_VDI): disk.img
-rm FoolOS.vdi
#VBoxManage convertfromraw $< $@ --uuid 2f11ca11-c35d-4240-b77e-79e37d32616c
- VBoxManage convertfromraw ~/temp/FoolOs/disk.img $@ --uuid 2f11ca11-c35d-4240-b77e-79e37d32616c
+ VBoxManage convertfromraw disk.img $@ --uuid 2f11ca11-c35d-4240-b77e-79e37d32616c
# run in our local bochs (we need cirrus support for our vesa mode)
run-bochs: all
@@ -165,7 +157,7 @@ run-qemu: all
run-qemu-debug: all
# qemu -enable-kvm -s -S ~/temp/FoolOs/disk.img
- qemu -enable-kvm -s ~/temp/FoolOs/disk.img
+ qemu -enable-kvm -s disk.img
############ create bootable usb image ############
@@ -182,3 +174,16 @@ clean: $(CLEANDIRS)
tags:
ctags --recurse=yes .
+############ mounting #############
+
+mount: disk.img
+ echo "* mounting disk image"
+ sudo losetup /dev/loop1 $< -o 1048576
+ sudo mount /dev/loop1 /mnt/vdi
+
+umount:
+ echo "* unmounting disk image"
+ sudo umount /mnt/vdi
+ sudo losetup -d /dev/loop1
+
+
diff --git a/asm/NOTES b/asm/NOTES
index 23e7ebf..d5df67a 100644
--- a/asm/NOTES
+++ b/asm/NOTES
@@ -1,2 +1,2 @@
files in this directory should not depend on any other files.
-Also this is not supported by the build-system by now.
+This is not supported by the build-system by now.
diff --git a/asm/multiboot.s b/asm/multiboot.s
index 21df7bb..1927c9b 100644
--- a/asm/multiboot.s
+++ b/asm/multiboot.s
@@ -5,7 +5,7 @@
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
.set GFXINFO, 1<<2 # provide gfx info
-.set FLAGS, ALIGN | MEMINFO # | GFXINFO # this is the Multiboot 'flag' field
+.set FLAGS, ALIGN | MEMINFO | GFXINFO # this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot
@@ -20,16 +20,16 @@
.long FLAGS
.long CHECKSUM
-.long 0 # we dont need this
+.long 0 # we dont need this for ELF
.long 0
.long 0
.long 0
.long 0
-.long 0 #gfx_stuff
-.long 0
-.long 0
-.long 0
+.long 1 #gfx_stuff
+.long 800
+.long 600
+.long 24
# Currently the stack pointer register (esp) points at anything and using it may
# cause massive harm. Instead, we'll provide our own stack. We will allocate
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");
-
}