2020-03-10 15:59:36 -04:00
|
|
|
.section code 0x1000 {
|
2020-03-10 12:18:31 -04:00
|
|
|
main:
|
2020-03-10 15:59:36 -04:00
|
|
|
; Test that interrupts will not called when enabled flag is not set
|
|
|
|
|
int 0, 0
|
|
|
|
|
cmpeq (count), 0
|
|
|
|
|
jnz end
|
|
|
|
|
|
2020-03-10 12:18:31 -04:00
|
|
|
; Test divide by zero interrupts
|
|
|
|
|
|
|
|
|
|
; div
|
2020-03-10 15:59:36 -04:00
|
|
|
add %status, 1
|
|
|
|
|
mov %r0, 1
|
|
|
|
|
div %r0, 0
|
|
|
|
|
cmpeq (count), 1
|
2020-03-10 12:18:31 -04:00
|
|
|
jz end
|
|
|
|
|
|
|
|
|
|
; idiv
|
2020-03-10 15:59:36 -04:00
|
|
|
add %status, 1
|
|
|
|
|
idiv %r0, 0
|
|
|
|
|
cmpeq (count), 2
|
2020-03-10 12:18:31 -04:00
|
|
|
jz end
|
|
|
|
|
|
2020-03-10 15:59:36 -04:00
|
|
|
mov %status, 0
|
2020-03-10 12:18:31 -04:00
|
|
|
end:
|
|
|
|
|
halt
|
|
|
|
|
|
|
|
|
|
.align u64
|
2020-03-10 15:59:36 -04:00
|
|
|
generic_handler:
|
|
|
|
|
add (count), 1
|
2020-03-10 12:18:31 -04:00
|
|
|
iret
|
|
|
|
|
|
|
|
|
|
.export main
|
2020-03-10 15:59:36 -04:00
|
|
|
.export generic_handler
|
2020-03-10 12:18:31 -04:00
|
|
|
}
|
|
|
|
|
|
2020-03-10 15:59:36 -04:00
|
|
|
.section ivt 0x1800 {
|
2020-03-10 12:18:31 -04:00
|
|
|
ivt:
|
2020-03-10 15:59:36 -04:00
|
|
|
.interrupt 0, 0
|
|
|
|
|
.interrupt 0, 0
|
|
|
|
|
.interrupt 0, 0
|
|
|
|
|
.interrupt 1, generic_handler
|
2020-03-10 12:18:31 -04:00
|
|
|
.export ivt
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 15:59:36 -04:00
|
|
|
.section shared 0x2000 {
|
|
|
|
|
count: .u64 0
|
2020-03-10 12:18:31 -04:00
|
|
|
.export count
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 15:59:36 -04:00
|
|
|
.section stack 0x4000 .. 0x5000 {
|
2020-03-10 12:18:31 -04:00
|
|
|
stack_base:
|
|
|
|
|
.export stack_base
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.meta {
|
|
|
|
|
ip: main
|
|
|
|
|
sp: stack_base
|
|
|
|
|
ivt: ivt
|
|
|
|
|
}
|