Files
RockOS/kernel/syscall.S
2026-07-01 20:00:22 -05:00

36 lines
619 B
ArmAsm

.code32
.global syscall_handler
.extern syscall
syscall_handler:
cli
pushfl
pushl %cs
movl 8(%esp), %eax
pushl %eax
movl 4(%esp), %ebx # Get CS
movl %ebx, 8(%esp) # Move CS over Old EIP
movl 0(%esp), %ebx # Get Return EIP
movl %ebx, 4(%esp) # Move Return EIP over CS
addl $4, %esp # Adjust stack pointer
movw %ds, %ax
pushl %eax
pushal
pushl %esp
call switch_context
movl %eax, %esp
popal
popl %eax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
sti
iret