摘要: 这里主要说说异常(cpu查出来的) 中断(狭义的指硬盘 键盘...)1.异常的发生2.异常的处理过程3.异常的设置===============================1.异常发生异常通常是cpu侦测出来的还有疑问,用户可不可以用就不知?int n 可以么?==================================2.异常的处理 //先看异常的设置最下边//set_intr_gate(n,addr) 在8295a设置对应的中断向量号 0x20-0x2f//set_trap_gate(n,addr)//set_system_gate(n,addr)//lin/kernel/as 阅读全文
posted @ 2013-08-16 06:01 caesarxu 阅读(587) 评论(0) 推荐(0) 编辑
摘要: int 0x80 系统调用1.用户怎么调用?(建议是间接方式,方便移植)系统如何使用?(直接方式)2.调用后处理过程?3.系统怎么设置的?===============================1在用户层面来讲,有2中方式,直接和间接间接,我们使用c库函数,比如 int read(int fd,char *buf,int n);直接,我们直接使用所要使用功能函数对应的系统调用,//lin/include/unistd.h中,比如上边对应read_syscall3(int, read, int, fd, char *, buf, int, n);//这个是宏172 #define _sys 阅读全文
posted @ 2013-08-16 05:11 caesarxu 阅读(3243) 评论(0) 推荐(0) 编辑
摘要: 1 #define move_to_user_mode() \ 2 __asm__ ("movl %%esp,%%eax\n\t" \ 3 "pushl $0x17\n\t" \ 4 "pushl %%eax\n\t" \ 5 "pushfl\n\t" \ 6 "pushl $0x0f\n\t" \ 7 "pushl $1f\n\t" \ 8 "iret\n" \ 9 "1:\tmovl $0x17,%%eax\n\t" \ 10 &q 阅读全文
posted @ 2013-08-16 03:36 caesarxu 阅读(641) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * linux/kernel/sched.c 3 * 4 * (C) 1991 Linus Torvalds 5 */ 6 7 /* 8 * 'sched.c' is the main kernel file. It contains scheduling primitives 9 * (sleep_on, wakeup, schedule etc) as well as a number of simple system 10 * call functions (type getpid(), which just extracts a ... 阅读全文
posted @ 2013-08-16 03:34 caesarxu 阅读(669) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * linux/kernel/system_call.s 3 * 4 * (C) 1991 Linus Torvalds 5 */ 6 7 /* 8 * system_call.s contains the system-call low-level handling routines. 9 * This also contains the timer-interrupt handler, as some of the code is 10 * the same. The hd- and flopppy-interrupts are ... 阅读全文
posted @ 2013-08-16 03:29 caesarxu 阅读(563) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * linux/kernel/asm.s 3 * 4 * (C) 1991 Linus Torvalds 5 */ 6 7 /* 8 * asm.s contains the low-level code for most hardware faults. 9 * page_exception is handled by the mm, so that isn't here. This 10 * file also handles (hopefully) fpu-exceptions due to TS-bit, as 11 * the... 阅读全文
posted @ 2013-08-16 03:18 caesarxu 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * linux/kernel/traps.c 3 * 4 * (C) 1991 Linus Torvalds 5 */ 6 7 /* 8 * 'Traps.c' handles hardware traps and faults after we have saved some 9 * state in 'asm.s'. Currently mostly a debugging-aid, will be extended 10 * to mainly kill the offending process (probably by givi... 阅读全文
posted @ 2013-08-16 03:16 caesarxu 阅读(687) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * linux/kernel/sys.c 3 * 4 * (C) 1991 Linus Torvalds 5 */ 6 7 #include 8 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 16 int sys_ftime() 17 { 18 return -ENOSYS; 19 } 20 21 int sys_break() 22 { 23 return -ENOSYS; 24 } 25 ... 阅读全文
posted @ 2013-08-16 03:06 caesarxu 阅读(967) 评论(0) 推荐(0) 编辑
摘要: 1 extern int sys_setup(); 2 extern int sys_exit(); 3 extern int sys_fork(); 4 extern int sys_read(); 5 extern int sys_write(); 6 extern int sys_open(); 7 extern int sys_close(); 8 extern int sys_waitpid(); 9 extern int sys_creat(); 10 extern int sys_link(); 11 extern int sys_unlink(); 12 e... 阅读全文
posted @ 2013-08-16 03:03 caesarxu 阅读(703) 评论(0) 推荐(0) 编辑