diff options
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | asm/asm_start.s | 6 | ||||
| -rw-r--r-- | driver/vesa.c | 44 | ||||
| -rw-r--r-- | driver/vesa.h | 3 | ||||
| -rw-r--r-- | grubiso/boot/grub/grub.cfg | 27 | ||||
| -rw-r--r-- | kernel/kernel.c | 4 | ||||
| -rw-r--r-- | kernel/multiboot.c | 2 |
7 files changed, 70 insertions, 22 deletions
@@ -103,8 +103,8 @@ ASM_OBJECTS+=$(ASM_MULTIBOOT_OBJ2) #### BINARIES AND SUBMODULES ######## -FOOLOS_ISO=FoolOS.iso -FOOLOS_ISO_EFI=FoolOS-EFI.iso +FOOLOS_ISO=fool-os-i386.iso +FOOLOS_ISO_EFI=fool-os-i386-efi.iso KERNEL_IMG=foolos.img BIN_KERNEL=kernel.bin BIN_MBR=./boot1/mbr.bin @@ -233,7 +233,7 @@ $(FOOLOS_ISO): $(KERNEL_IMG) userspace @cp $(KERNEL_IMG) grubiso/boot/foolos.bin @cp $(IMG_USERSPACE) grubiso/boot @grub-mkrescue -d /usr/lib/grub/i386-efi -o $(FOOLOS_ISO_EFI) grubiso/ - @grub-mkrescue -d /usr/lib/grub/i386-pc -o $(FOOLOS_ISO) grubiso/ + @grub-mkrescue -d /usr/lib/grub/i386-pc -o $(FOOLOS_ISO) grubiso/ @echo "Finished ISO" @echo "------------------------" diff --git a/asm/asm_start.s b/asm/asm_start.s index 8f0cf1e..6ed43ca 100644 --- a/asm/asm_start.s +++ b/asm/asm_start.s @@ -42,10 +42,14 @@ call smp_start .long 0 # we override this from grub anyway +#.long 0 #gfx_stuff 0=enable! +#.long 640 +#.long 480 +#.long 32 .long 0 #gfx_stuff 0=enable! .long 640 .long 480 -.long 32 +.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/driver/vesa.c b/driver/vesa.c index c882595..ba87e6d 100644 --- a/driver/vesa.c +++ b/driver/vesa.c @@ -12,7 +12,7 @@ //#define FOOLSOS_SHOW_VESAMODES static foolfont *deffont; -static vbemodeinfo *VbeModeInfoBlock; +//static vbemodeinfo *VbeModeInfoBlock; static int console_x; static int console_y; @@ -26,6 +26,13 @@ static uint8_t* physbase; void PutConsoleNL(); void PutPixel(int x,int y, int color); +// we need to obtain this from somewhere else.. +static uint32_t vesaXres; +static uint32_t vesaYres; +static uint32_t vesaPitch; +static uint32_t vesaBpp; +static uint32_t vesaAddr; + //static char buf[80][24]; void vesa_update_cursor(uint32_t col,uint32_t row) @@ -96,12 +103,12 @@ void vesa_put_rect(int x, int y, int w , int h, int color) void vesa_clear_screen() { - vesa_put_rect(0,0,VbeModeInfoBlock->Xres, VbeModeInfoBlock->Yres, 0xffffff); + vesa_put_rect(0,0,vesaXres, vesaYres, 0xffffff); } void vesa_set_physbase(uint32_t addr) { - VbeModeInfoBlock->physbase=addr; + vesaAddr=addr; } // @@ -124,23 +131,31 @@ void vesa_set_physbase(uint32_t addr) // our video memory // -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) +uint32_t vesa_init(multiboot_information *inf, foolfont *rawfont) { +//inf->framebuffer_type + + vesaXres=inf->framebuffer_width; + vesaYres=inf->framebuffer_height; + vesaPitch=inf->framebuffer_pitch; + vesaBpp=inf->framebuffer_bpp; + vesaAddr=inf->framebuffer_addr; + //the only functionallu important init lines! (rest is log) - VbeModeInfoBlock=mode; + //VbeModeInfoBlock=mode; deffont=rawfont; console_x=0; console_y=0; int line_height=12; int col_width=10; - console_lines=mode->Yres/line_height; - console_cols=mode->Xres/col_width; + console_lines=vesaYres/line_height; + console_cols=vesaXres/col_width; //TODO dynamic (but need to sync with terminal!) console_cols=80; console_lines=24; - + /* // vesa info klog("vbe version: 0x%x / video mode ptr: 0x%x 0x%x", info->VbeVersion, info->VideoModePtr[1], info->VideoModePtr[0]); @@ -167,9 +182,10 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) modeptr++; } #endif +*/ - return VbeModeInfoBlock->physbase; + return vesaAddr; } @@ -177,9 +193,9 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) void PutPixel(int x,int y, int color) { //do not write memory outside the screen buffer, check parameters against the VBE mode info - if (x<0 || x>VbeModeInfoBlock->Xres|| y<0 || y>VbeModeInfoBlock->Yres) return; - if (x) x = (x*(VbeModeInfoBlock->bpp>>3)); // get bytes (divide by 8) - if (y) y = (y*VbeModeInfoBlock->pitch); + if (x<0 || x>vesaXres|| y<0 || y>vesaYres) return; + if (x) x = (x*(vesaBpp>>3)); // get bytes (divide by 8) + if (y) y = (y*vesaPitch); //uint8_t *cTemp=VbeModeInfoBlock->physbase; uint8_t *cTemp=VMEM_FRAMEBUFFER; @@ -300,12 +316,12 @@ static int boxy; void vesa_render() { vesa_clear_screen(); - vesa_put_rect(100,100,VbeModeInfoBlock->Xres-200,VbeModeInfoBlock->Yres-200,0xff); + vesa_put_rect(100,100,vesaXres-200,vesaYres-200,0xff); vesa_put_rect(boxx-10,boxy-10,20,20,0x999999); boxx++; // boxy+=boxx; - if(boxx>VbeModeInfoBlock->Xres-100)boxx=100; + if(boxx>vesaXres-100)boxx=100; // if(boxy>VbeModeInfoBlock->Yres-200)boxy=200; vesa_switch_buffers(); diff --git a/driver/vesa.h b/driver/vesa.h index 168013f..f98e612 100644 --- a/driver/vesa.h +++ b/driver/vesa.h @@ -1,5 +1,6 @@ #include <stdint.h> #include "lib/printf/printf.h" +#include "multiboot.h" void vesa_update_cursor(uint32_t col,uint32_t row); void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y); @@ -45,7 +46,7 @@ typedef struct ModeInfoBlock { uint16_t reserved2; }vbemodeinfo; -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont); +uint32_t vesa_init(multiboot_information *info,foolfont *); void PutConsoleChar(char c, int color); void PutConsole(char *str, int color); diff --git a/grubiso/boot/grub/grub.cfg b/grubiso/boot/grub/grub.cfg index 9c78bfb..b9fa2ac 100644 --- a/grubiso/boot/grub/grub.cfg +++ b/grubiso/boot/grub/grub.cfg @@ -1,5 +1,21 @@ set timeout=1 //seconds +if loadfont ${prefix}/fonts/unicode.pf2 + +insmod efi_gop +insmod efi_uga +insmod vbe +insmod font + + +then + insmod gfxterm + #set gfxmode=auto + set gfxmode=640x480 + set gfxpayload=keep + terminal_output gfxterm +fi + menuentry "FoolOS (640x480x32)" { multiboot /boot/foolos.bin set gfxpayload=640x480x32 @@ -24,6 +40,17 @@ menuentry "FoolOS (2560x1600x32)" { module /boot/ext2.img } +menuentry "FoolOS (no gfxpayload)" { + multiboot /boot/foolos.bin + module /boot/ext2.img +} + +menuentry "FoolOS (gfxpayload=keep)" { + multiboot /boot/foolos.bin + set gfxpayload=keep + module /boot/ext2.img +} + menuentry "FoolOS (Custom Resolution)" { set pager=1 echo "MODES SUPPORTED:" diff --git a/kernel/kernel.c b/kernel/kernel.c index ab4332a..6bda4bf 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -63,7 +63,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) // -- GET CONFIGS -- // klog("Read Multiboot Structures ..."); multiboot_information *cfg_multiboot; - cfg_multiboot=multiboot_read(eax, ebx,true); // true-silent + cfg_multiboot=multiboot_read(eax, ebx,false); // true-silent // elf_multiboot_read(cfg_multiboot); // just show kernel section headers klog("Read Advanced Power Configuration Interface (ACPI) Structures ..."); @@ -117,7 +117,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) fixme("support binfonts spanning multiple blocks?"); uint32_t inode= ext2_filename_to_inode(VMEM_EXT2_RAMIMAGE,VESA_FONT_PATH); uint32_t addr= ext2_inode_blockstart( VMEM_EXT2_RAMIMAGE,inode,0); - vesa_init(cfg_multiboot->vbe_control_info,cfg_multiboot->vbe_mode_info,addr); + vesa_init(cfg_multiboot,addr); // -- STD STREAMS -- // fd_init_std_streams(0,cfg_multiboot->framebuffer_type!=2); diff --git a/kernel/multiboot.c b/kernel/multiboot.c index ce97c0a..dccd3ce 100644 --- a/kernel/multiboot.c +++ b/kernel/multiboot.c @@ -79,7 +79,7 @@ multiboot_information* multiboot_read(uint32_t eax, uint32_t ebx, bool silent) if(info->flags&&1<<12) { - klog("[12] Framebuffer (type=%d) (w:%d h:%d bpp:%d) at addr=0x%08X",info->framebuffer_type,info->framebuffer_width,info->framebuffer_height,info->framebuffer_bpp,info->framebuffer_addr); + klog("[12] Framebuffer (type=%d) (w:%d h:%d bpp:%d) (pitch: %d) at addr=0x%08X",info->framebuffer_type,info->framebuffer_width,info->framebuffer_height,info->framebuffer_bpp,info->framebuffer_pitch,info->framebuffer_addr); } return info; |
