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