From: "Jan Beulich" Subject: [PATCH] linux/x86: make hypercall wrapper functions' arguments unsigned where possible Date: Fri, 18 Jan 2008 16:17:36 +0000 Message-ID: <4790DF30.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org .., producing better code on 64-bits (and done on 32-bits for consistency). As usual, written and tested on 2.6.24-rc7 and made apply to the 2.6.18 tree without further testing. Signed-off-by: Jan Beulich Index: head-2007-12-11/include/asm-i386/mach-xen/asm/hypercall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/include/asm-i386/mach-xen/asm/hypercall.h = 2007-12-21 10:19:20.000000000 +0100 +++ head-2007-12-11/include/asm-i386/mach-xen/asm/hypercall.h 2007-12-21 = 10:47:37.000000000 +0100 @@ -132,21 +132,23 @@ HYPERVISOR_set_trap_table( =20 static inline int HYPERVISOR_mmu_update( - mmu_update_t *req, int count, int *success_count, domid_t domid) + mmu_update_t *req, unsigned int count, unsigned int *success_count,= + domid_t domid) { return _hypercall4(int, mmu_update, req, count, success_count, = domid); } =20 static inline int HYPERVISOR_mmuext_op( - struct mmuext_op *op, int count, int *success_count, domid_t = domid) + struct mmuext_op *op, unsigned int count, unsigned int *success_cou= nt, + domid_t domid) { return _hypercall4(int, mmuext_op, op, count, success_count, = domid); } =20 static inline int HYPERVISOR_set_gdt( - unsigned long *frame_list, int entries) + unsigned long *frame_list, unsigned int entries) { return _hypercall2(int, set_gdt, frame_list, entries); } @@ -208,14 +210,14 @@ HYPERVISOR_platform_op( =20 static inline int HYPERVISOR_set_debugreg( - int reg, unsigned long value) + unsigned int reg, unsigned long value) { return _hypercall2(int, set_debugreg, reg, value); } =20 static inline unsigned long HYPERVISOR_get_debugreg( - int reg) + unsigned int reg) { return _hypercall1(unsigned long, get_debugreg, reg); } @@ -236,7 +238,7 @@ HYPERVISOR_memory_op( =20 static inline int HYPERVISOR_multicall( - multicall_entry_t *call_list, int nr_calls) + multicall_entry_t *call_list, unsigned int nr_calls) { return _hypercall2(int, multicall, call_list, nr_calls); } @@ -288,7 +290,7 @@ HYPERVISOR_xen_version( =20 static inline int HYPERVISOR_console_io( - int cmd, int count, char *str) + int cmd, unsigned int count, char *str) { return _hypercall3(int, console_io, cmd, count, str); } Index: head-2007-12-11/include/asm-x86_64/mach-xen/asm/hypercall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/include/asm-x86_64/mach-xen/asm/hypercall.h = 2007-12-21 10:19:16.000000000 +0100 +++ head-2007-12-11/include/asm-x86_64/mach-xen/asm/hypercall.h 2007-12-21 = 10:47:40.000000000 +0100 @@ -138,21 +138,23 @@ HYPERVISOR_set_trap_table( =20 static inline int HYPERVISOR_mmu_update( - mmu_update_t *req, int count, int *success_count, domid_t domid) + mmu_update_t *req, unsigned int count, unsigned int *success_count,= + domid_t domid) { return _hypercall4(int, mmu_update, req, count, success_count, = domid); } =20 static inline int HYPERVISOR_mmuext_op( - struct mmuext_op *op, int count, int *success_count, domid_t = domid) + struct mmuext_op *op, unsigned int count, unsigned int *success_cou= nt, + domid_t domid) { return _hypercall4(int, mmuext_op, op, count, success_count, = domid); } =20 static inline int HYPERVISOR_set_gdt( - unsigned long *frame_list, int entries) + unsigned long *frame_list, unsigned int entries) { return _hypercall2(int, set_gdt, frame_list, entries); } @@ -211,14 +213,14 @@ HYPERVISOR_platform_op( =20 static inline int HYPERVISOR_set_debugreg( - int reg, unsigned long value) + unsigned int reg, unsigned long value) { return _hypercall2(int, set_debugreg, reg, value); } =20 static inline unsigned long HYPERVISOR_get_debugreg( - int reg) + unsigned int reg) { return _hypercall1(unsigned long, get_debugreg, reg); } @@ -239,7 +241,7 @@ HYPERVISOR_memory_op( =20 static inline int HYPERVISOR_multicall( - multicall_entry_t *call_list, int nr_calls) + multicall_entry_t *call_list, unsigned int nr_calls) { return _hypercall2(int, multicall, call_list, nr_calls); } @@ -286,7 +288,7 @@ HYPERVISOR_xen_version( =20 static inline int HYPERVISOR_console_io( - int cmd, int count, char *str) + int cmd, unsigned int count, char *str) { return _hypercall3(int, console_io, cmd, count, str); } Index: head-2007-12-11/include/xen/hypercall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/include/xen/hypercall.h 2007-12-21 = 12:30:40.000000000 +0100 +++ head-2007-12-11/include/xen/hypercall.h 2007-12-21 10:49:56.0000000= 00 +0100 @@ -5,7 +5,7 @@ =20 static inline int HYPERVISOR_multicall_check( - multicall_entry_t *call_list, int nr_calls, + multicall_entry_t *call_list, unsigned int nr_calls, const unsigned long *rc_list) { int rc =3D HYPERVISOR_multicall(call_list, nr_calls); @@ -13,6 +13,7 @@ HYPERVISOR_multicall_check( if (unlikely(rc < 0)) return rc; BUG_ON(rc); + BUG_ON((int)nr_calls < 0); =20 for ( ; nr_calls > 0; --nr_calls, ++call_list) if (unlikely(call_list->result !=3D (rc_list ? *rc_list++ = : 0)))