Files
rasp/tests/test_interrupts.asm
Alek Ratzloff 551bd2c3f4 Add initial register states to meta section; remove entry directive
It makes sense to allow users to set the initial register values. This
allows someone to e.g. enable interrupts once the VM has started, or set
the initial stack pointer value.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-10 12:18:31 -04:00

53 lines
764 B
NASM

.section code $0x0 {
main:
; Test divide by zero interrupts
; div
mov %status, $1
mov %r0, $1
div %r0, $0
cmpeq (count), $1
jz end
; idiv
mov %status, $2
idiv %r0, $0
cmpeq (count), $2
jz end
mov %status, $0
end:
halt
.align u64
divide_by_zero:
add (count), $1
iret
.export main
.export divide_by_zero
}
.section ivt $0x1000 {
ivt:
.interrupt $1, divide_by_zero
.export ivt
}
.section shared $0x2000 {
count: .u64 $0
.export count
}
.section stack $0x4000 .. $0x5000 {
stack_base:
.export stack_base
}
.meta {
ip: main
flags: $0b100
sp: stack_base
ivt: ivt
}