cp: fairly simplistic Machine Check Interruption handler
[hvf.git] / cp / nucleus / int.s
blob3b7aacc4b0b93a38888336c72a605b4d9d2f619d
1 /*
2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 .text
10 #include <interrupt.h>
13 # IO Interrupt
15 .align 4
16 .globl IO_INT
17 .type IO_INT, @function
18 IO_INT:
19 # save regs
20 STMG %r0,%r15,0x200(%r0)
22 # set up stack
23 LARL %r15, int_stack_ptr
24 LG %r15, 0(%r15)
25 AGHI %r15,-160
27 LARL %r14, __io_int_handler
28 BALR %r14, %r14 # call the real handler
30 # restore regs
31 LMG %r0,%r15,0x200(%r0)
33 LPSWE 0x170 # go back to what we interrupted
37 # External Interrupt
39 .align 4
40 .globl EXT_INT
41 .type EXT_INT, @function
42 EXT_INT:
43 # save regs
44 STMG %r0,%r15,0x200(%r0)
46 # set up stack
47 LARL %r15, int_stack_ptr
48 LG %r15, 0(%r15)
49 AGHI %r15,-160
51 LARL %r14, __ext_int_handler
52 BALR %r14, %r14 # call the real handler
55 # NOTE: we may never return from the C-interrupt handler if the
56 # interrupt was caused by the timer clock, in which case the
57 # scheduler kicks in, and gives control to someone else
60 # restore regs
61 LMG %r0,%r15,0x200(%r0)
63 LPSWE 0x130 # go back to what we interrupted
67 # Supervisor-Call Interrupt
69 .align 4
70 .globl SVC_INT
71 .type SVC_INT, @function
72 SVC_INT:
73 # save regs
74 STMG %r0,%r15,0x200(%r0)
76 # set up stack
77 LARL %r15, int_stack_ptr
78 LG %r15, 0(%r15)
79 AGHI %r15,-160
81 # find the right handler
82 LARL %r14, svc_table # table address
83 LGH %r2, 0x8a # interruption code
84 SLL %r2, 3
85 # byte offset into table
86 LG %r14, 0(%r2,%r14) # load value from table
88 BALR %r14, %r14 # call the real handler
90 # restore regs
91 LMG %r0,%r15,0x200(%r0)
93 LPSWE 0x140 # go back to what we interrupted
97 # Program Interrupt
99 .align 4
100 .globl PGM_INT
101 .type PGM_INT, @function
102 PGM_INT:
103 # save regs
104 STMG %r0,%r15,0x200(%r0)
106 # set up stack
107 LARL %r15, int_stack_ptr
108 LG %r15, 0(%r15)
109 AGHI %r15,-160
111 LARL %r14, __pgm_int_handler
112 BALR %r14, %r14 # call the real handler
115 # NOTE: we may never return from the C-interrupt handler
118 # restore regs
119 LMG %r0,%r15,0x200(%r0)
121 LPSWE 0x150 # go back to what we interrupted
125 # Machine Check Interrupt
127 .align 4
128 .globl MCH_INT
129 .type MCH_INT, @function
130 MCH_INT:
131 # save regs
132 STMG %r0,%r15,0x200(%r0)
134 # set up stack
135 LARL %r15, int_stack_ptr
136 LG %r15, 0(%r15)
137 AGHI %r15,-160
139 LARL %r14, __mch_int_handler
140 BALR %r14, %r14 # call the real handler
143 # NOTE: we may never return from the C-interrupt handler
146 # restore regs
147 LMG %r0,%r15,0x200(%r0)
149 LPSWE 0x160 # go back to what we interrupted