mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
解决了在用户态下进行系统调用会禁用中断的问题
This commit is contained in:
@ -145,31 +145,32 @@ ENTRY(system_call)
|
||||
// 从系统调用中返回
|
||||
ENTRY(ret_from_system_call)
|
||||
|
||||
movq %rax, 0x80(%rsp) // 将当前rax的值先存到栈中rax的位置
|
||||
popq %r15
|
||||
popq %r14
|
||||
popq %r13
|
||||
popq %r12
|
||||
popq %r11
|
||||
popq %r10
|
||||
popq %r9
|
||||
popq %r8
|
||||
popq %rbx
|
||||
popq %rcx
|
||||
popq %rdx
|
||||
popq %rsi
|
||||
popq %rdi
|
||||
popq %rbp
|
||||
|
||||
popq %rax // 不允许直接pop到ds
|
||||
movq %rax, %ds
|
||||
|
||||
popq %rax
|
||||
movq %rax, %es
|
||||
|
||||
popq %rax
|
||||
addq $0x10, %rsp // 弹出变量FUNC和errcode
|
||||
|
||||
iretq
|
||||
|
||||
|
||||
popq %r15
|
||||
popq %r14
|
||||
popq %r13
|
||||
popq %r12
|
||||
popq %r11
|
||||
popq %r10
|
||||
popq %r9
|
||||
popq %r8
|
||||
popq %rbx
|
||||
popq %rcx
|
||||
popq %rdx
|
||||
popq %rsi
|
||||
popq %rdi
|
||||
popq %rbp
|
||||
popq %rax
|
||||
movq %rax, %ds
|
||||
popq %rax
|
||||
movq %rax, %es
|
||||
popq %rax
|
||||
addq $0x38, %rsp
|
||||
.byte 0x48
|
||||
sysexit
|
||||
|
||||
|
||||
|
||||
@ -337,6 +338,8 @@ ENTRY(virtualization_exception)
|
||||
xchgq %rax, (%rsp) // 把FUNC的地址换入栈中
|
||||
jmp Err_Code
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// 0x80 系统调用门
|
||||
ENTRY(syscall_int)
|
||||
|
@ -129,8 +129,9 @@ Build_IRQ(0xcf);
|
||||
Build_IRQ(0xd0);
|
||||
Build_IRQ(0xd1);
|
||||
|
||||
Build_IRQ(0xfa); // 系统调用入口
|
||||
void (*syscall_intr_table[1])(void) = {IRQ0xfainterrupt};
|
||||
Build_IRQ(0x80); // 系统调用入口
|
||||
void (*syscall_intr_table[1])(void) = {IRQ0x80interrupt};
|
||||
|
||||
// 初始化IPI中断服务程序数组
|
||||
void (*SMP_interrupt_table[SMP_IRQ_NUM])(void) =
|
||||
{
|
||||
|
@ -169,6 +169,7 @@ void do_stack_segment_fault(struct pt_regs *regs, unsigned long error_code)
|
||||
void do_general_protection(struct pt_regs *regs, unsigned long error_code)
|
||||
{
|
||||
|
||||
hlt();
|
||||
kerror("do_general_protection(13),\tError Code:%#18lx,\tRSP:%#18lx,\tRIP:%#18lx\n", error_code, regs->rsp, regs->rip);
|
||||
if (error_code & 0x01)
|
||||
printk_color(RED, BLACK, "The exception occurred during delivery of an event external to the program,such as an interrupt or an earlier exception.\n");
|
||||
@ -311,27 +312,4 @@ void sys_vector_init()
|
||||
|
||||
// 32-255为用户自定义中断内部
|
||||
|
||||
/*
|
||||
set_trap_gate(0, 1, divide_error);
|
||||
set_trap_gate(1, 1, debug);
|
||||
set_intr_gate(2, 1, nmi);
|
||||
set_system_trap_gate(3, 1, int3);
|
||||
set_system_trap_gate(4, 1, overflow);
|
||||
set_system_trap_gate(5, 1, bounds);
|
||||
set_trap_gate(6, 1, undefined_opcode);
|
||||
set_trap_gate(7, 1, dev_not_avaliable);
|
||||
set_trap_gate(8, 1, double_fault);
|
||||
set_trap_gate(9, 1, coprocessor_segment_overrun);
|
||||
set_trap_gate(10, 1, invalid_TSS);
|
||||
set_trap_gate(11, 1, segment_not_exists);
|
||||
set_trap_gate(12, 1, stack_segment_fault);
|
||||
set_trap_gate(13, 1, general_protection);
|
||||
set_trap_gate(14, 1, page_fault);
|
||||
// 中断号15由Intel保留,不能使用
|
||||
set_trap_gate(16, 1, x87_FPU_error);
|
||||
set_trap_gate(17, 1, alignment_check);
|
||||
set_trap_gate(18, 1, machine_check);
|
||||
set_trap_gate(19, 1, SIMD_exception);
|
||||
set_trap_gate(20, 1, virtualization_exception);
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user