kernel-5.6.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. diff --git a/driver/ntoskernel.c b/driver/ntoskernel.c
  2. index fccb28e..cd87740 100644
  3. --- a/driver/ntoskernel.c
  4. +++ b/driver/ntoskernel.c
  5. @@ -1763,9 +1763,9 @@ wstdcall void __iomem *WIN_FUNC(MmMapIoSpace,3)
  6. void __iomem *virt;
  7. ENTER1("cache type: %d", cache);
  8. if (cache == MmCached)
  9. - virt = ioremap(phys_addr, size);
  10. + virt = ioremap_cache(phys_addr, size);
  11. else
  12. - virt = ioremap_nocache(phys_addr, size);
  13. + virt = ioremap(phys_addr, size);
  14. TRACE1("%llx, %zu, %p", phys_addr, size, virt);
  15. return virt;
  16. }
  17. diff --git a/driver/proc.c b/driver/proc.c
  18. index 8a8cf2b..2622228 100644
  19. --- a/driver/proc.c
  20. +++ b/driver/proc.c
  21. @@ -70,7 +70,11 @@ static inline void *PDE_DATA(const struct inode *inode)
  22. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
  23. static inline struct proc_dir_entry *proc_create_data(const char *name,
  24. umode_t mode, struct proc_dir_entry *parent,
  25. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  26. + struct proc_ops *fops, void *data)
  27. +#else
  28. struct file_operations *fops, void *data)
  29. +#endif
  30. {
  31. struct proc_dir_entry *de;
  32. @@ -86,7 +90,11 @@ static inline struct proc_dir_entry *proc_create_data(const char *name,
  33. static int do_proc_make_entry(const char *name, umode_t mode,
  34. struct proc_dir_entry *parent,
  35. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  36. + struct proc_ops *fops, kuid_t uid,
  37. +#else
  38. struct file_operations *fops, kuid_t uid,
  39. +#endif
  40. kgid_t gid, struct ndis_device *wnd)
  41. {
  42. struct proc_dir_entry *de;
  43. @@ -100,6 +108,32 @@ static int do_proc_make_entry(const char *name, umode_t mode,
  44. return 0;
  45. }
  46. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  47. +#define PROC_DECLARE_RO(name) \
  48. + static int proc_##name##_open(struct inode *inode, struct file *file) \
  49. + { \
  50. + return single_open(file, proc_##name##_read, PDE_DATA(inode)); \
  51. + } \
  52. + static struct proc_ops name##_fops = { \
  53. + .proc_open = proc_##name##_open, \
  54. + .proc_read = seq_read, \
  55. + .proc_lseek = seq_lseek, \
  56. + .proc_release = single_release, \
  57. + };
  58. +
  59. +#define PROC_DECLARE_RW(name) \
  60. + static int proc_##name##_open(struct inode *inode, struct file *file) \
  61. + { \
  62. + return single_open(file, proc_##name##_read, PDE_DATA(inode)); \
  63. + } \
  64. + static struct proc_ops name##_fops = { \
  65. + .proc_open = proc_##name##_open, \
  66. + .proc_read = seq_read, \
  67. + .proc_lseek = seq_lseek, \
  68. + .proc_release = single_release, \
  69. + .proc_write = proc_##name##_write, \
  70. + };
  71. +#else
  72. #define PROC_DECLARE_RO(name) \
  73. static int proc_##name##_open(struct inode *inode, struct file *file) \
  74. { \
  75. @@ -126,6 +160,7 @@ static int do_proc_make_entry(const char *name, umode_t mode,
  76. .release = single_release, \
  77. .write = proc_##name##_write, \
  78. };
  79. +#endif
  80. #define proc_make_entry_ro(name, parent, wnd) \
  81. do_proc_make_entry(#name, S_IFREG | S_IRUSR | S_IRGRP, parent, \