kernel-5.3.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. diff --git a/ndiswrapper/driver/ntoskernel.c b/ndiswrapper/driver/ntoskernel.c
  2. index 4fe0dc1..4dd7a89 100644
  3. --- a/ndiswrapper/driver/ntoskernel.c
  4. +++ b/ndiswrapper/driver/ntoskernel.c
  5. @@ -2524,7 +2524,11 @@ int ntoskernel_init(void)
  6. info->task = NULL;
  7. info->count = 0;
  8. #ifdef CONFIG_SMP
  9. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
  10. cpumask_setall(&info->cpus_allowed);
  11. +#else
  12. + cpumask_setall(&info->cpus_mask);
  13. +#endif
  14. #endif
  15. }
  16. } while (0);
  17. diff --git a/ndiswrapper/driver/ntoskernel.h b/ndiswrapper/driver/ntoskernel.h
  18. index 3c4c6ff..8a71ae3 100644
  19. --- a/ndiswrapper/driver/ntoskernel.h
  20. +++ b/ndiswrapper/driver/ntoskernel.h
  21. @@ -107,7 +107,11 @@ static cpumask_t cpumasks[NR_CPUS];
  22. #endif /* CONFIG_SMP */
  23. #ifndef tsk_cpus_allowed
  24. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
  25. #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
  26. +#else
  27. +#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_mask)
  28. +#endif
  29. #endif
  30. #ifndef __packed
  31. @@ -631,7 +635,12 @@ struct irql_info {
  32. int count;
  33. struct mutex lock;
  34. #ifdef CONFIG_SMP
  35. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
  36. cpumask_t cpus_allowed;
  37. +#else
  38. + const cpumask_t *cpus_ptr;
  39. + cpumask_t cpus_mask;
  40. +#endif
  41. #endif
  42. struct task_struct *task;
  43. };
  44. @@ -658,7 +667,11 @@ static inline KIRQL raise_irql(KIRQL newirql)
  45. /* TODO: is this enough to pin down to current cpu? */
  46. #ifdef CONFIG_SMP
  47. assert(task_cpu(current) == smp_processor_id());
  48. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
  49. cpumask_copy(&info->cpus_allowed, tsk_cpus_allowed(current));
  50. +#else
  51. + cpumask_copy(&info->cpus_mask, tsk_cpus_allowed(current));
  52. +#endif
  53. set_cpus_allowed_ptr(current, cpumask_of(smp_processor_id()));
  54. #endif
  55. put_cpu_var(irql_info);
  56. @@ -682,7 +695,11 @@ static inline void lower_irql(KIRQL oldirql)
  57. if (--info->count == 0) {
  58. info->task = NULL;
  59. #ifdef CONFIG_SMP
  60. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
  61. set_cpus_allowed_ptr(current, &info->cpus_allowed);
  62. +#else
  63. + set_cpus_allowed_ptr(current, &info->cpus_mask);
  64. +#endif
  65. #endif
  66. mutex_unlock(&info->lock);
  67. }