ia64/xen-unstable

changeset 6117:2b9e3795a523

Support rebooting VMX domains

Signed-off-by: Ke Yu <ke.yu@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Aug 11 21:03:16 2005 +0000 (2005-08-11)
parents fb619858dfa9
children 3255b59ab616
files tools/ioemu/target-i386-dm/helper2.c tools/ioemu/vl.c tools/ioemu/vl.h
line diff
     1.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Thu Aug 11 21:02:51 2005 +0000
     1.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Thu Aug 11 21:03:16 2005 +0000
     1.3 @@ -55,6 +55,7 @@
     1.4  #include "vl.h"
     1.5  
     1.6  shared_iopage_t *shared_page = NULL;
     1.7 +extern int reset_requested;
     1.8  
     1.9  CPUX86State *cpu_86_init(void)
    1.10  {
    1.11 @@ -349,6 +350,10 @@ int main_loop(void)
    1.12                      if (shutdown_requested) {
    1.13                          break;
    1.14                      }
    1.15 +                    if (reset_requested){
    1.16 +                        qemu_system_reset();
    1.17 +                        reset_requested = 0;
    1.18 +                    }
    1.19                  }
    1.20  
    1.21  		/* Wait up to one seconds. */
    1.22 @@ -394,13 +399,26 @@ int main_loop(void)
    1.23  	return 0;
    1.24  }
    1.25  
    1.26 +static void
    1.27 +qemu_vmx_reset(void *unused)
    1.28 +{
    1.29 +    char cmd[255];
    1.30 +    extern int domid;
    1.31 +
    1.32 +    /* pause domain first, to avoid repeated reboot request*/ 
    1.33 +    xc_domain_pause (xc_handle, domid);
    1.34 +
    1.35 +    sprintf(cmd,"xm shutdown -R %d", domid);
    1.36 +    system (cmd);
    1.37 +}
    1.38 +
    1.39  CPUState *
    1.40  cpu_init()
    1.41  {
    1.42  	CPUX86State *env;
    1.43        
    1.44          cpu_exec_init();
    1.45 -
    1.46 +        qemu_register_reset(qemu_vmx_reset, NULL);
    1.47  	env = malloc(sizeof(CPUX86State));
    1.48  	if (!env)
    1.49  		return NULL;
    1.50 @@ -427,3 +445,4 @@ cpu_init()
    1.51  
    1.52  	return env;
    1.53  }
    1.54 +
     2.1 --- a/tools/ioemu/vl.c	Thu Aug 11 21:02:51 2005 +0000
     2.2 +++ b/tools/ioemu/vl.c	Thu Aug 11 21:03:16 2005 +0000
     2.3 @@ -2030,7 +2030,7 @@ typedef struct QEMUResetEntry {
     2.4  } QEMUResetEntry;
     2.5  
     2.6  static QEMUResetEntry *first_reset_entry;
     2.7 -static int reset_requested;
     2.8 +int reset_requested;
     2.9  int shutdown_requested;
    2.10  
    2.11  void qemu_register_reset(QEMUResetHandler *func, void *opaque)
     3.1 --- a/tools/ioemu/vl.h	Thu Aug 11 21:02:51 2005 +0000
     3.2 +++ b/tools/ioemu/vl.h	Thu Aug 11 21:03:16 2005 +0000
     3.3 @@ -107,6 +107,7 @@ typedef void QEMUResetHandler(void *opaq
     3.4  
     3.5  void qemu_register_reset(QEMUResetHandler *func, void *opaque);
     3.6  void qemu_system_reset_request(void);
     3.7 +void qemu_system_reset(void);
     3.8  void qemu_system_shutdown_request(void);
     3.9  
    3.10  void main_loop_wait(int timeout);