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

[Xen-devel] [PATCH] rename and clarify NR_hypercalls


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Muli Ben-Yehuda <mulix@xxxxxxxxx>
  • Date: Mon, 10 Apr 2006 19:14:07 +0300
  • Delivery-date: Mon, 10 Apr 2006 09:15:21 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

This patch makes it obvious that NR_hypercalls has to be power-of-2
and renames it to MAX_HYPERCALL_NUMBER, which is what it really is.

Signed-off-by: Muli Ben-Yehuda <mulix@xxxxxxxxx>

diff -Naurp -X /home/muli/w/dontdiff hg/xen/arch/x86/x86_32/entry.S 
nrsys/xen/arch/x86/x86_32/entry.S
--- hg/xen/arch/x86/x86_32/entry.S      2006-04-09 21:43:31.000000000 +0300
+++ nrsys/xen/arch/x86/x86_32/entry.S   2006-04-10 19:03:32.000000000 +0300
@@ -168,7 +168,7 @@ ENTRY(hypercall)
        SAVE_ALL(b)
         sti
         GET_CURRENT(%ebx)
-        andl $(NR_hypercalls-1),%eax
+        andl $(MAX_HYPERCALL_NUMBER-1),%eax
         PERFC_INCR(PERFC_hypercalls, %eax)
 #ifndef NDEBUG
         /* Deliberately corrupt parameter regs not used by this hypercall. */
@@ -646,7 +646,7 @@ ENTRY(hypercall_table)
         .long do_arch_sched_op
         .long do_callback_op        /* 30 */
         .long do_xenoprof_op
-        .rept NR_hypercalls-((.-hypercall_table)/4)
+        .rept MAX_HYPERCALL_NUMBER-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
 
@@ -683,6 +683,6 @@ ENTRY(hypercall_args_table)
         .byte 2 /* do_arch_sched_op     */
         .byte 2 /* do_callback_op       */  /* 30 */
         .byte 3 /* do_xenoprof_op       */
-        .rept NR_hypercalls-(.-hypercall_args_table)
+        .rept MAX_HYPERCALL_NUMBER-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
diff -Naurp -X /home/muli/w/dontdiff hg/xen/arch/x86/x86_32/traps.c 
nrsys/xen/arch/x86/x86_32/traps.c
--- hg/xen/arch/x86/x86_32/traps.c      2006-04-09 21:43:31.000000000 +0300
+++ nrsys/xen/arch/x86/x86_32/traps.c   2006-04-10 19:06:22.000000000 +0300
@@ -425,7 +425,7 @@ static void hypercall_page_initialise_ri
 
     /* Fill in all the transfer points with template machine code. */
 
