- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathio.s
More file actions
Latest commit
25 lines (21 loc) · 711 Bytes
/
Copy pathio.s
File metadata and controls
25 lines (21 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
globalinb
globaloutb
globalload_idt
section .text
; Read byte from I/O port: inb(port)
inb:
movdx,[esp+4] ; Get port number from stack argument
inal,dx ; Read byte into AL register
ret ; Return value in AL
; Write byte to I/O port: outb(port, value)
outb:
movdx,[esp+4] ; Get port number
moval,[esp+8] ; Get value to write
outdx,al ; Send byte to hardware port
ret
; Load Interrupt Descriptor Table pointer: load_idt(idtp_address)
load_idt:
movedx,[esp+4] ; Get address of IDT pointer
lidt[edx] ; Execute x86 LIDT instruction
sti ; Enable hardware interrupts
ret