msr.c 382 B

123456789101112131415161718192021222324
  1. #include <linux/module.h>
  2. #include <linux/preempt.h>
  3. #include <asm/msr.h>
  4. struct msr *msrs_alloc(void)
  5. {
  6. struct msr *msrs = NULL;
  7. msrs = alloc_percpu(struct msr);
  8. if (!msrs) {
  9. pr_warning("%s: error allocating msrs\n", __func__);
  10. return NULL;
  11. }
  12. return msrs;
  13. }
  14. EXPORT_SYMBOL(msrs_alloc);
  15. void msrs_free(struct msr *msrs)
  16. {
  17. free_percpu(msrs);
  18. }
  19. EXPORT_SYMBOL(msrs_free);