lkml.org 
[lkml]   [2006]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 08/35] Add Xen-specific memory management definitions

> +#define virt_to_ptep(__va) \
> +({ \
> + pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \
> + pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \
> + pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \
> + pte_offset_kernel(__pmd, (unsigned long)(__va)); \
> +})

Do we really need yet another function to do this?
Especially one in a mult-line #define instead of a real function call,
and that doesn't seem to error check at each step?

> +
> +#define arbitrary_virt_to_machine(__va) \
> +({ \
> + maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\
> + m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \
> +})
> +
> +#define make_lowmem_page_readonly(va, feature) do { \
> + pte_t *pte; \
> + int rc; \
> + \
> + if (xen_feature(feature)) \
> + return; \
> + \
> + pte = virt_to_ptep(va); \
> + rc = HYPERVISOR_update_va_mapping( \
> + (unsigned long)va, pte_wrprotect(*pte), 0); \
> + BUG_ON(rc); \
> +} while (0)

Things this long should definitely not be #defines.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-09 16:53    [W:0.697 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site