Compare commits
2 Commits
595a7d5163
...
59bcc17668
Author | SHA1 | Date | |
---|---|---|---|
59bcc17668 | |||
5f50f8c013 |
@ -273,116 +273,140 @@ irs31:
|
||||
irq0:
|
||||
cli
|
||||
push $0
|
||||
push $32
|
||||
jmp irs_common
|
||||
push $0
|
||||
jmp irq_common
|
||||
|
||||
.globl irq1
|
||||
irq1:
|
||||
cli
|
||||
push $0
|
||||
push $33
|
||||
jmp irs_common
|
||||
push $1
|
||||
jmp irq_common
|
||||
|
||||
.globl irq2
|
||||
irq2:
|
||||
cli
|
||||
push $0
|
||||
push $34
|
||||
jmp irs_common
|
||||
push $2
|
||||
jmp irq_common
|
||||
|
||||
.globl irq3
|
||||
irq3:
|
||||
cli
|
||||
push $0
|
||||
push $35
|
||||
jmp irs_common
|
||||
push $3
|
||||
jmp irq_common
|
||||
|
||||
.globl irq4
|
||||
irq4:
|
||||
cli
|
||||
push $0
|
||||
push $36
|
||||
jmp irs_common
|
||||
push $4
|
||||
jmp irq_common
|
||||
|
||||
.globl irq5
|
||||
irq5:
|
||||
cli
|
||||
push $0
|
||||
push $37
|
||||
jmp irs_common
|
||||
push $5
|
||||
jmp irq_common
|
||||
|
||||
.globl irq6
|
||||
irq6:
|
||||
cli
|
||||
push $0
|
||||
push $38
|
||||
jmp irs_common
|
||||
push $6
|
||||
jmp irq_common
|
||||
|
||||
.globl irq7
|
||||
irq7:
|
||||
cli
|
||||
push $0
|
||||
push $39
|
||||
jmp irs_common
|
||||
push $7
|
||||
jmp irq_common
|
||||
|
||||
.globl irq8
|
||||
irq8:
|
||||
cli
|
||||
push $0
|
||||
push $40
|
||||
jmp irs_common
|
||||
push $8
|
||||
jmp irq_common
|
||||
|
||||
.globl irq9
|
||||
irq9:
|
||||
cli
|
||||
push $0
|
||||
push $41
|
||||
jmp irs_common
|
||||
push $9
|
||||
jmp irq_common
|
||||
|
||||
.globl irq10
|
||||
irq10:
|
||||
cli
|
||||
push $0
|
||||
push $42
|
||||
jmp irs_common
|
||||
push $10
|
||||
jmp irq_common
|
||||
|
||||
.globl irq11
|
||||
irq11:
|
||||
cli
|
||||
push $0
|
||||
push $43
|
||||
jmp irs_common
|
||||
push $11
|
||||
jmp irq_common
|
||||
|
||||
|
||||
.globl irq12
|
||||
irq12:
|
||||
cli
|
||||
push $0
|
||||
push $44
|
||||
jmp irs_common
|
||||
push $12
|
||||
jmp irq_common
|
||||
|
||||
.globl irq13
|
||||
irq13:
|
||||
cli
|
||||
push $0
|
||||
push $45
|
||||
jmp irs_common
|
||||
push $13
|
||||
jmp irq_common
|
||||
|
||||
.globl irq14
|
||||
irq14:
|
||||
cli
|
||||
push $0
|
||||
push $46
|
||||
jmp irs_common
|
||||
push $14
|
||||
jmp irq_common
|
||||
|
||||
.globl irq15
|
||||
irq15:
|
||||
cli
|
||||
push $0
|
||||
push $47
|
||||
jmp irs_common
|
||||
push $15
|
||||
jmp irq_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:
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "idt.h"
|
||||
|
||||
#include "Scancodes.h"
|
||||
|
||||
IDT_entry idt_table[256];
|
||||
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) {
|
||||
kterm_writestring("received interrupt!\n");
|
||||
|
||||
printf(" Interrupt number: %d \n", regs.int_no);
|
||||
printf("(IRS) Interrupt number: %d \n", regs.int_no);
|
||||
|
||||
if( regs.int_no == 13){
|
||||
printf(" Error code: %d \n", regs.err_code);
|
||||
@ -28,6 +28,52 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -39,7 +85,7 @@ void init_idt(){
|
||||
|
||||
// TODO: Set everything to zero first
|
||||
|
||||
set_id_entry(0, (uint32_t) irs0 , 0x08, 0x8E);
|
||||
set_id_entry(0, (uint32_t) irs0 , 0x08, 0x8F);
|
||||
set_id_entry(1, (uint32_t) irs1 , 0x08, 0x8E);
|
||||
set_id_entry(2, (uint32_t) irs2 , 0x08, 0x8E);
|
||||
set_id_entry(3, (uint32_t) irs3 , 0x08, 0x8E);
|
||||
|
@ -140,19 +140,18 @@ extern "C" {
|
||||
|
||||
|
||||
/** test interrupt handlers **/
|
||||
asm volatile ("int $0x03");
|
||||
|
||||
asm volatile ("int $4");
|
||||
|
||||
//asm volatile ("int $0x03");
|
||||
|
||||
//asm volatile ("int $0x04");
|
||||
|
||||
while (true){
|
||||
// Read time indefinetely
|
||||
//Read time indefinetely
|
||||
read_rtc();
|
||||
printf( "UTC time: %2d-%2d-%2d %2d:%2d:%2d : (YY-MM-DD h:mm:ss)\r" ,year, month, day, hour, minute, second);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
/** Lets start using the serial port for debugging .. **/
|
||||
// Hopefully once we go into realmode or do something that
|
||||
// cause the screen to go black.. this serial comms part will give
|
||||
|
Loading…
x
Reference in New Issue
Block a user