Compare commits
No commits in common. "59bcc17668dc7ec9b053b6b18c46a19f55767014" and "595a7d51635835fc626d2025a68af039153527f8" have entirely different histories.
59bcc17668
...
595a7d5163
@ -273,140 +273,116 @@ irs31:
|
|||||||
irq0:
|
irq0:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $0
|
push $32
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq1
|
.globl irq1
|
||||||
irq1:
|
irq1:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $1
|
push $33
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq2
|
.globl irq2
|
||||||
irq2:
|
irq2:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $2
|
push $34
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq3
|
.globl irq3
|
||||||
irq3:
|
irq3:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $3
|
push $35
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq4
|
.globl irq4
|
||||||
irq4:
|
irq4:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $4
|
push $36
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq5
|
.globl irq5
|
||||||
irq5:
|
irq5:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $5
|
push $37
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq6
|
.globl irq6
|
||||||
irq6:
|
irq6:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $6
|
push $38
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq7
|
.globl irq7
|
||||||
irq7:
|
irq7:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $7
|
push $39
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq8
|
.globl irq8
|
||||||
irq8:
|
irq8:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $8
|
push $40
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq9
|
.globl irq9
|
||||||
irq9:
|
irq9:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $9
|
push $41
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq10
|
.globl irq10
|
||||||
irq10:
|
irq10:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $10
|
push $42
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq11
|
.globl irq11
|
||||||
irq11:
|
irq11:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $11
|
push $43
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
|
|
||||||
.globl irq12
|
.globl irq12
|
||||||
irq12:
|
irq12:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $12
|
push $44
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq13
|
.globl irq13
|
||||||
irq13:
|
irq13:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $13
|
push $45
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq14
|
.globl irq14
|
||||||
irq14:
|
irq14:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $14
|
push $46
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
.globl irq15
|
.globl irq15
|
||||||
irq15:
|
irq15:
|
||||||
cli
|
cli
|
||||||
push $0
|
push $0
|
||||||
push $15
|
push $47
|
||||||
jmp irq_common
|
jmp irs_common
|
||||||
|
|
||||||
irq_common:
|
|
||||||
pusha
|
|
||||||
|
|
||||||
mov %ds, %ax
|
|
||||||
push %eax
|
|
||||||
|
|
||||||
mov $0x10, %ax
|
|
||||||
mov %ax, %ds
|
|
||||||
mov %ax, %es
|
|
||||||
mov %ax, %fs
|
|
||||||
mov %ax, %gs
|
|
||||||
|
|
||||||
call irq_handler
|
|
||||||
|
|
||||||
pop %eax
|
|
||||||
|
|
||||||
mov %ax, %ds
|
|
||||||
mov %ax, %es
|
|
||||||
mov %ax, %fs
|
|
||||||
mov %ax, %gs
|
|
||||||
|
|
||||||
popa
|
|
||||||
add $8, %esp # cleans push error and irs code
|
|
||||||
sti
|
|
||||||
iret # pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
|
|
||||||
|
|
||||||
|
|
||||||
irs_common:
|
irs_common:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "idt.h"
|
#include "idt.h"
|
||||||
#include "Scancodes.h"
|
|
||||||
|
|
||||||
IDT_entry idt_table[256];
|
IDT_entry idt_table[256];
|
||||||
IDT_ptr idt_ptr;
|
IDT_ptr idt_ptr;
|
||||||
@ -17,7 +17,7 @@ void set_id_entry (uint8_t num , uint32_t base, uint16_t sel, uint8_t flags){
|
|||||||
void irs_handler (registers regs) {
|
void irs_handler (registers regs) {
|
||||||
kterm_writestring("received interrupt!\n");
|
kterm_writestring("received interrupt!\n");
|
||||||
|
|
||||||
printf("(IRS) Interrupt number: %d \n", regs.int_no);
|
printf(" Interrupt number: %d \n", regs.int_no);
|
||||||
|
|
||||||
if( regs.int_no == 13){
|
if( regs.int_no == 13){
|
||||||
printf(" Error code: %d \n", regs.err_code);
|
printf(" Error code: %d \n", regs.err_code);
|
||||||
@ -28,52 +28,6 @@ void irs_handler (registers regs) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void irq_handler (registers regs) {
|
|
||||||
|
|
||||||
|
|
||||||
if ( regs.int_no != 0) {
|
|
||||||
kterm_writestring("received interrupt!\n");
|
|
||||||
printf("(IRQ) Interrupt number: %d \n", regs.int_no);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( regs.int_no == 1 ){
|
|
||||||
// Keyboard interrupt !!
|
|
||||||
|
|
||||||
int scan;
|
|
||||||
register int i;
|
|
||||||
|
|
||||||
// Read scancode
|
|
||||||
|
|
||||||
scan = inb(0x60);
|
|
||||||
|
|
||||||
// Send ack message!
|
|
||||||
i = inb(0x61);
|
|
||||||
outb(0x61, i|0x80);
|
|
||||||
outb(0x61, i);
|
|
||||||
kterm_writestring("A key was pressed/released\n");
|
|
||||||
printf( "Scancode: %x\n", scan);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
outb(0x20, 0x20); // send end of interrupt to master
|
|
||||||
|
|
||||||
if ( regs.int_no > 8 && regs.int_no <= 15) {
|
|
||||||
outb(0xA0, 0x20); // send end of interrupt to slave
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( regs.int_no == 13){
|
|
||||||
printf(" Error code: %d \n", regs.err_code);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +39,7 @@ void init_idt(){
|
|||||||
|
|
||||||
// TODO: Set everything to zero first
|
// TODO: Set everything to zero first
|
||||||
|
|
||||||
set_id_entry(0, (uint32_t) irs0 , 0x08, 0x8F);
|
set_id_entry(0, (uint32_t) irs0 , 0x08, 0x8E);
|
||||||
set_id_entry(1, (uint32_t) irs1 , 0x08, 0x8E);
|
set_id_entry(1, (uint32_t) irs1 , 0x08, 0x8E);
|
||||||
set_id_entry(2, (uint32_t) irs2 , 0x08, 0x8E);
|
set_id_entry(2, (uint32_t) irs2 , 0x08, 0x8E);
|
||||||
set_id_entry(3, (uint32_t) irs3 , 0x08, 0x8E);
|
set_id_entry(3, (uint32_t) irs3 , 0x08, 0x8E);
|
||||||
|
@ -140,17 +140,18 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
/** test interrupt handlers **/
|
/** test interrupt handlers **/
|
||||||
//asm volatile ("int $0x03");
|
asm volatile ("int $0x03");
|
||||||
|
|
||||||
//asm volatile ("int $0x04");
|
asm volatile ("int $4");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (true){
|
while (true){
|
||||||
//Read time indefinetely
|
// Read time indefinetely
|
||||||
read_rtc();
|
read_rtc();
|
||||||
printf( "UTC time: %2d-%2d-%2d %2d:%2d:%2d : (YY-MM-DD h:mm:ss)\r" ,year, month, day, hour, minute, second);
|
printf( "UTC time: %2d-%2d-%2d %2d:%2d:%2d : (YY-MM-DD h:mm:ss)\r" ,year, month, day, hour, minute, second);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Lets start using the serial port for debugging .. **/
|
/** Lets start using the serial port for debugging .. **/
|
||||||
// Hopefully once we go into realmode or do something that
|
// Hopefully once we go into realmode or do something that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user