1eda03319SPekka Enberg #include "kvm/interrupt.h"
2eda03319SPekka Enberg
3f3150089SPekka Enberg #include "kvm/util.h"
4b1b71cd9SCyrill Gorcunov
506f82371SPekka Enberg #include <string.h>
606f82371SPekka Enberg
interrupt_table__copy(struct interrupt_table * itable,void * dst,unsigned int size)743835ac9SSasha Levin void interrupt_table__copy(struct interrupt_table *itable, void *dst, unsigned int size)
8b1b71cd9SCyrill Gorcunov {
943835ac9SSasha Levin if (size < sizeof(itable->entries))
10b1b71cd9SCyrill Gorcunov die("An attempt to overwrite host memory");
11da8883c1SPekka Enberg
1243835ac9SSasha Levin memcpy(dst, itable->entries, sizeof(itable->entries));
13b1b71cd9SCyrill Gorcunov }
14b1b71cd9SCyrill Gorcunov
interrupt_table__setup(struct interrupt_table * itable,struct real_intr_desc * entry)1543835ac9SSasha Levin void interrupt_table__setup(struct interrupt_table *itable, struct real_intr_desc *entry)
16ea684828SCyrill Gorcunov {
17ea684828SCyrill Gorcunov unsigned int i;
18ea684828SCyrill Gorcunov
19bc75b0aeSCyrill Gorcunov for (i = 0; i < REAL_INTR_VECTORS; i++)
2043835ac9SSasha Levin itable->entries[i] = *entry;
21ea684828SCyrill Gorcunov }
22d1a26cf0SCyrill Gorcunov
interrupt_table__set(struct interrupt_table * itable,struct real_intr_desc * entry,unsigned int num)23*3a60be06SSasha Levin void interrupt_table__set(struct interrupt_table *itable,
24*3a60be06SSasha Levin struct real_intr_desc *entry, unsigned int num)
25d1a26cf0SCyrill Gorcunov {
26d1a26cf0SCyrill Gorcunov if (num < REAL_INTR_VECTORS)
2743835ac9SSasha Levin itable->entries[num] = *entry;
28d1a26cf0SCyrill Gorcunov }
29