return Pystr;
}
-#if defined(__i386__) || defined(__x86_64__)
-static void pyxc_dom_extract_cpuid(PyObject *config,
- char **regs)
-{
- const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" };
- PyObject *obj;
- int i;
-
- memset(regs, 0, 4*sizeof(*regs));
-
- if ( !PyDict_Check(config) )
- return;
-
- for ( i = 0; i < 4; i++ )
- if ( (obj = PyDict_GetItemString(config, regs_extract[i])) != NULL )
- regs[i] = PyBytes_AS_STRING(obj);
-}
-
-static PyObject *pyxc_create_cpuid_dict(char **regs)
-{
- const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" };
- PyObject *dict;
- int i;
-
- dict = PyDict_New();
- for ( i = 0; i < 4; i++ )
- {
- if ( regs[i] == NULL )
- continue;
- PyDict_SetItemString(dict, regs_extract[i],
- PyBytes_FromString(regs[i]));
- free(regs[i]);
- regs[i] = NULL;
- }
- return dict;
-}
-
-static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self,
- PyObject *args)
-{
- int domid;
-
- if ( !PyArg_ParseTuple(args, "i", &domid) )
- return NULL;
-
- if ( xc_cpuid_apply_policy(self->xc_handle, domid, NULL, 0) )
- return pyxc_error_to_exception(self->xc_handle);
-
- Py_INCREF(zero);
- return zero;
-}
-
-
-static PyObject *pyxc_dom_set_cpuid(XcObject *self,
- PyObject *args)
-{
- PyObject *sub_input, *config;
- unsigned int domid, input[2];
- char *regs[4], *regs_transform[4];
-
- if ( !PyArg_ParseTuple(args, "IIOO", &domid,
- &input[0], &sub_input, &config) )
- return NULL;
-
- pyxc_dom_extract_cpuid(config, regs);
-
- input[1] = XEN_CPUID_INPUT_UNUSED;
- if ( PyLong_Check(sub_input) )
- input[1] = PyLong_AsUnsignedLong(sub_input);
-
- if ( xc_cpuid_set(self->xc_handle, domid, input, (const char **)regs,
- regs_transform) )
- return pyxc_error_to_exception(self->xc_handle);
-
- return pyxc_create_cpuid_dict(regs_transform);
-}
-#endif /* __i386__ || __x86_64__ */
-
static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
PyObject *args,
PyObject *kwds)
"Inject debug keys into Xen.\n"
" keys [str]: String of keys to inject.\n" },
-#if defined(__i386__) || defined(__x86_64__)
- { "domain_set_cpuid",
- (PyCFunction)pyxc_dom_set_cpuid,
- METH_VARARGS, "\n"
- "Set cpuid response for an input and a domain.\n"
- " dom [int]: Identifier of domain.\n"
- " input [long]: Input for cpuid instruction (eax)\n"
- " sub_input [long]: Second input (optional, may be None) for cpuid "
- " instruction (ecx)\n"
- " config [dict]: Dictionary of register\n\n"
- "Returns: [int] 0 on success; exception on error.\n" },
-
- { "domain_set_policy_cpuid",
- (PyCFunction)pyxc_dom_set_policy_cpuid,
- METH_VARARGS, "\n"
- "Set the default cpuid policy for a domain.\n"
- " dom [int]: Identifier of domain.\n\n"
- "Returns: [int] 0 on success; exception on error.\n" },
-#endif
-
{ "dom_set_memshr",
(PyCFunction)pyxc_dom_set_memshr,
METH_VARARGS, "\n"