VirtualBox

Ignore:
Timestamp:
Mar 25, 2008 3:13:42 PM (17 years ago)
Author:
vboxsync
Message:

vboxdrv: re-added sanity check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h

    r7531 r7553  
    208208#endif /* !NO_REDHAT_HACKS */
    209209
     210#ifndef MY_DO_MUNMAP
     211# define MY_DO_MUNMAP(a,b,c) do_munmap(a, b, c)
     212#endif
     213
     214#ifndef MY_CHANGE_PAGE_ATTR
     215# ifdef RT_ARCH_AMD64 /** @todo This is a cheap hack, but it'll get around that 'else BUG();' in __change_page_attr().  */
     216#  define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) \
     217    do { \
     218        change_page_attr(pPages, cPages, PAGE_KERNEL_NOCACHE); \
     219        change_page_attr(pPages, cPages, prot); \
     220    } while (0)
     221# else
     222#  define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) change_page_attr(pPages, cPages, prot)
     223# endif
     224#endif
     225
    210226#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
    211227# define MY_SET_PAGES_EXEC(pPages, cPages)    set_pages_x(pPages, cPages)
    212228# define MY_SET_PAGES_NOEXEC(pPages, cPages)  set_pages_nx(pPages, cPages)
    213229#else
    214 # define MY_SET_PAGES_EXEC(pPages, cPages)    MY_CHANGE_PAGE_ATTR(pPages, cPages, MY_PAGE_KERNEL_EXEC)
    215 # define MY_SET_PAGES_NOEXEC(pPages, cPages)  MY_CHANGE_PAGE_ATTR(pPages, cPages, PAGE_KERNEL)
    216 #endif
    217 
    218 #ifndef MY_DO_MUNMAP
    219 # define MY_DO_MUNMAP(a,b,c) do_munmap(a, b, c)
    220 #endif
    221 
    222 #ifndef MY_CHANGE_PAGE_ATTR
    223 # ifdef RT_ARCH_AMD64 /** @todo This is a cheap hack, but it'll get around that 'else BUG();' in __change_page_attr().  */
    224 #  define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) \
    225     do { \
    226         change_page_attr(pPages, cPages, PAGE_KERNEL_NOCACHE); \
    227         change_page_attr(pPages, cPages, prot); \
    228     } while (0)
    229 # else
    230 #  define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) change_page_attr(pPages, cPages, prot)
    231 # endif
     230# define MY_SET_PAGES_EXEC(pPages, cPages) \
     231    do { \
     232        if (pgprot_val(MY_PAGE_KERNEL_EXEC) != pgprot_val(PAGE_KERNEL)) \
     233            MY_CHANGE_PAGE_ATTR(pPages, cPages, MY_PAGE_KERNEL_EXEC) \
     234    } while (0)
     235# define MY_SET_PAGES_NOEXEC(pPages, cPages) \
     236    do { \
     237        if (pgprot_val(MY_PAGE_KERNEL_EXEC) != pgprot_val(PAGE_KERNEL)) \
     238            MY_CHANGE_PAGE_ATTR(pPages, cPages, PAGE_KERNEL) \
     239    } while (0)
    232240#endif
    233241
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette