VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/tstProg-1.c@ 1151

Last change on this file since 1151 was 23, checked in by vboxsync, 18 years ago

string.h & stdio.h + header cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1/* $Id: tstProg-1.c 23 2007-01-15 14:08:28Z vboxsync $ */
2/** @file
3 * VMM - Test program.
4 *
5 * This program will loop for ever constantly checking its state.
6 */
7
8/*
9 * Copyright (C) 2006 InnoTek Systemberatung GmbH
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License as published by the Free Software Foundation,
15 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
16 * distribution. VirtualBox OSE is distributed in the hope that it will
17 * be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * If you received this file as part of a commercial VirtualBox
20 * distribution, then only the terms of your commercial VirtualBox
21 * license agreement apply instead of the previous paragraph.
22 */
23
24/*******************************************************************************
25* Header Files *
26*******************************************************************************/
27#include "tstHelp.h"
28#include <stdio.h>
29
30DECLASM(int) tstProg1ForeverAsm(PCPUMCTX pCtxOrg, PCPUMCTX pCtxCur);
31
32CPUMCTX ctx1;
33CPUMCTX ctx2;
34
35
36int main(int argc, char **argv)
37{
38 int i;
39 int rc;
40
41 /*
42 * Dump input and name and such.
43 */
44 printf("*** tstProg-1\n");
45 printf("%d Arguments:\n", argc);
46 for (i = 0; i < argc; i++)
47 printf("%d: %s\n", i, argv[i]);
48/*
49 printf("CPUMCTX.fpu is at %d\n", RT_OFFSETOF(CPUMCTX, fpu));
50 printf("CPUMCTX.eax is at %d\n", RT_OFFSETOF(CPUMCTX, eax));
51 printf("CPUMCTX.ebx is at %d\n", RT_OFFSETOF(CPUMCTX, ebx));
52 printf("CPUMCTX.edx is at %d\n", RT_OFFSETOF(CPUMCTX, edx));
53 printf("CPUMCTX.ecx is at %d\n", RT_OFFSETOF(CPUMCTX, ecx));
54 printf("CPUMCTX.eip is at %d\n", RT_OFFSETOF(CPUMCTX, eip));
55 printf("CPUMCTX.cs is at %d\n", RT_OFFSETOF(CPUMCTX, cs));
56 printf("CPUMCTX.ds is at %d\n", RT_OFFSETOF(CPUMCTX, ds));
57 printf("CPUMCTX.fs is at %d\n", RT_OFFSETOF(CPUMCTX, fs));
58 printf("CPUMCTX.eflags is at %d\n", RT_OFFSETOF(CPUMCTX, eflags));
59 printf("CPUMCTX.cr0 is at %d\n", RT_OFFSETOF(CPUMCTX, cr0));
60 printf("CPUMCTX.dr0 is at %d\n", RT_OFFSETOF(CPUMCTX, dr0));
61 */
62
63 /*
64 * This test program loops for ever doing 'nop'.
65 */
66 ctx1.cr0 = 1;
67 ctx2.cr0 = 1;
68 rc = tstProg1ForeverAsm(&ctx1, &ctx2);
69 tstDumpCtx(&ctx1, "Expected context.");
70 tstDumpCtx(&ctx2, "Actual context...");
71 printf("rc=%#x\n", rc);
72 if ((rc & 0xffff) >= 5 && (rc & 1))
73 {
74 int off = (rc & 0xffff) - 5;
75 printf("difference at offset %d (%#x) %#x != %#x iterations=%d\n", off, off,
76 ((uint32_t*)&ctx1)[off / sizeof(uint32_t)],
77 ((uint32_t*)&ctx2)[off / sizeof(uint32_t)],
78 rc >> 16);
79 }
80 return 1;
81}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette