/****************************************************************************** * hypercall.h * * Linux-specific hypervisor handling. * * Copyright (c) 2002-2004, K A Fraser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE.
*/
/* * The hypercall asms have to meet several constraints: * - Work on 32- and 64-bit. * The two architectures put their arguments in different sets of * registers. * * - Work around asm syntax quirks * It isn't possible to specify one of the rNN registers in a * constraint, so we use explicit register variables to get the * args into the right place. * * - Mark all registers as potentially clobbered * Even unused parameters can be clobbered by the hypervisor, so we * need to make sure gcc knows it. * * - Avoid compiler bugs. * This is the tricky part. Because x86_32 has such a constrained * register set, gcc versions below 4.3 have trouble generating * code when all the arg registers and memory are trashed by the * asm. There are syntactically simpler ways of achieving the * semantics below, but they cause the compiler to crash. * * The only combination I found which works is: * - assign the __argX variables first * - list all actually used parameters as "+r" (__argX) * - clobber the rest * * The result certainly isn't pretty, and it really shows up cpp's * weakness as a macro language. Sorry. (But let's just give thanks * there aren't more than 5 arguments...)
*/
static __always_inline void __xen_stac(void)
{ /* * Suppress objtool seeing the STAC/CLAC and getting confused about it * calling random code with AC=1.
*/ asmvolatile(ASM_STAC_UNSAFE ::: "memory", "flags");
}
/* * For a PV guest the tools require that the start_info mfn be * present in rdx/edx when the hypercall is made. Per the * hypercall calling convention this is the third hypercall * argument, which is start_info_mfn here.
*/ return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.