ia64/xen-unstable
changeset 13401:9c6531217c7c
[XEN] Fix guest-access macros.
From: Christoph Egger <Christoph.Egger@amd.com>
From: Christoph Egger <Christoph.Egger@amd.com>
author | kfraser@localhost.localdomain |
---|---|
date | Fri Jan 12 14:22:28 2007 +0000 (2007-01-12) |
parents | 204c2724f800 |
children | 3b4ddf62f657 |
files | xen/include/asm-x86/guest_access.h |
line diff
1.1 --- a/xen/include/asm-x86/guest_access.h Fri Jan 12 10:48:46 2007 +0000 1.2 +++ b/xen/include/asm-x86/guest_access.h Fri Jan 12 14:22:28 2007 +0000 1.3 @@ -32,7 +32,7 @@ 1.4 * specifying an offset into the guest array. 1.5 */ 1.6 #define copy_to_guest_offset(hnd, off, ptr, nr) ({ \ 1.7 - const typeof(ptr) _x = (hnd).p; \ 1.8 + typeof(ptr) _x = (hnd).p; \ 1.9 const typeof(ptr) _y = (ptr); \ 1.10 is_hvm_vcpu(current) ? \ 1.11 copy_to_user_hvm(_x+(off), _y, sizeof(*_x)*(nr)) : \ 1.12 @@ -45,7 +45,7 @@ 1.13 */ 1.14 #define copy_from_guest_offset(ptr, hnd, off, nr) ({ \ 1.15 const typeof(ptr) _x = (hnd).p; \ 1.16 - const typeof(ptr) _y = (ptr); \ 1.17 + typeof(ptr) _y = (ptr); \ 1.18 is_hvm_vcpu(current) ? \ 1.19 copy_from_user_hvm(_y, _x+(off), sizeof(*_x)*(nr)) :\ 1.20 copy_from_user(_y, _x+(off), sizeof(*_x)*(nr)); \ 1.21 @@ -53,7 +53,7 @@ 1.22 1.23 /* Copy sub-field of a structure to guest context via a guest handle. */ 1.24 #define copy_field_to_guest(hnd, ptr, field) ({ \ 1.25 - const typeof(&(ptr)->field) _x = &(hnd).p->field; \ 1.26 + typeof(&(ptr)->field) _x = &(hnd).p->field; \ 1.27 const typeof(&(ptr)->field) _y = &(ptr)->field; \ 1.28 is_hvm_vcpu(current) ? \ 1.29 copy_to_user_hvm(_x, _y, sizeof(*_x)) : \ 1.30 @@ -63,7 +63,7 @@ 1.31 /* Copy sub-field of a structure from guest context via a guest handle. */ 1.32 #define copy_field_from_guest(ptr, hnd, field) ({ \ 1.33 const typeof(&(ptr)->field) _x = &(hnd).p->field; \ 1.34 - const typeof(&(ptr)->field) _y = &(ptr)->field; \ 1.35 + typeof(&(ptr)->field) _y = &(ptr)->field; \ 1.36 is_hvm_vcpu(current) ? \ 1.37 copy_from_user_hvm(_y, _x, sizeof(*_x)) : \ 1.38 copy_from_user(_y, _x, sizeof(*_x)); \ 1.39 @@ -78,7 +78,7 @@ 1.40 array_access_ok((hnd).p, (nr), sizeof(*(hnd).p))) 1.41 1.42 #define __copy_to_guest_offset(hnd, off, ptr, nr) ({ \ 1.43 - const typeof(ptr) _x = (hnd).p; \ 1.44 + typeof(ptr) _x = (hnd).p; \ 1.45 const typeof(ptr) _y = (ptr); \ 1.46 is_hvm_vcpu(current) ? \ 1.47 copy_to_user_hvm(_x+(off), _y, sizeof(*_x)*(nr)) : \ 1.48 @@ -87,14 +87,14 @@ 1.49 1.50 #define __copy_from_guest_offset(ptr, hnd, off, nr) ({ \ 1.51 const typeof(ptr) _x = (hnd).p; \ 1.52 - const typeof(ptr) _y = (ptr); \ 1.53 + typeof(ptr) _y = (ptr); \ 1.54 is_hvm_vcpu(current) ? \ 1.55 copy_from_user_hvm(_y, _x+(off),sizeof(*_x)*(nr)) : \ 1.56 __copy_from_user(_y, _x+(off), sizeof(*_x)*(nr)); \ 1.57 }) 1.58 1.59 #define __copy_field_to_guest(hnd, ptr, field) ({ \ 1.60 - const typeof(&(ptr)->field) _x = &(hnd).p->field; \ 1.61 + typeof(&(ptr)->field) _x = &(hnd).p->field; \ 1.62 const typeof(&(ptr)->field) _y = &(ptr)->field; \ 1.63 is_hvm_vcpu(current) ? \ 1.64 copy_to_user_hvm(_x, _y, sizeof(*_x)) : \ 1.65 @@ -103,9 +103,9 @@ 1.66 1.67 #define __copy_field_from_guest(ptr, hnd, field) ({ \ 1.68 const typeof(&(ptr)->field) _x = &(hnd).p->field; \ 1.69 - const typeof(&(ptr)->field) _y = &(ptr)->field; \ 1.70 + typeof(&(ptr)->field) _y = &(ptr)->field; \ 1.71 is_hvm_vcpu(current) ? \ 1.72 - copy_from_user_hvm(_x, _y, sizeof(*_x)) : \ 1.73 + copy_from_user_hvm(_y, _x, sizeof(*_x)) : \ 1.74 __copy_from_user(_y, _x, sizeof(*_x)); \ 1.75 }) 1.76