Files
RockOS/kernel/common.S

123 lines
1.5 KiB
ArmAsm
Raw Normal View History

2026-06-13 13:27:39 -05:00
.code32
2026-06-21 16:57:16 -05:00
.section .text
2026-06-13 20:43:09 -04:00
.global disable_interrupts
disable_interrupts:
cli
ret
2026-06-13 13:27:39 -05:00
.global enable_interrupts
enable_interrupts:
sti
ret
.global io_wait
io_wait:
outb %al, $0x80
2026-06-16 21:53:38 -04:00
ret
.global liftoff
liftoff:
cli
mov 4(%esp), %ecx
mov 8(%esp), %ebx
mov $0x23, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
push $0x23
push %ebx
push $0x202
push $0x1B
push %ecx
xor %eax, %eax
xor %edx, %edx
2026-06-21 16:57:16 -05:00
iret
.global outb
outb:
push %ebp
mov %esp, %ebp
# 8(%ebp) port
# 12(%ebp) data
mov 8(%ebp), %edx
mov 12(%ebp), %eax
outb %al, %dx
leave
ret
.global inb
inb:
push %ebp
mov %esp, %ebp
# 8(%ebp) port
mov 8(%ebp), %edx
xor %eax, %eax
inb %dx, %al
leave
2026-06-23 23:19:49 -05:00
ret
.global insw
insw:
push %ebp
mov %esp, %ebp
push %edi
push %ecx
push %edx
# 8(%ebp) addr
# 12(%ebp) buf
# 16(%ebp) sz
mov 8(%ebp), %edx
mov 12(%ebp), %edi
mov 16(%ebp), %ecx
cld
rep insw
pop %edx
pop %ecx
pop %edi
leave
ret
.global outsw
outsw:
push %ebp
mov %esp, %ebp
push %esi
push %ecx
push %edx
# 8(%ebp) address
# 12(%ebp) buf
# 16(%ebp) sz
mov 8(%ebp), %edx
mov 12(%ebp), %esi
mov 16(%ebp), %ecx
cld
rep outsw
pop %edx
pop %ecx
pop %esi
leave
ret
.global fetch_cr3
fetch_cr3:
mov %cr3, %eax
2026-06-21 16:57:16 -05:00
ret