Wrote syscall interrupt handler in assembly

This commit is contained in:
2021-04-19 06:53:39 -05:00
parent 0af53bcfc8
commit 755f2a3d69
2 changed files with 25 additions and 6 deletions

View File

@@ -65,7 +65,3 @@ void isr_timer(struct interrupt_frame_t *frame)
printf("Timer tick.\n"); printf("Timer tick.\n");
apic_eoi(); apic_eoi();
} }
void isr_syscall(struct interrupt_frame_t *frame)
{
}

View File

@@ -1,5 +1,28 @@
.section .text .section .text
.global isr_syscall
.type isr_syscall, @function
isr_syscall:
cli
push %edx
push %ecx
push %ebx
push %eax
push $kernel_state
mov $0x10, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
call do_syscall
add $0x14, %esp
mov $0x23, %cx
mov %cx, %ds
mov %cx, %es
mov %cx, %fs
mov %cx, %gs
iret
.global isr_preempt .global isr_preempt
.type isr_preempt, @function .type isr_preempt, @function
isr_preempt: isr_preempt:
@@ -7,11 +30,11 @@ isr_preempt:
push %esp push %esp
push $0x800 push $0x800
call save_context call save_context
sub $8, %esp add $8, %esp
push $0x800 push $0x800
push $kernel_state push $kernel_state
call next_process call next_process
sub $8, %esp add $8, %esp
push %eax push %eax
call load_context call load_context