xref: /kvmtool/x86/interrupt.c (revision da8883c13efabdfae2bbf40142a1ebf3f0faabcd)
1eda03319SPekka Enberg #include "kvm/interrupt.h"
2eda03319SPekka Enberg 
3b1b71cd9SCyrill Gorcunov #include "util.h"
4b1b71cd9SCyrill Gorcunov 
506f82371SPekka Enberg #include <string.h>
606f82371SPekka Enberg 
7*da8883c1SPekka Enberg void interrupt_table__copy(struct interrupt_table *self, void *dst, unsigned int size)
8b1b71cd9SCyrill Gorcunov {
9*da8883c1SPekka Enberg 	if (size < sizeof(self->entries))
10b1b71cd9SCyrill Gorcunov 		die("An attempt to overwrite host memory");
11*da8883c1SPekka Enberg 
12*da8883c1SPekka Enberg 	memcpy(dst, self->entries, sizeof(self->entries));
13b1b71cd9SCyrill Gorcunov }
14b1b71cd9SCyrill Gorcunov 
15*da8883c1SPekka Enberg void interrupt_table__setup(struct interrupt_table *self, struct ivt_entry e)
16ea684828SCyrill Gorcunov {
17ea684828SCyrill Gorcunov 	unsigned int i;
18ea684828SCyrill Gorcunov 
19ea684828SCyrill Gorcunov 	for (i = 0; i < IVT_VECTORS; i++)
20*da8883c1SPekka Enberg 		self->entries[i] = e;
21ea684828SCyrill Gorcunov }
22