Chinaunix首页 | 论坛 | 博客
  • 博客访问: 371436
  • 博文数量: 56
  • 博客积分: 1449
  • 博客等级: 中尉
  • 技术积分: 822
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-08 10:24
文章分类

全部博文(56)

文章存档

2014年(7)

2012年(13)

2011年(10)

2010年(26)

分类:

2010-10-22 13:41:24

/* 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();
}

阅读(2620) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~