Files

133 lines
1.8 KiB
ArmAsm
Raw Permalink 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
2026-07-01 20:00:22 -05:00
mov 4(%esp), %ecx
mov 8(%esp), %ebx
2026-06-16 21:53:38 -04:00
mov $0x23, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
2026-07-01 20:00:22 -05:00
pushl $0x23 # User Data Segment (SS)
pushl %ebx # User Stack Pointer (ESP)
pushl $0x202 # EFLAGS (Interrupts enabled, bit 1 standard)
pushl $0x1B # User Code Segment (CS)
pushl %ecx # User Entry Point (EIP)
2026-06-16 21:53:38 -04:00
xor %eax, %eax
2026-07-01 20:00:22 -05:00
xor %ebx, %ebx
xor %ecx, %ecx
2026-06-16 21:53:38 -04:00
xor %edx, %edx
2026-07-01 20:00:22 -05:00
xor %esi, %esi
xor %edi, %edi
xor %ebp, %ebp
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
ret
2026-07-07 18:52:22 -05:00
.global kpanic
kpanic:
cli
hlt