/* interrupt.c
*I don't mean to write the whole OS kernel.I just want to put what I have
*already learned into practice.But what will it be end up looking like.
*I don't know.ALA I have some free time,I will write something.Just like
*linus once said,"Just for fun".I don't care what this small ugly codes
*will be capable of,or does it worth something.I just write it for fun,
*and for practice.
* 10 / 12 / 2010 liangtao
* E-mail:liangtao90s@gmail.com
*/
#include
#include
#include
#include
#include
#include
extern unsigned int jiffies;
/* bullshit , but it's enough for the test*/
void do_timer(long dpl)
{
struct task_struct *current;
do_8259a_eoi();
current = CURRENT;
jiffies_inc(&jiffies);
if(--current->counter <= 0) {
if(dpl) {
current->counter = 1;
schedule();
}
}
}
extern void default_intr_handler(void);
extern void system_call(void);
void trap_init(void)
{
int i;
for(i = 0; i < 48; i++)
set_trap_gate(i, ((unsigned long)&default_intr_handler));
set_syscall_gate(SYSCALL, ((unsigned long)&system_call));
do_8259a_pic_init();
// do_8259a_unmask_all_irq();
}
阅读(2653) | 评论(0) | 转发(0) |