include: move MCH Interrupt code struct definition to top-level include
[hvf.git] / cp / include / interrupt.h
blob0c079ce6028a22194590345e6dbe4c6662f99821
1 /*
2 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #ifndef __INTERRUPT_H
9 #define __INTERRUPT_H
12 * I/O interruptions specific constants & structures
14 struct io_int_code {
15 u32 ssid;
16 u32 param;
17 } __attribute__((packed));
19 #define PSA_INT_GPR ((u64*) 0x200)
20 #define PSA_TMP_PSW ((struct psw*) 0x280)
22 #define IO_INT_OLD_PSW ((void*) 0x170)
23 #define IO_INT_NEW_PSW ((void*) 0x1f0)
24 #define IO_INT_CODE ((struct io_int_code*) 0xb8)
26 #define EXT_INT_OLD_PSW ((void*) 0x130)
27 #define EXT_INT_NEW_PSW ((void*) 0x1b0)
28 #define EXT_INT_CODE ((u16*) 0x86)
30 #define SVC_INT_OLD_PSW ((void*) 0x140)
31 #define SVC_INT_NEW_PSW ((void*) 0x1c0)
32 #define SVC_INT_CODE ((u16*) 0x8a)
34 #define PGM_INT_OLD_PSW ((void*) 0x150)
35 #define PGM_INT_NEW_PSW ((void*) 0x1d0)
36 #define PGM_INT_ILC ((u8*) 0x8d)
37 #define PGM_INT_CODE ((u16*) 0x8e)
40 * Assembly stubs to call the C-handlers
42 extern void IO_INT(void);
43 extern void EXT_INT(void);
44 extern void SVC_INT(void);
45 extern void PGM_INT(void);
46 extern void MCH_INT(void);
48 /**
49 * local_int_disable - disable interruptions & return old mask
51 #define local_int_disable() ({ \
52 unsigned long __flags; \
53 __asm__ __volatile__ ( \
54 "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
55 __flags; \
58 /**
59 * local_int_restore - restore interrupt mask
60 * x: mask to restore
62 #define local_int_restore(x) \
63 __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory")
65 /**
66 * local_int_restore - restore interrupt mask
67 * x: mask to restore
69 static inline int interruptable()
71 u8 x;
73 __asm__ __volatile__(
74 "stosm 0(%0),0x00"
75 : /* out */
76 : /* in */
77 "a" (&x),
78 "m" (x)
79 : /* clobber */
80 "memory"
83 return (x & 0x43) != 0;
86 extern void set_timer(void);
89 * The Supervisor-Service call table
91 #define SVC_SCHEDULE 0
92 #define SVC_SCHEDULE_BLOCKED 1
93 #define SVC_SCHEDULE_EXIT 2
94 #define NR_SVC 3
95 extern u64 svc_table[NR_SVC];
97 /* Interrupt handlers */
98 extern void __pgm_int_handler(void);
99 extern void __ext_int_handler(void);
100 extern void __io_int_handler(void);
102 /* Interrupt handler stack pointer */
103 extern u8 *int_stack_ptr;
105 #endif