[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] x86: add pte_set_flags/clear_flags for pteflag manipulation



>>> Jeremy Fitzhardinge <jeremy@xxxxxxxx> 22.01.09 23:24 >>>
>+static inline pte_t pte_set_flags(pte_t pte, pteval_t set)
>+{
>+      pteval_t v = native_pte_val(pte);
>+
>+      return native_make_pte(v | set);
>+}
>+
>+static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear)
>+{
>+      pteval_t v = native_pte_val(pte);
>+
>+      return native_make_pte(v & ~clear);
>+}

I think a comment (or event a BUG_ON()) should be added here to make
clear that this absolutely must not be used to toggle the present bit. I
even view toggling _PAGE_PSE as dangerous this way.

And alternative would be to make these macros and #undef them (or keep
them inline functions but add destructive #define-s) after all their users.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.