summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-31 13:15:41 +0200
committerMiguel <m.i@gmx.at>2018-08-31 13:15:41 +0200
commit418a23ebe1af6974e3f1446896ae09b184a9e2a2 (patch)
tree8e6fe0cca1b93516daf056cabc83c2840323b565
parent331ed2b6273c79e0eaa236c4615205823608dc6b (diff)
override video mode from grub
-rw-r--r--README.md60
-rw-r--r--grubiso/boot/grub/grub.cfg40
-rw-r--r--kernel/interrupts.c42
3 files changed, 82 insertions, 60 deletions
diff --git a/README.md b/README.md
index 44d1fc4..ac25532 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,6 @@ NEWLIB
https://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
https://ftp.gnu.org/gnu/automake/automake-1.11.6.tar.gz
-
Usage
-----
Use the FoolOS.iso in your favourite emulator or `dd` to an usb stick
@@ -46,6 +45,7 @@ and test on real hardware.
Supported Platforms
-------------------
+TODO: update/recheck
FoolOS is tested/developed on the following emulators/machines
@@ -60,13 +60,12 @@ FoolOS is tested/developed on the following emulators/machines
Features
--------
-We have (or had) 32-bit protected mode, interrupt handling,
-memory management, scheduling, a floppy disk controller, mouse
-
-as well as VESA and a couple of other things. networking is a big goal.
-Please note that all features are only very rudimentary and buggy.
-Some might have been disable (temporarily) due to conflicts or regressions.
+Please note that all features are only very rudimentary and mostly buggy.
+* Booting with Multiboot (grub)
+* 32-bit protected mode
+* Interrupt handling
+* Task scheduling
* ELF binaries
* PIT support / Timing
* PIC support & Interrupt handling framework
@@ -77,45 +76,32 @@ Some might have been disable (temporarily) due to conflicts or regressions.
* Spinlocks
* Simple Shell
* Simple Ext2 driver (read-only)
-
-Fetures are under this line are currently disabled / not developed:
-
-* Bootloader (2 stages)
-* VESA Support
* PS2 Mouse driver
-* Floppy disk driver
* ACPI / MP
* Symmetric Multiprocessing
* PCI bus scanning
+* Kernel and Userspace Tasks (ring 0/ring 3)
+
+Discontinued Features
+---------------------
+
+* Floppy Disk Driver
+* Custom Bootloader (2 stages)
Todos
-----
-* check 16bit stack alignment before all calls from asm
-* put boot code for application processors in kernel image
+* Check 16bit stack alignment before ALL calls from assembler!
+* Ethernet driver E1000 / NS2000 & Networking stack
* Porting (ncurses, gcc, binutils, vim, apache...)
-* Support some TTY standard (xterm)
-
-* /dev/console
-* /dev/kb
-
-* E1000 driver (or some other easy network card driver) maybe NS2000 better?
-* Networking stack
-
-* GUI
-
-Issues
-------
-
- sbrk()
- ESP collisions!?
- TSS-ESP0?
- kbfree()
- pg_directory alloc
- implement posix(?) getdents instead of our own readdir.
- Turning on some gcc optimizations breaks the kernel. (need debug so go for ELF!)
- Assumed support for VESA mode 0x114 with linear addressing. (let the user select)
- fixed size of process images!
+* Check VESA mode and adapt console (text/gui)
+
+* sbrk()
+* ESP collisions / TSS-ESP0
+* kbfree() and real pgdirectory alloc
+* implement posix(?) getdents instead of our own readdir.
+* Turning on some gcc optimizations breaks the kernel?
+* Writing to files (at least in ext2 ram image)
REFERENCES
==========
diff --git a/grubiso/boot/grub/grub.cfg b/grubiso/boot/grub/grub.cfg
index 34d55c3..376cec9 100644
--- a/grubiso/boot/grub/grub.cfg
+++ b/grubiso/boot/grub/grub.cfg
@@ -1,9 +1,47 @@
set timeout=0
-menuentry "FoolOS" {
+menuentry "FoolOS 640x480x32" {
echo "------------------------"
echo "Loading FoolOS Kernel..."
multiboot /boot/foolos.bin
+ set gfxpayload=640x480x32
+ echo "Loading Ram Disk..."
+ module /boot/ext2.img
+ echo "Starting Fool OS..."
+ echo "------------------------"
+}
+
+menuentry "FoolOS 1920x1080x32" {
+ echo "------------------------"
+ echo "Loading FoolOS Kernel..."
+ multiboot /boot/foolos.bin
+ set gfxpayload=1920x1080x32
+ echo "Loading Ram Disk..."
+ module /boot/ext2.img
+ echo "Starting Fool OS..."
+ echo "------------------------"
+}
+
+menuentry "FoolOS CUSTOM" {
+ set pager=1
+ echo "MODES SUPPORTED BY YOUR COMPUTER"
+ vbeinfo
+ set pager=0
+ echo "BOOT WITH CUSTOM RESOLUTION"
+ echo "width:"
+ read __width
+ echo "...OK"
+ echo "height:"
+ read __height
+ echo "...OK"
+ echo "bits per pixel:"
+ read __bpp
+ echo "...OK"
+ echo "booting with ${__width}x${__height}x${__bpp} ..."
+ echo "------------------------"
+ echo "Loading FoolOS Kernel..."
+ multiboot /boot/foolos.bin
+ set gfxpayload=${__width}x${__height}x${__bpp}
echo "Loading Ram Disk..."
module /boot/ext2.img
echo "Starting Fool OS..."
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 74377ad..6e7e2ff 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -8,10 +8,28 @@
#define INT_MAX 255 // size of our interrupts table
+// the interrupt descriptor table
+static struct int_desc
+{
+ uint16_t addrLo;
+ uint16_t sel;
+ uint8_t zeros;
+ uint8_t flags;
+ uint16_t addrHi;
+
+} idt[INT_MAX];
+
+// interrupt descriptor table descriptor
+static struct idt_desc
+{
+ uint16_t size;
+ uint16_t baseLo;
+ uint16_t baseHi;
+} idtd;
uint32_t interrupt_handler(uint32_t num, uint32_t esp)
{
- if(num!=990)klog("int: %d %d",num,esp);
+ if(num!=0)klog("int: %d %d",num,esp);
return esp;
}
@@ -28,27 +46,7 @@ void defklog(uint32_t eip, uint16_t cs, uint32_t flags)
}
void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr);
-//void mouse_handler();
-// the interrupt descriptor table
-static struct int_desc
-{
- uint16_t addrLo;
- uint16_t sel;
- uint8_t zeros;
- uint8_t flags;
- uint16_t addrHi;
-
-} idt[INT_MAX];
-
-// interrupt descriptor table descriptor
-static struct idt_desc
-{
- uint16_t size;
- uint16_t baseLo;
- uint16_t baseHi;
-
-} idtd;
void exception_handle()
{
@@ -169,7 +167,7 @@ void interrupts_init(uint16_t sel)
//mouse interrupt handler (irq 12 => 34)
int_install_ir(44, 0b10001110, 0x08,&int12);
- //system calls (can be called from ring3 (0b11))
+ //our system calls (can be called from ring3 (0b11))
int_install_ir(0x80, 0b11101110, 0x08,&int128);
int_install();