ia64/xen-unstable

changeset 2647:4c9db2750868

bitkeeper revision 1.1159.1.238 (4170032cpg2cImDyZBh7B0OJ5MVrTg)

It turns out that Xen hypercalls actually clobber the registers used to pass in their arguments (some of the time, at least). Correct the
asm in hypervisor.h to allow for this.
author sos22@douglas.cl.cam.ac.uk
date Fri Oct 15 17:04:44 2004 +0000 (2004-10-15)
parents d1d3b5fb3145
children 7f08e61ddff5 dc59c5558adc
files BitKeeper/etc/logging_ok linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Fri Oct 15 15:32:17 2004 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Fri Oct 15 17:04:44 2004 +0000
     1.3 @@ -47,6 +47,7 @@ smh22@boulderdash.cl.cam.ac.uk
     1.4  smh22@labyrinth.cl.cam.ac.uk
     1.5  smh22@tempest.cl.cam.ac.uk
     1.6  smh22@uridium.cl.cam.ac.uk
     1.7 +sos22@douglas.cl.cam.ac.uk
     1.8  sos22@labyrinth.cl.cam.ac.uk
     1.9  tlh20@elite.cl.cam.ac.uk
    1.10  tlh20@labyrinth.cl.cam.ac.uk
     2.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h	Fri Oct 15 15:32:17 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h	Fri Oct 15 17:04:44 2004 +0000
     2.3 @@ -186,10 +186,13 @@ HYPERVISOR_set_trap_table(
     2.4      trap_info_t *table)
     2.5  {
     2.6      int ret;
     2.7 +    unsigned long ignore;
     2.8 +
     2.9      __asm__ __volatile__ (
    2.10          TRAP_INSTR
    2.11 -        : "=a" (ret) : "0" (__HYPERVISOR_set_trap_table),
    2.12 -        "b" (table) : "memory" );
    2.13 +        : "=a" (ret), "=b" (ignore)
    2.14 +	: "0" (__HYPERVISOR_set_trap_table), "1" (table)
    2.15 +	: "memory" );
    2.16  
    2.17      return ret;
    2.18  }
    2.19 @@ -199,10 +202,14 @@ HYPERVISOR_mmu_update(
    2.20      mmu_update_t *req, int count, int *success_count)
    2.21  {
    2.22      int ret;
    2.23 +    unsigned long ign1, ign2, ign3;
    2.24 +
    2.25      __asm__ __volatile__ (
    2.26          TRAP_INSTR
    2.27 -        : "=a" (ret) : "0" (__HYPERVISOR_mmu_update), 
    2.28 -        "b" (req), "c" (count), "d" (success_count) : "memory" );
    2.29 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
    2.30 +	: "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
    2.31 +	  "3" (success_count)
    2.32 +	: "memory" );
    2.33  
    2.34      return ret;
    2.35  }
    2.36 @@ -212,10 +219,13 @@ HYPERVISOR_set_gdt(
    2.37      unsigned long *frame_list, int entries)
    2.38  {
    2.39      int ret;
    2.40 +    unsigned long ign1, ign2;
    2.41 +
    2.42      __asm__ __volatile__ (
    2.43          TRAP_INSTR
    2.44 -        : "=a" (ret) : "0" (__HYPERVISOR_set_gdt), 
    2.45 -        "b" (frame_list), "c" (entries) : "memory" );
    2.46 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
    2.47 +	: "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
    2.48 +	: "memory" );
    2.49  
    2.50  
    2.51      return ret;
    2.52 @@ -226,10 +236,13 @@ HYPERVISOR_stack_switch(
    2.53      unsigned long ss, unsigned long esp)
    2.54  {
    2.55      int ret;
    2.56 +    unsigned long ign1, ign2;
    2.57 +
    2.58      __asm__ __volatile__ (
    2.59          TRAP_INSTR
    2.60 -        : "=a" (ret) : "0" (__HYPERVISOR_stack_switch),
    2.61 -        "b" (ss), "c" (esp) : "memory" );
    2.62 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
    2.63 +	: "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
    2.64 +	: "memory" );
    2.65  
    2.66      return ret;
    2.67  }
    2.68 @@ -240,11 +253,14 @@ HYPERVISOR_set_callbacks(
    2.69      unsigned long failsafe_selector, unsigned long failsafe_address)
    2.70  {
    2.71      int ret;
    2.72 +    unsigned long ign1, ign2, ign3, ign4;
    2.73 +
    2.74      __asm__ __volatile__ (
    2.75          TRAP_INSTR
    2.76 -        : "=a" (ret) : "0" (__HYPERVISOR_set_callbacks),
    2.77 -        "b" (event_selector), "c" (event_address), 
    2.78 -        "d" (failsafe_selector), "S" (failsafe_address) : "memory" );
    2.79 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    2.80 +	: "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
    2.81 +	  "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
    2.82 +	: "memory" );
    2.83  
    2.84      return ret;
    2.85  }
    2.86 @@ -266,10 +282,13 @@ HYPERVISOR_yield(
    2.87      void)
    2.88  {
    2.89      int ret;
    2.90 +    unsigned long ign;
    2.91 +
    2.92      __asm__ __volatile__ (
    2.93          TRAP_INSTR
    2.94 -        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
    2.95 -        "b" (SCHEDOP_yield) : "memory" );
    2.96 +        : "=a" (ret), "=b" (ign)
    2.97 +	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
    2.98 +	: "memory" );
    2.99  
   2.100      return ret;
   2.101  }
   2.102 @@ -279,10 +298,12 @@ HYPERVISOR_block(
   2.103      void)
   2.104  {
   2.105      int ret;
   2.106 +    unsigned long ign1;
   2.107      __asm__ __volatile__ (
   2.108          TRAP_INSTR
   2.109 -        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
   2.110 -        "b" (SCHEDOP_block) : "memory" );
   2.111 +        : "=a" (ret), "=b" (ign1)
   2.112 +	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
   2.113 +	: "memory" );
   2.114  
   2.115      return ret;
   2.116  }
   2.117 @@ -292,10 +313,12 @@ HYPERVISOR_shutdown(
   2.118      void)
   2.119  {
   2.120      int ret;
   2.121 +    unsigned long ign1;
   2.122      __asm__ __volatile__ (
   2.123          TRAP_INSTR
   2.124 -        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
   2.125 -        "b" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
   2.126 +        : "=a" (ret), "=b" (ign1)
   2.127 +	: "0" (__HYPERVISOR_sched_op),
   2.128 +	  "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
   2.129          : "memory" );
   2.130  
   2.131      return ret;
   2.132 @@ -306,10 +329,12 @@ HYPERVISOR_reboot(
   2.133      void)
   2.134  {
   2.135      int ret;
   2.136 +    unsigned long ign1;
   2.137      __asm__ __volatile__ (
   2.138          TRAP_INSTR
   2.139 -        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
   2.140 -        "b" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
   2.141 +        : "=a" (ret), "=b" (ign1)
   2.142 +	: "0" (__HYPERVISOR_sched_op),
   2.143 +	  "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
   2.144          : "memory" );
   2.145  
   2.146      return ret;
   2.147 @@ -320,12 +345,15 @@ HYPERVISOR_suspend(
   2.148      unsigned long srec)
   2.149  {
   2.150      int ret;
   2.151 +    unsigned long ign1, ign2;
   2.152 +
   2.153      /* NB. On suspend, control software expects a suspend record in %esi. */
   2.154      __asm__ __volatile__ (
   2.155          TRAP_INSTR
   2.156 -        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
   2.157 +        : "=a" (ret), "=b" (ign1), "=S" (ign2)
   2.158 +	: "0" (__HYPERVISOR_sched_op),
   2.159          "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)), 
   2.160 -        "S" (srec) : "memory" );
   2.161 +        "S" (srec) : "memory");
   2.162  
   2.163      return ret;
   2.164  }
   2.165 @@ -337,10 +365,13 @@ HYPERVISOR_set_timer_op(
   2.166      int ret;
   2.167      unsigned long timeout_hi = (unsigned long)(timeout>>32);
   2.168      unsigned long timeout_lo = (unsigned long)timeout;
   2.169 +    unsigned long ign1, ign2;
   2.170 +
   2.171      __asm__ __volatile__ (
   2.172          TRAP_INSTR
   2.173 -        : "=a" (ret) : "0" (__HYPERVISOR_set_timer_op),
   2.174 -        "b" (timeout_hi), "c" (timeout_lo) : "memory" );
   2.175 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   2.176 +	: "0" (__HYPERVISOR_set_timer_op), "b" (timeout_hi), "c" (timeout_lo)
   2.177 +	: "memory");
   2.178  
   2.179      return ret;
   2.180  }
   2.181 @@ -350,11 +381,14 @@ HYPERVISOR_dom0_op(
   2.182      dom0_op_t *dom0_op)
   2.183  {
   2.184      int ret;
   2.185 +    unsigned long ign1;
   2.186 +
   2.187      dom0_op->interface_version = DOM0_INTERFACE_VERSION;
   2.188      __asm__ __volatile__ (
   2.189          TRAP_INSTR
   2.190 -        : "=a" (ret) : "0" (__HYPERVISOR_dom0_op),
   2.191 -        "b" (dom0_op) : "memory" );
   2.192 +        : "=a" (ret), "=b" (ign1)
   2.193 +	: "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
   2.194 +	: "memory");
   2.195  
   2.196      return ret;
   2.197  }
   2.198 @@ -364,10 +398,12 @@ HYPERVISOR_set_debugreg(
   2.199      int reg, unsigned long value)
   2.200  {
   2.201      int ret;
   2.202 +    unsigned long ign1, ign2;
   2.203      __asm__ __volatile__ (
   2.204          TRAP_INSTR
   2.205 -        : "=a" (ret) : "0" (__HYPERVISOR_set_debugreg),
   2.206 -        "b" (reg), "c" (value) : "memory" );
   2.207 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   2.208 +	: "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
   2.209 +	: "memory" );
   2.210  
   2.211      return ret;
   2.212  }
   2.213 @@ -377,10 +413,12 @@ HYPERVISOR_get_debugreg(
   2.214      int reg)
   2.215  {
   2.216      unsigned long ret;
   2.217 +    unsigned long ign;
   2.218      __asm__ __volatile__ (
   2.219          TRAP_INSTR
   2.220 -        : "=a" (ret) : "0" (__HYPERVISOR_get_debugreg),
   2.221 -        "b" (reg) : "memory" );
   2.222 +        : "=a" (ret), "=b" (ign)
   2.223 +	: "0" (__HYPERVISOR_get_debugreg), "1" (reg)
   2.224 +	: "memory" );
   2.225  
   2.226      return ret;
   2.227  }
   2.228 @@ -390,10 +428,14 @@ HYPERVISOR_update_descriptor(
   2.229      unsigned long ma, unsigned long word1, unsigned long word2)
   2.230  {
   2.231      int ret;
   2.232 +    unsigned long ign1, ign2, ign3;
   2.233 +
   2.234      __asm__ __volatile__ (
   2.235          TRAP_INSTR
   2.236 -        : "=a" (ret) : "0" (__HYPERVISOR_update_descriptor), 
   2.237 -        "b" (ma), "c" (word1), "d" (word2) : "memory" );
   2.238 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
   2.239 +	: "0" (__HYPERVISOR_update_descriptor), "1" (ma), "2" (word1),
   2.240 +	  "3" (word2)
   2.241 +	: "memory" );
   2.242  
   2.243      return ret;
   2.244  }
   2.245 @@ -403,10 +445,13 @@ HYPERVISOR_set_fast_trap(
   2.246      int idx)
   2.247  {
   2.248      int ret;
   2.249 +    unsigned long ign;
   2.250 +
   2.251      __asm__ __volatile__ (
   2.252          TRAP_INSTR
   2.253 -        : "=a" (ret) : "0" (__HYPERVISOR_set_fast_trap), 
   2.254 -        "b" (idx) : "memory" );
   2.255 +        : "=a" (ret), "=b" (ign)
   2.256 +	: "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
   2.257 +	: "memory" );
   2.258  
   2.259      return ret;
   2.260  }
   2.261 @@ -417,11 +462,14 @@ HYPERVISOR_dom_mem_op(
   2.262      unsigned long nr_extents, unsigned int extent_order)
   2.263  {
   2.264      int ret;
   2.265 +    unsigned long ign1, ign2, ign3, ign4, ign5;
   2.266 +
   2.267      __asm__ __volatile__ (
   2.268          TRAP_INSTR
   2.269 -        : "=a" (ret) : "0" (__HYPERVISOR_dom_mem_op),
   2.270 -        "b" (op), "c" (extent_list), "d" (nr_extents), "S" (extent_order),
   2.271 -	"D" (DOMID_SELF)
   2.272 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
   2.273 +	  "=D" (ign5)
   2.274 +	: "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
   2.275 +	  "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
   2.276          : "memory" );
   2.277  
   2.278      return ret;
   2.279 @@ -432,10 +480,13 @@ HYPERVISOR_multicall(
   2.280      void *call_list, int nr_calls)
   2.281  {
   2.282      int ret;
   2.283 +    unsigned long ign1, ign2;
   2.284 +
   2.285      __asm__ __volatile__ (
   2.286          TRAP_INSTR
   2.287 -        : "=a" (ret) : "0" (__HYPERVISOR_multicall),
   2.288 -        "b" (call_list), "c" (nr_calls) : "memory" );
   2.289 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   2.290 +	: "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
   2.291 +	: "memory" );
   2.292  
   2.293      return ret;
   2.294  }
   2.295 @@ -445,10 +496,14 @@ HYPERVISOR_update_va_mapping(
   2.296      unsigned long page_nr, pte_t new_val, unsigned long flags)
   2.297  {
   2.298      int ret;
   2.299 +    unsigned long ign1, ign2, ign3;
   2.300 +
   2.301      __asm__ __volatile__ (
   2.302          TRAP_INSTR
   2.303 -        : "=a" (ret) : "0" (__HYPERVISOR_update_va_mapping), 
   2.304 -        "b" (page_nr), "c" ((new_val).pte_low), "d" (flags) : "memory" );
   2.305 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
   2.306 +	: "0" (__HYPERVISOR_update_va_mapping), 
   2.307 +          "1" (page_nr), "2" ((new_val).pte_low), "3" (flags)
   2.308 +	: "memory" );
   2.309  
   2.310      if ( unlikely(ret < 0) )
   2.311      {
   2.312 @@ -465,10 +520,12 @@ HYPERVISOR_event_channel_op(
   2.313      void *op)
   2.314  {
   2.315      int ret;
   2.316 +    unsigned long ignore;
   2.317      __asm__ __volatile__ (
   2.318          TRAP_INSTR
   2.319 -        : "=a" (ret) : "0" (__HYPERVISOR_event_channel_op),
   2.320 -        "b" (op) : "memory" );
   2.321 +        : "=a" (ret), "=b" (ignore)
   2.322 +	: "0" (__HYPERVISOR_event_channel_op), "1" (op)
   2.323 +	: "memory" );
   2.324  
   2.325      return ret;
   2.326  }
   2.327 @@ -478,10 +535,13 @@ HYPERVISOR_xen_version(
   2.328      int cmd)
   2.329  {
   2.330      int ret;
   2.331 +    unsigned long ignore;
   2.332 +
   2.333      __asm__ __volatile__ (
   2.334          TRAP_INSTR
   2.335 -        : "=a" (ret) : "0" (__HYPERVISOR_xen_version), 
   2.336 -        "b" (cmd) : "memory" );
   2.337 +        : "=a" (ret), "=b" (ignore)
   2.338 +	: "0" (__HYPERVISOR_xen_version), "1" (cmd)
   2.339 +	: "memory" );
   2.340  
   2.341      return ret;
   2.342  }
   2.343 @@ -491,10 +551,12 @@ HYPERVISOR_console_io(
   2.344      int cmd, int count, char *str)
   2.345  {
   2.346      int ret;
   2.347 +    unsigned long ign1, ign2, ign3;
   2.348      __asm__ __volatile__ (
   2.349          TRAP_INSTR
   2.350 -        : "=a" (ret) : "0" (__HYPERVISOR_console_io),
   2.351 -        "b" (cmd), "c" (count), "d" (str) : "memory" );
   2.352 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
   2.353 +	: "0" (__HYPERVISOR_console_io), "1" (cmd), "2" (count), "3" (str)
   2.354 +	: "memory" );
   2.355  
   2.356      return ret;
   2.357  }
   2.358 @@ -504,10 +566,13 @@ HYPERVISOR_physdev_op(
   2.359      void *physdev_op)
   2.360  {
   2.361      int ret;
   2.362 +    unsigned long ign;
   2.363 +
   2.364      __asm__ __volatile__ (
   2.365          TRAP_INSTR
   2.366 -        : "=a" (ret) : "0" (__HYPERVISOR_physdev_op),
   2.367 -        "b" (physdev_op) : "memory" );
   2.368 +        : "=a" (ret), "=b" (ign)
   2.369 +	: "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
   2.370 +	: "memory" );
   2.371  
   2.372      return ret;
   2.373  }
   2.374 @@ -517,10 +582,13 @@ HYPERVISOR_grant_table_op(
   2.375      unsigned int cmd, void *uop, unsigned int count)
   2.376  {
   2.377      int ret;
   2.378 +    unsigned long ign1, ign2, ign3;
   2.379 +
   2.380      __asm__ __volatile__ (
   2.381          TRAP_INSTR
   2.382 -        : "=a" (ret) : "0" (__HYPERVISOR_grant_table_op),
   2.383 -        "b" (cmd), "c" (count), "d" (uop) : "memory" );
   2.384 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
   2.385 +	: "0" (__HYPERVISOR_grant_table_op), "1" (cmd), "2" (count), "3" (uop)
   2.386 +	: "memory" );
   2.387  
   2.388      return ret;
   2.389  }
   2.390 @@ -530,10 +598,13 @@ HYPERVISOR_update_va_mapping_otherdomain
   2.391      unsigned long page_nr, pte_t new_val, unsigned long flags, domid_t domid)
   2.392  {
   2.393      int ret;
   2.394 +    unsigned long ign1, ign2, ign3, ign4;
   2.395 +
   2.396      __asm__ __volatile__ (
   2.397          TRAP_INSTR
   2.398 -        : "=a" (ret) : "0" (__HYPERVISOR_update_va_mapping_otherdomain), 
   2.399 -        "b" (page_nr), "c" ((new_val).pte_low), "d" (flags), "S" (domid) :
   2.400 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
   2.401 +	: "0" (__HYPERVISOR_update_va_mapping_otherdomain),
   2.402 +          "1" (page_nr), "2" ((new_val).pte_low), "3" (flags), "4" (domid) :
   2.403          "memory" );
   2.404      
   2.405      return ret;
   2.406 @@ -544,10 +615,13 @@ HYPERVISOR_vm_assist(
   2.407      unsigned int cmd, unsigned int type)
   2.408  {
   2.409      int ret;
   2.410 +    unsigned long ign1, ign2;
   2.411 +
   2.412      __asm__ __volatile__ (
   2.413          TRAP_INSTR
   2.414 -        : "=a" (ret) : "0" (__HYPERVISOR_vm_assist),
   2.415 -        "b" (cmd), "c" (type) : "memory" );
   2.416 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   2.417 +	: "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
   2.418 +	: "memory" );
   2.419  
   2.420      return ret;
   2.421  }