/[dynamips]/upstream/dynamips-0.2.6-RC2/hv_vm.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/dynamips-0.2.6-RC2/hv_vm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.6-RC1/hv_vm.c revision 2 by dpavlin, Sat Oct 6 16:03:58 2007 UTC upstream/dynamips-0.2.6-RC2/hv_vm.c revision 3 by dpavlin, Sat Oct 6 16:05:34 2007 UTC
# Line 43  Line 43 
43  #include "registry.h"  #include "registry.h"
44  #include "hypervisor.h"  #include "hypervisor.h"
45    
46    /* Find the specified CPU */
47    static cpu_mips_t *find_cpu(hypervisor_conn_t *conn,vm_instance_t *vm,
48                                u_int cpu_id)
49    {
50       cpu_mips_t *cpu;
51    
52       cpu = cpu_group_find_id(vm->cpu_group,cpu_id);
53    
54       if (!cpu) {
55          vm_release(vm);
56          hypervisor_send_reply(conn,HSC_ERR_BAD_OBJ,1,"Bad CPU specified");
57          return NULL;
58       }
59      
60       return cpu;
61    }
62    
63  /* Set debugging level */  /* Set debugging level */
64  static int cmd_set_debug_level(hypervisor_conn_t *conn,int argc,char *argv[])  static int cmd_set_debug_level(hypervisor_conn_t *conn,int argc,char *argv[])
65  {  {
# Line 178  static int cmd_set_idle_pc(hypervisor_co Line 195  static int cmd_set_idle_pc(hypervisor_co
195     return(0);     return(0);
196  }  }
197    
198    /* Set the idle PC value when the CPU is online */
199    static int cmd_set_idle_pc_online(hypervisor_conn_t *conn,
200                                      int argc,char *argv[])
201    {
202       vm_instance_t *vm;
203       cpu_mips_t *cpu;
204    
205       if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
206          return(-1);
207    
208       if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
209          return(-1);
210    
211       cpu->idle_pc = strtoull(argv[2],NULL,0);
212    
213       vm_release(vm);
214       hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
215       return(0);
216    }
217    
218    /* Get the idle PC proposals */
219    static int cmd_get_idle_pc_prop(hypervisor_conn_t *conn,int argc,char *argv[])
220    {  
221       vm_instance_t *vm;
222       cpu_mips_t *cpu;
223       int i;
224    
225       if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
226          return(-1);
227    
228       if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
229          return(-1);
230    
231       mips64_get_idling_pc(cpu);
232    
233       for(i=0;i<cpu->idle_pc_prop_count;i++) {
234          hypervisor_send_reply(conn,HSC_INFO_MSG,0,"0x%llx [%d]",
235                                cpu->idle_pc_prop[i].pc,
236                                cpu->idle_pc_prop[i].count);
237       }
238    
239       vm_release(vm);
240       hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
241       return(0);
242    }
243    
244    /* Dump the idle PC proposals */
245    static int cmd_show_idle_pc_prop(hypervisor_conn_t *conn,int argc,char *argv[])
246    {
247       vm_instance_t *vm;
248       cpu_mips_t *cpu;
249       int i;
250    
251       if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
252          return(-1);
253    
254       if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
255          return(-1);
256    
257       for(i=0;i<cpu->idle_pc_prop_count;i++) {
258          hypervisor_send_reply(conn,HSC_INFO_MSG,0,"0x%llx [%d]",
259                                cpu->idle_pc_prop[i].pc,
260                                cpu->idle_pc_prop[i].count);
261       }
262    
263       vm_release(vm);
264       hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
265       return(0);
266    }
267    
268    /* Set CPU idle max value */
269    static int cmd_set_idle_max(hypervisor_conn_t *conn,int argc,char *argv[])
270    {
271       vm_instance_t *vm;
272       cpu_mips_t *cpu;
273    
274       if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
275          return(-1);
276    
277       if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
278          return(-1);
279    
280       cpu->idle_max = atoi(argv[2]);
281    
282       vm_release(vm);
283       hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
284       return(0);
285    }
286    
287    /* Set CPU idle sleep time value */
288    static int cmd_set_idle_sleep_time(hypervisor_conn_t *conn,
289                                       int argc,char *argv[])
290    {
291       vm_instance_t *vm;
292       cpu_mips_t *cpu;
293    
294       if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
295          return(-1);
296    
297       if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
298          return(-1);
299    
300       cpu->idle_sleep_time = atoi(argv[2]);
301    
302       vm_release(vm);
303       hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
304       return(0);
305    }
306    
307  /* Set the exec area size */  /* Set the exec area size */
308  static int cmd_set_exec_area(hypervisor_conn_t *conn,int argc,char *argv[])  static int cmd_set_exec_area(hypervisor_conn_t *conn,int argc,char *argv[])
309  {  {
# Line 438  static hypervisor_cmd_t vm_cmd_array[] = Line 564  static hypervisor_cmd_t vm_cmd_array[] =
564     { "set_disk1", 2, 2, cmd_set_disk1, NULL },     { "set_disk1", 2, 2, cmd_set_disk1, NULL },
565     { "set_conf_reg", 2, 2, cmd_set_conf_reg, NULL },     { "set_conf_reg", 2, 2, cmd_set_conf_reg, NULL },
566     { "set_idle_pc", 2, 2, cmd_set_idle_pc, NULL },     { "set_idle_pc", 2, 2, cmd_set_idle_pc, NULL },
567       { "set_idle_pc_online", 3, 3, cmd_set_idle_pc_online, NULL },
568       { "get_idle_pc_prop", 2, 2, cmd_get_idle_pc_prop, NULL },
569       { "show_idle_pc_prop", 2, 2, cmd_show_idle_pc_prop, NULL },
570       { "set_idle_max", 3, 3, cmd_set_idle_max, NULL },
571       { "set_idle_sleep_time", 3, 3, cmd_set_idle_sleep_time, NULL },
572     { "set_con_tcp_port", 2, 2, cmd_set_con_tcp_port, NULL },     { "set_con_tcp_port", 2, 2, cmd_set_con_tcp_port, NULL },
573     { "set_aux_tcp_port", 2, 2, cmd_set_aux_tcp_port, NULL },     { "set_aux_tcp_port", 2, 2, cmd_set_aux_tcp_port, NULL },
574     { "extract_config", 1, 1, cmd_extract_config, NULL },     { "extract_config", 1, 1, cmd_extract_config, NULL },

Legend:
Removed from v.2  
changed lines
  Added in v.3

  ViewVC Help
Powered by ViewVC 1.1.26