aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2015-02-08 17:32:23 -0500
committerFranklin Wei <frankhwei536@gmail.com>2015-02-08 17:32:23 -0500
commit52d2b12c32ab15f4314cf5f0b27ea24709ed1cb1 (patch)
treea092e2e798139456d5f1b2f6b320a6c60a705205 /kernel
parent0d7cde7c4d735ebebd39b988440f50f5889bd29f (diff)
downloadkappa-52d2b12c32ab15f4314cf5f0b27ea24709ed1cb1.zip
kappa-52d2b12c32ab15f4314cf5f0b27ea24709ed1cb1.tar.gz
kappa-52d2b12c32ab15f4314cf5f0b27ea24709ed1cb1.tar.bz2
kappa-52d2b12c32ab15f4314cf5f0b27ea24709ed1cb1.tar.xz
lots of optimization, new features
Diffstat (limited to 'kernel')
-rw-r--r--kernel/irq-as.S64
-rw-r--r--kernel/isr-as.S116
-rw-r--r--kernel/main.c36
3 files changed, 124 insertions, 92 deletions
diff --git a/kernel/irq-as.S b/kernel/irq-as.S
index 12de4b6..8840299 100644
--- a/kernel/irq-as.S
+++ b/kernel/irq-as.S
@@ -44,96 +44,96 @@ irq_stub:
_irq0:
cli
- push $0
- push $32
+ pushl $0
+ pushl $32
jmp irq_stub
_irq1:
cli
- push $0
- push $33
+ pushl $0
+ pushl $33
jmp irq_stub
_irq2:
cli
- push $0
- push $34
+ pushl $0
+ pushl $34
jmp irq_stub
_irq3:
cli
- push $0
- push $35
+ pushl $0
+ pushl $35
jmp irq_stub
_irq4:
cli
- push $0
- push $36
+ pushl $0
+ pushl $36
jmp irq_stub
_irq5:
cli
- push $0
- push $37
+ pushl $0
+ pushl $37
jmp irq_stub
_irq6:
cli
- push $0
- push $38
+ pushl $0
+ pushl $38
jmp irq_stub
_irq7:
cli
- push $0
- push $39
+ pushl $0
+ pushl $39
jmp irq_stub
_irq8:
cli
- push $0
- push $40
+ pushl $0
+ pushl $40
jmp irq_stub
_irq9:
cli
- push $0
- push $41
+ pushl $0
+ pushl $41
jmp irq_stub
_irq10:
cli
- push $0
- push $42
+ pushl $0
+ pushl $42
jmp irq_stub
_irq11:
cli
- push $0
- push $43
+ pushl $0
+ pushl $43
jmp irq_stub
_irq12:
cli
- push $0
- push $44
+ pushl $0
+ pushl $44
jmp irq_stub
_irq13:
cli
- push $0
- push $45
+ pushl $0
+ pushl $45
jmp irq_stub
_irq14:
cli
- push $0
- push $46
+ pushl $0
+ pushl $46
jmp irq_stub
_irq15:
cli
- push $0
- push $47
+ pushl $0
+ pushl $47
jmp irq_stub
diff --git a/kernel/isr-as.S b/kernel/isr-as.S
index 464ec5b..858ce47 100644
--- a/kernel/isr-as.S
+++ b/kernel/isr-as.S
@@ -60,155 +60,155 @@ isr_stub:
_isr0:
cli
- push $0
- push $0
+ pushl $0
+ pushl $0
jmp isr_stub
_isr1:
cli
- push $0
- push $1
+ pushl $0
+ pushl $1
jmp isr_stub
_isr2:
cli
- push $0
- push $2
+ pushl $0
+ pushl $2
jmp isr_stub
_isr3:
cli
- push $0
- push $3
+ pushl $0
+ pushl $3
jmp isr_stub
_isr4:
cli
- push $0
- push $4
+ pushl $0
+ pushl $4
jmp isr_stub
_isr5:
cli
- push $0
- push $5
+ pushl $0
+ pushl $5
jmp isr_stub
_isr6:
cli
- push $0
- push $6
+ pushl $0
+ pushl $6
jmp isr_stub
_isr7:
cli
- push $0
- push $7
+ pushl $0
+ pushl $7
jmp isr_stub
_isr8:
cli
- push $8
+ pushl $8
jmp isr_stub
_isr9:
cli
- push $0
- push $9
+ pushl $0
+ pushl $9
jmp isr_stub
_isr10:
cli
- push $10
+ pushl $10
jmp isr_stub
_isr11:
cli
- push $11
+ pushl $11
jmp isr_stub
_isr12:
cli
- push $12
+ pushl $12
jmp isr_stub
_isr13:
cli
- push $13
+ pushl $13
jmp isr_stub
_isr14:
cli
- push $14
+ pushl $14
jmp isr_stub
_isr15:
cli
- push $0
- push $15
+ pushl $0
+ pushl $15
jmp isr_stub
_isr16:
cli
- push $0
- push $16
+ pushl $0
+ pushl $16
jmp isr_stub
_isr17:
cli
- push $0
- push $17
+ pushl $0
+ pushl $17
jmp isr_stub
_isr18:
cli
- push $0
- push $18
+ pushl $0
+ pushl $18
jmp isr_stub
_isr19:
cli
- push $0
- push $19
+ pushl $0
+ pushl $19
jmp isr_stub
_isr20:
cli
- push $0
- push $20
+ pushl $0
+ pushl $20
jmp isr_stub
_isr21:
cli
- push $0
- push $21
+ pushl $0
+ pushl $21
jmp isr_stub
_isr22:
cli
- push $0
- push $22
+ pushl $0
+ pushl $22
jmp isr_stub
_isr23:
cli
- push $0
- push $23
+ pushl $0
+ pushl $23
jmp isr_stub
_isr24:
cli
- push $0
- push $24
+ pushl $0
+ pushl $24
jmp isr_stub
_isr25:
cli
- push $0
- push $25
+ pushl $0
+ pushl $25
jmp isr_stub
_isr26:
cli
- push $0
- push $26
+ pushl $0
+ pushl $26
jmp isr_stub
_isr27:
cli
- push $0
- push $27
+ pushl $0
+ pushl $27
jmp isr_stub
_isr28:
cli
- push $0
- push $28
+ pushl $0
+ pushl $28
jmp isr_stub
_isr29:
cli
- push $0
- push $29
+ pushl $0
+ pushl $29
jmp isr_stub
_isr30:
cli
- push $0
- push $30
+ pushl $0
+ pushl $30
jmp isr_stub
_isr31:
cli
- push $0
- push $31
+ pushl $0
+ pushl $31
jmp isr_stub
diff --git a/kernel/main.c b/kernel/main.c
index 927a497..211be18 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -19,7 +19,7 @@ void gpf(struct regs_t regs)
{
printf("General protection fault!\n");
printf("EIP before fault: 0x%x\n", regs.eip);
- printf("Error code: %d\n", regs.err_code);
+ printf("Error code: 0x%x\n", regs.err_code);
panic("GPF");
}
@@ -78,6 +78,7 @@ void main(struct multiboot_info_t *hdr, uint32_t magic)
gfx_drawpixel(rx, ry);
}
int endpix = *current_tick;
+
int startfill = *current_tick;
for(int i=0;i<1000;++i)
{
@@ -97,11 +98,43 @@ void main(struct multiboot_info_t *hdr, uint32_t magic)
gfx_drawchar(rx, ry, rand()%127+1);
}
int endtext = *current_tick;
+ gfx_clear();
+
+ int starthline = *current_tick;
+ for(int i=0;i<1000000;++i)
+ {
+ gfx_hline(rand() % *gfx_width, rand() % *gfx_width, rand() % *gfx_height);
+ }
+ int endhline = *current_tick;
+
+ gfx_clear();
+
+ int startvline = *current_tick;
+ for(int i=0;i<1000000;++i)
+ {
+ gfx_vline(rand() % *gfx_height, rand() % *gfx_height, rand() % *gfx_width);
+ }
+ int endvline = *current_tick;
+
+ int startrect = *current_tick;
+ for(int i=0;i<1000;++i)
+ {
+ int x = rand() % *gfx_width;
+ int y = rand() % *gfx_height;
+ int w = rand() % (*gfx_width - x);
+ int h = rand() % (*gfx_height - y);
+ gfx_fillrect(x, y, w, h);
+ }
+ int endrect = *current_tick;
+
gfx_reset();
printf("--- Graphics benchmark results ---\n");
printf("Ticks for 1,000,000 random pixels: %d\n", endpix-startpix);
printf("Ticks for 1,000 random fills: %d\n", endfill-startfill);
printf("Ticks for 1,000,000 random chars: %d\n", endtext-starttext);
+ printf("Ticks for 1,000,000 random hlines: %d\n", endhline-starthline);
+ printf("Ticks for 1,000,000 random vlines: %d\n", endvline-startvline);
+ printf("Ticks for 1,000 random rects: %d\n", endrect-startrect);
printf("Ticks per second: %d\n", HZ);
printf("Resolution: %dx%dx%d\n", *gfx_width, *gfx_height, *gfx_bpp * 8);
}
@@ -119,5 +152,4 @@ void main(struct multiboot_info_t *hdr, uint32_t magic)
ps2_set_leds(PS2_CAPS_LOCK);
timer_delay(HZ/4);
}
- while(1);
}