Files
RockOS/kernel/syscall.S

36 lines
619 B
ArmAsm
Raw Normal View History

2026-06-17 18:16:47 -05:00
.code32
.global syscall_handler
.extern syscall
syscall_handler:
cli
2026-07-01 20:00:22 -05:00
pushfl
pushl %cs
2026-06-17 18:16:47 -05:00
2026-07-01 20:00:22 -05:00
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
2026-06-17 18:16:47 -05:00
2026-07-01 20:00:22 -05:00
movw %ds, %ax
pushl %eax
2026-06-17 18:16:47 -05:00
2026-07-01 20:00:22 -05:00
pushal
2026-06-17 18:16:47 -05:00
2026-07-01 20:00:22 -05:00
pushl %esp
call switch_context
movl %eax, %esp
popal
popl %eax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
2026-06-17 18:16:47 -05:00
2026-07-01 20:00:22 -05:00
sti
2026-06-17 18:16:47 -05:00
iret