diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2015-02-11 21:42:22 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2015-02-11 21:42:22 -0500 |
| commit | b39f7a0657b8147d6a58a0222a61bfb0f9e2b061 (patch) | |
| tree | fd4b6d1f12d32a20e021a142d92bc3766afa5f99 | |
| parent | a03f4e798eba196b614024f814e6db7f6795c2f8 (diff) | |
| download | kappa-b39f7a0657b8147d6a58a0222a61bfb0f9e2b061.zip kappa-b39f7a0657b8147d6a58a0222a61bfb0f9e2b061.tar.gz kappa-b39f7a0657b8147d6a58a0222a61bfb0f9e2b061.tar.bz2 kappa-b39f7a0657b8147d6a58a0222a61bfb0f9e2b061.tar.xz | |
Stuff
| -rw-r--r-- | bochs.cfg | 2 | ||||
| -rw-r--r-- | boot/head.S | 5 | ||||
| -rw-r--r-- | drivers/gfx.c | 39 | ||||
| -rw-r--r-- | kernel/main.c | 13 | ||||
| -rw-r--r-- | kernel/timer.c | 1 |
5 files changed, 42 insertions, 18 deletions
@@ -1,7 +1,7 @@ # configuration file generated by Bochs plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, iodebug=1 config_interface: textconfig -display_library: x, options="gui_debug" +display_library: x memory: host=32, guest=32 romimage: file="/usr/share/bochs/BIOS-bochs-latest" vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest" diff --git a/boot/head.S b/boot/head.S index 8bd42f1..b74e929 100644 --- a/boot/head.S +++ b/boot/head.S @@ -24,19 +24,18 @@ multiboot_header: .section .stack stack_bottom: # Stack grows up in addresses, so bottom is # lower in memory than the top - .skip 16384 # 16KB stack + .skip 32768 # 32KB stack stack_top: .section .text .global _start - .type _start, @function _start: cli movl $stack_top, %esp push %eax # multiboot magic push %ebx # multiboot header call main +.Lhang: # Idle cli hlt -.Lhang: # Idle jmp .Lhang diff --git a/drivers/gfx.c b/drivers/gfx.c index b6bcae3..0ccb3b2 100644 --- a/drivers/gfx.c +++ b/drivers/gfx.c @@ -24,7 +24,9 @@ const uint16_t *gfx_height = &fb_height; static int cursor_x, cursor_y; uint32_t _gfx_fgcol, _gfx_bgcol; -void (*gfx_clear)(void); +extern void gfx_clear_packed(void); + +void (*gfx_clear)(void) = &gfx_clear_packed; void gfx_set_background(uint32_t col) { @@ -65,6 +67,23 @@ void gfx_clear(uint32_t col) } */ +void gfx_clear_unpacked(void) +{ + uint8_t *fb = framebuffer; + const uint32_t bg = _gfx_bgcol; + + const uint16_t padding = fb_stride - (fb_bpp * fb_width); + + for(int y = 0; y < fb_height; ++y) + { + for(int x = 0; x < fb_width; ++x) + { + *(uint32_t*)fb++ = bg; + } + fb += padding; + } +} + void gfx_reset(void) { _gfx_fgcol = VGA_RGBPACK(0xff, 0xff, 0xff); @@ -265,19 +284,19 @@ bool gfx_init(struct vbe_info_t *vbe_mode_info) return false; } - void gfx_clear_packed(void); - - gfx_clear = &gfx_clear_packed; + if(fb_stride != fb_bpp * fb_width) + { + printf("Pitch != stride * BPP, fill performance might be suboptimal!\n"); + gfx_clear = &gfx_clear_unpacked; + } + else + { + gfx_clear = &gfx_clear_packed; + } gfx_reset(); set_putchar(gfx_putchar); set_puts(gfx_puts); - printf("stride: %d\ncalcstride: %d\n", fb_stride, fb_bpp * fb_width); - if(fb_stride != fb_bpp * fb_width) - { - printf("WARNING: no fill support for stride != BPP * width yet: fills might not work!\n"); - } - return true; } diff --git a/kernel/main.c b/kernel/main.c index f0cc0d8..b5cc193 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -16,6 +16,7 @@ #include "fpu.h" #include "timer.h" #include "tty.h" +#include "version.h" void gpf(struct regs_t *regs) { @@ -29,7 +30,9 @@ void gpf(struct regs_t *regs) void main(struct multiboot_info_t *hdr, uint32_t magic) { fpu_enable(); + asm("movq %xmm0, %xmm0"); + /* this should go to port e9, which is the Bochs debug port */ printf("Testing early I/O\n"); @@ -66,9 +69,13 @@ void main(struct multiboot_info_t *hdr, uint32_t magic) printf("Boot finished.\n"); + printf("Kernel version %s: \"%s\"\n", KAPPA_KERNEL_VERSION, KAPPA_KERNEL_CODENAME); + printf("Running graphics benchmark...\n"); srand(42); + while(1); + if(gfx_status) { const int width = *gfx_width; @@ -171,10 +178,10 @@ void main(struct multiboot_info_t *hdr, uint32_t magic) printf("Resolution: %dx%dx%d\n", *gfx_width, *gfx_height, *gfx_bpp * 8); } - printf("Testing keyboard LED's..."); + printf("Testing keyboard LED's"); - int n = 3; - int s = -1; + int n = 0; + int s = 1; while(1) { diff --git a/kernel/timer.c b/kernel/timer.c index bdf48eb..e1f248b 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -16,7 +16,6 @@ static void timer_callback(struct regs_t *regs) void timer_init(uint32_t freq) { - printf("Timer init"); set_interrupt_handler(IRQ(0), timer_callback); current_tick_data = 0; |