mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 09:06:32 +00:00
改用int250作为系统调用
This commit is contained in:
@ -52,6 +52,7 @@ Restore_all:
|
||||
|
||||
popq %rax
|
||||
addq $0x10, %rsp // 弹出变量FUNC和errcode
|
||||
|
||||
iretq
|
||||
|
||||
ret_from_exception:
|
||||
@ -106,9 +107,6 @@ Err_Code:
|
||||
ENTRY(system_call)
|
||||
|
||||
// 由于sysenter指令会禁用中断,因此要在这里手动开启中断
|
||||
sti;
|
||||
|
||||
|
||||
subq $0x38, %rsp
|
||||
|
||||
cld;
|
||||
@ -146,6 +144,7 @@ ENTRY(system_call)
|
||||
|
||||
// 从系统调用中返回
|
||||
ENTRY(ret_from_system_call)
|
||||
|
||||
movq %rax, 0x80(%rsp) // 将当前rax的值先存到栈中rax的位置
|
||||
|
||||
|
||||
@ -168,9 +167,10 @@ ENTRY(ret_from_system_call)
|
||||
popq %rax
|
||||
movq %rax, %es
|
||||
popq %rax
|
||||
addq $0x38, %rsp
|
||||
.byte 0x48
|
||||
addq $0x38, %rsp
|
||||
.byte 0x48
|
||||
sysexit
|
||||
|
||||
|
||||
|
||||
// 0 #DE 除法错误
|
||||
@ -337,6 +337,15 @@ ENTRY(virtualization_exception)
|
||||
xchgq %rax, (%rsp) // 把FUNC的地址换入栈中
|
||||
jmp Err_Code
|
||||
|
||||
/*
|
||||
// 0x80 系统调用门
|
||||
ENTRY(syscall_int)
|
||||
pushq $0
|
||||
pushq %rax
|
||||
leaq do_syscall_int(%rip), %rax // 获取系统调用服务程序的地址
|
||||
xchgq %rax, (%rsp) // 把FUNC的地址换入栈中
|
||||
jmp Err_Code
|
||||
*/
|
||||
|
||||
ENTRY(_stack_start)
|
||||
.quad initial_proc_union + 32768
|
@ -129,6 +129,8 @@ Build_IRQ(0xcf);
|
||||
Build_IRQ(0xd0);
|
||||
Build_IRQ(0xd1);
|
||||
|
||||
Build_IRQ(0xfa); // 系统调用入口
|
||||
void (*syscall_intr_table[1])(void) = {IRQ0xfainterrupt};
|
||||
// 初始化IPI中断服务程序数组
|
||||
void (*SMP_interrupt_table[SMP_IRQ_NUM])(void) =
|
||||
{
|
||||
|
@ -22,6 +22,8 @@ extern void do_IRQ(struct pt_regs *regs, ul number);
|
||||
|
||||
extern void (*SMP_interrupt_table[SMP_IRQ_NUM])(void);
|
||||
|
||||
extern void (*syscall_intr_table[1])(void);
|
||||
|
||||
/* ========= 中断向量分配表 ==========
|
||||
|
||||
0~255 IDT
|
||||
|
@ -52,7 +52,7 @@ void do_softirq()
|
||||
}
|
||||
}
|
||||
|
||||
cli();
|
||||
|
||||
}
|
||||
|
||||
void softirq_init()
|
||||
|
@ -196,7 +196,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long error_code)
|
||||
unsigned long cr2 = 0;
|
||||
|
||||
__asm__ __volatile__("movq %%cr2, %0":"=r"(cr2)::"memory");
|
||||
|
||||
hlt();
|
||||
kerror("do_page_fault(14),Error code :%#018lx,RSP:%#018lx,RIP:%#018lx\n",error_code , regs->rsp , regs->rip);
|
||||
|
||||
if(!(error_code & 0x01))
|
||||
@ -284,8 +284,6 @@ void do_virtualization_exception(struct pt_regs *regs, unsigned long error_code)
|
||||
|
||||
void sys_vector_init()
|
||||
{
|
||||
kdebug("do_divide_error=%#018lx", do_divide_error);
|
||||
kdebug("&do_divide_error=%#018lx", &do_divide_error);
|
||||
set_trap_gate(0, 1, divide_error);
|
||||
set_trap_gate(1, 1, debug);
|
||||
set_intr_gate(2, 1, nmi);
|
||||
@ -308,6 +306,8 @@ void sys_vector_init()
|
||||
set_trap_gate(19, 1, SIMD_exception);
|
||||
set_trap_gate(20, 1, virtualization_exception);
|
||||
// 中断号21-31由Intel保留,不能使用
|
||||
|
||||
|
||||
|
||||
// 32-255为用户自定义中断内部
|
||||
|
||||
|
@ -48,4 +48,5 @@ void machine_check();
|
||||
void SIMD_exception();
|
||||
void virtualization_exception();
|
||||
|
||||
void syscall_int(); // 系统调用门
|
||||
void sys_vector_init();
|
Reference in New Issue
Block a user