tools/python: Drop cpuid helpers

These are believed-unused, and the underlying infrastructure is about to be
rewritten completely.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
Andrew Cooper authored and Wei Liu committed 2020-02-10 10:58:07 +00:00
1 parent 69da7d5440
commit 0a9c44486b
1 file changed
-98
-98
View File
@@ -694,84 +694,6 @@ static PyObject *pyxc_get_device_group(XcObject *self,
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)
@@ -2406,26 +2328,6 @@ static PyMethodDef pyxc_methods[] = {
"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"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.