改用int250作为系统调用

This commit is contained in:
fslongjin
2022-04-12 11:54:44 +08:00
parent 011246281a
commit 2d7b2b7048
15 changed files with 236 additions and 104 deletions

View File

@ -52,6 +52,7 @@ Restore_all:
popq %rax
addq $0x10, %rsp // FUNCerrcode
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) // raxrax
@ -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

View File

@ -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) =
{

View File

@ -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

View File

@ -52,7 +52,7 @@ void do_softirq()
}
}
cli();
}
void softirq_init()

View File

@ -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为用户自定义中断内部

View File

@ -48,4 +48,5 @@ void machine_check();
void SIMD_exception();
void virtualization_exception();
void syscall_int(); // 系统调用门
void sys_vector_init();