tstGlobalConfig.cpp revision 78edef1df590edefed7cef91b6bcbf4d84f79947
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Ring-3 Management program for the GCFGM mock-up.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Copyright (C) 2007 Sun Microsystems, Inc.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * available from http://www.virtualbox.org. This file is free software;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * you can redistribute it and/or modify it under the terms of the GNU
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * General Public License (GPL) as published by the Free Software
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * additional information or have any questions.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/*******************************************************************************
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync* Header Files *
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync*******************************************************************************/
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Prints the usage and returns 1.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @return 1
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncstatic int Usage(void)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("usage: tstGlobalConfig <value-name> [new value]\n");
b34f0f200ed0778053a2a1d93381c2c6b60cb2d5vboxsync * Parse args, building the request as we do so.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync /* arg[1] = szName */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("syntax error: malformed name '%s'\n", argv[1]);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("syntax error: the name is too long. (max %zu chars)\n", argv[1], sizeof(Req.szName) - 1);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync /* argv[2] = u64SetValue; optional */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync int rc = RTStrToUInt64Ex(argv[2], &pszNext, 0, &Req.u64Value);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("syntax error: '%s' didn't convert successfully to a number. (%Rrc,'%s')\n", argv[2], rc, pszNext);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Open the session, load ring-0 and issue the request.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("tstGlobalConfig: SUPR3Init -> %Rrc\n", rc);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync rc = SUPCallVMMR0Ex(NIL_RTR0PTR, enmOp, 0, &Req.Hdr);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("%s = %RU64 (%#RX64)\n", Req.szName, Req.u64Value, Req.u64Value);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("Successfully set %s = %RU64 (%#RX64)\n", Req.szName, Req.u64Value, Req.u64Value);
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync RTPrintf("error: Failed to query '%s', rc=%Rrc\n", Req.szName, rc);