summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile4
-rw-r--r--src/interrupts.asm15
-rw-r--r--src/interrupts.c6
-rw-r--r--src/interrupts.h2
-rw-r--r--src/kernel.c14
-rw-r--r--src/stage1_functions.asm2
6 files changed, 17 insertions, 26 deletions
diff --git a/src/Makefile b/src/Makefile
index 9ffa885..01a61de 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -13,10 +13,10 @@ all: image.bin kernel.sym
# + M * 512 (M is currently 7) = 3144 for kernel.bin
# + 1 * 512 = 512 for magic.bin
# (M + N + 1 is the number of sectors to be read in stage 2, as stage 1
-# loads only the first sector, so adapt NOF_LOAD_SECTORS to 18)
+# loads only the first sector, so adapt NOF_LOAD_SECTORS to 19)
image.bin: boot.bin kernel.bin magic.bin
cat boot.bin kernel.bin > image.tmp
- truncate -s 9216 image.tmp
+ truncate -s 9728 image.tmp
cat image.tmp magic.bin > image.bin
boot.bin: boot.asm boot_gdt.asm stage1_functions.asm stage2_functions.asm stage2_switch_mode.asm stage2_a20.asm
diff --git a/src/interrupts.asm b/src/interrupts.asm
index fd5f4a3..ecbee19 100644
--- a/src/interrupts.asm
+++ b/src/interrupts.asm
@@ -8,6 +8,7 @@ extern interrupts_handle_interrupt
; void interrupts_enable( void )
interrupts_enable:
push ebp
+ mov ebp, esp
sti
leave
ret
@@ -15,6 +16,7 @@ interrupts_enable:
; void interrupts_disable( void )
interrupts_disable:
push ebp
+ mov ebp, esp
cli
leave
ret
@@ -35,16 +37,7 @@ interrupts_load_idt:
; the handler to ignore interrupts
global interrupts_ignore_request
interrupts_ignore_request:
- pusha
- push si
- mov si, IGNINTR
- call pm_print_string
- pop si
- popa
iret
-
-IGNINTR:
- db "IGNINTR ", 0
; void interrupts_handle_request_0x00( );
%macro exception_stub 1
@@ -69,8 +62,8 @@ int_entry:
mov eax, [interrupt_no]
push eax
call interrupts_handle_interrupt
- add esp, 8
-; mov esp, eax
+ ;add esp, 8
+ mov esp, eax
; restore state
pop gs
diff --git a/src/interrupts.c b/src/interrupts.c
index 2355aec..d952180 100644
--- a/src/interrupts.c
+++ b/src/interrupts.c
@@ -32,9 +32,7 @@ void interrupts_init( interrupt_t *interrupt )
idt_pointer.size = 256 * sizeof( interrupt_gate_descriptor_t ) - 1;
idt_pointer.base = (uint32_t)interrupt->descriptor_table;
-
- printf( "IDT pointer at 0x%X\n", &idt_pointer );
-
+
interrupts_load_idt( &idt_pointer );
}
@@ -53,7 +51,7 @@ void interrupts_register_interrupt( interrupt_t *interrupts,
uint32_t interrupts_handle_interrupt( uint8_t interrupt_no, uint32_t esp )
{
- printf( "interrupt 0x%X with ESP 0x%X", interrupt_no, esp );
+ printf( "interrupt 0x%X with ESP 0x%X\n", interrupt_no, esp );
// for now, we are using the same stack for kernel and interrupt
// handlers (n task switching)
diff --git a/src/interrupts.h b/src/interrupts.h
index 42f6a5b..9b7665f 100644
--- a/src/interrupts.h
+++ b/src/interrupts.h
@@ -21,7 +21,7 @@
// packed IDT structure, note TCC needs every member to have a packed
// attribute, GCC/Clang are happy with the packed attribute at the
// structure level
-typedef struct {
+typedef struct interrupt_gate_descriptor_t {
uint16_t handler_address_low_bits MEMBER_ATTRIBUTE_PACKED;
uint16_t gdt_code_segment_selector MEMBER_ATTRIBUTE_PACKED;
uint8_t reserved MEMBER_ATTRIBUTE_PACKED;
diff --git a/src/kernel.c b/src/kernel.c
index 44f1bad..ba0b360 100644
--- a/src/kernel.c
+++ b/src/kernel.c
@@ -31,11 +31,7 @@ void entry( void )
interrupt_t interrupt;
interrupts_init( &interrupt );
interrupts_enable( );
-
- //~ int y = 1;
- //~ int x = 12 / y;
- //~ printf( "Hex number is 0x%X and string is '%s'\n", x, "abaos" );
-
+
console_put_string( &console, "Running.." );
const char bar[] = "\\|/-";
@@ -43,17 +39,21 @@ void entry( void )
int x_pos = vga_get_cursor_x( &vga );
int i = 0;
for( i = 0; i < 10000; i++ ) {
- if( i % 1000 == 0 ) {
+ if( i % 1000 == 1 ) {
vga_put_char_at( &vga, x_pos, y_pos, '.' );
x_pos++;
serial_put_char( &serial, '.' );
}
vga_put_char_at( &vga, x_pos, y_pos, bar[i%4] );
- for( int j = 0; j < 150000; j++ ) {
+ for( int j = 0; j < 1500; j++ ) {
}
}
vga_put_char_at( &vga, x_pos, y_pos, '.' );
serial_put_char( &serial, '.' );
+
+ int y = 0;
+ int x = 12 / y;
+ printf( "Hex number is 0x%X and string is '%s'\n", x, "abaos" );
console_put_newline( &console );
diff --git a/src/stage1_functions.asm b/src/stage1_functions.asm
index 7c66fc8..c2e1bcd 100644
--- a/src/stage1_functions.asm
+++ b/src/stage1_functions.asm
@@ -2,7 +2,7 @@
; 3 * 512 for bootloader stage2 and the kernel code
; (note: the first sector gets loaded by the BIOS, so
; subtract 1 here!)
-NOF_LOAD_SECTORS equ 18
+NOF_LOAD_SECTORS equ 19
; IN bx: begin of memory area to dump
; IN ax: number of words to dump