-    for ( i = 0; i < NR_hypercalls; i++ )
+    for ( i = 0; i < MAX_HYPERCALL_NUMBER; i++ )
     {
         p = (char *)(hypercall_page + (i * 32));
 
diff -Naurp -X /home/muli/w/dontdiff hg/xen/arch/x86/x86_64/entry.S 
nrsys/xen/arch/x86/x86_64/entry.S
--- hg/xen/arch/x86/x86_64/entry.S      2006-04-09 21:43:31.000000000 +0300
+++ nrsys/xen/arch/x86/x86_64/entry.S   2006-04-10 19:03:41.000000000 +0300
@@ -124,7 +124,7 @@ ENTRY(syscall_enter)
 
 /*hypercall:*/
         movq  %r10,%rcx
-        andq  $(NR_hypercalls-1),%rax
+        andq  $(MAX_HYPERCALL_NUMBER-1),%rax
 #ifndef NDEBUG
         /* Deliberately corrupt parameter regs not used by this hypercall. */
         pushq %rdi; pushq %rsi; pushq %rdx; pushq %rcx; pushq %r8 ; pushq %r9 
@@ -136,7 +136,7 @@ ENTRY(syscall_enter)
         rep   stosq
         popq  %r9 ; popq  %r8 ; popq  %rcx; popq  %rdx; popq  %rsi; popq  %rdi
         movq  UREGS_rax(%rsp),%rax
-        andq  $(NR_hypercalls-1),%rax
+        andq  $(MAX_HYPERCALL_NUMBER-1),%rax
         pushq %rax
         pushq UREGS_rip+8(%rsp)
 #endif
@@ -554,7 +554,7 @@ ENTRY(hypercall_table)
         .quad do_arch_sched_op
         .quad do_callback_op        /* 30 */
         .quad do_xenoprof_op
-        .rept NR_hypercalls-((.-hypercall_table)/8)
+        .rept MAX_HYPERCALL_NUMBER-((.-hypercall_table)/8)
         .quad do_ni_hypercall
         .endr
 
@@ -591,6 +591,6 @@ ENTRY(hypercall_args_table)
         .byte 2 /* do_arch_sched_op     */
         .byte 2 /* do_callback_op       */  /* 30 */
         .byte 3 /* do_xenoprof_op       */
-        .rept NR_hypercalls-(.-hypercall_args_table)
+        .rept MAX_HYPERCALL_NUMBER-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
diff -Naurp -X /home/muli/w/dontdiff hg/xen/include/asm-x86/config.h 
nrsys/xen/include/asm-x86/config.h
--- hg/xen/include/asm-x86/config.h     2006-04-09 21:43:32.000000000 +0300
+++ nrsys/xen/include/asm-x86/config.h  2006-04-10 19:02:49.000000000 +0300
@@ -65,7 +65,7 @@
 
 #define barrier() __asm__ __volatile__("": : :"memory")
 
-#define NR_hypercalls 32
+#define MAX_HYPERCALL_NUMBER (1 << 5)
 
 #ifndef NDEBUG
 #define MEMORY_GUARD
diff -Naurp -X /home/muli/w/dontdiff hg/xen/include/asm-x86/multicall.h 
nrsys/xen/include/asm-x86/multicall.h
--- hg/xen/include/asm-x86/multicall.h  2006-04-09 21:43:33.000000000 +0300
+++ nrsys/xen/include/asm-x86/multicall.h       2006-04-10 19:03:48.000000000 
+0300
@@ -13,7 +13,7 @@
     do {                                                 \
         __asm__ __volatile__ (                           \
             "movq  "STR(MULTICALL_op)"(%0),%%rax; "      \
-            "andq  $("STR(NR_hypercalls)"-1),%%rax; "    \
+            "andq  $("STR(MAX_HYPERCALL_NUMBER)"-1),%%rax; "    \
             "leaq  "STR(hypercall_table)"(%%rip),%%rdi; "\
             "leaq  (%%rdi,%%rax,8),%%rax; "              \
             "movq  "STR(MULTICALL_arg0)"(%0),%%rdi; "    \
@@ -40,7 +40,7 @@
             "pushl "STR(MULTICALL_arg1)"(%0); "        \
             "pushl "STR(MULTICALL_arg0)"(%0); "        \
             "movl  "STR(MULTICALL_op)"(%0),%%eax; "    \
-            "andl  $("STR(NR_hypercalls)"-1),%%eax; "  \
+            "andl  $("STR(MAX_HYPERCALL_NUMBER)"-1),%%eax; "  \
             "call  *hypercall_table(,%%eax,4); "       \
             "movl  %%eax,"STR(MULTICALL_result)"(%0); "\
             "addl  $20,%%esp; "                        \
diff -Naurp -X /home/muli/w/dontdiff hg/xen/include/xen/perfc_defn.h 
nrsys/xen/include/xen/perfc_defn.h
--- hg/xen/include/xen/perfc_defn.h     2006-04-09 21:43:34.000000000 +0300
+++ nrsys/xen/include/xen/perfc_defn.h  2006-04-10 19:03:58.000000000 +0300
@@ -23,7 +23,7 @@ PERFCOUNTER_ARRAY(shm_l4_updates,       
 PERFCOUNTER_ARRAY(snapshot_copies,      "entries copied per snapshot",
                   PERFC_MAX_PT_UPDATES)
 
-PERFCOUNTER_ARRAY(hypercalls,           "hypercalls", NR_hypercalls)
+PERFCOUNTER_ARRAY(hypercalls,           "hypercalls", MAX_HYPERCALL_NUMBER)
 PERFCOUNTER_ARRAY(exceptions,           "exceptions", 32)
 
 #define VMX_PERF_EXIT_REASON_SIZE 44



-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/


_______________________________________________
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®.