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

Re: [Minios-devel] [PATCH v2 08/47] arm64: fix the wrong mask for to_virt/to_phys



Huang Shijie, on jeu. 15 mars 2018 04:52:15 +0000, wrote:
> In the arm64, the mask 0xffffffff will truncate the value, and
> to_virt/to_phys will get wrong results.
> 
> This patch fixes it.
> 

> -#define to_phys(x)                 (((paddr_t)(x)+physical_address_offset) & 
> 0xffffffff)
> -#define to_virt(x)                 ((void *)(((x)-physical_address_offset) & 
> 0xffffffff))
> +#define to_phys(x)                 (((paddr_t)(x)+physical_address_offset) & 
> (~0UL))
> +#define to_virt(x)                 ((void *)(((x)-physical_address_offset) & 
> (~0UL)))

This looks doubtful: are both virtual and physical address necessarily
the size of an unsigned long?

(that's not true on 32bit x86 with PAE, for instance).

Samuel

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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