]> pd.if.org Git - mmurtl/blob - msamples/othersrc/memtest.c
autocommit for file dated 1995-02-09 16:01:28
[mmurtl] / msamples / othersrc / memtest.c
1 /* Test memory Aliasing for MMURTL V1.0 */\r
2 /*  Copyright (c) 1994 R.A. Burgess     */\r
3 /*  All Rights Reserved                 */\r
4 \r
5 /*\r
6 This simple program shows how memory aliasing works in MMURTL.\r
7 To build this, use MakeIt.bat in DOS, or use CM32 and DASM:\r
8   CM32 MemTest.c\r
9   DASM MemTest.atf\r
10 */\r
11 \r
12 \r
13 #define U32 unsigned long\r
14 #define S32 long\r
15 #define U16 unsigned int\r
16 #define S16 int\r
17 #define U8 unsigned char\r
18 #define S8 char\r
19 #define TRUE 1\r
20 #define FALSE 0\r
21 \r
22 \r
23 #include <stdio.h>\r
24 #include <string.h>\r
25 #include <ctype.h>\r
26 #include <stdlib.h>\r
27 \r
28 /* Includes for OS public calls and structures */\r
29 \r
30 #include "\OSSource\MMemory.h"\r
31 #include "\OSSource\MKbd.h"\r
32 #include "\OSSource\MStatus.h"\r
33 \r
34 /**************** BEGIN Data ********************/\r
35 \r
36 char *Alias;\r
37 U32 AliasPhy;\r
38 U32 OSPhy;\r
39 \r
40 /**************** BEGIN Code ********************/\r
41 \r
42 void main(U32 argc, U8 argv[])\r
43 {\r
44 unsigned long erc, key;\r
45 \r
46         erc = GetPhyAdd(1, 3072, &OSPhy);\r
47         if (erc)\r
48                 printf("ERROR %d on GetPhyAdd.\r\n", erc);\r
49 \r
50         printf("Aliasing Job 1 Linear Address %08x\r\n", 3072);\r
51         printf("Physical Address is           %08x\r\n", OSPhy);\r
52 \r
53         erc = AliasMem(3072, 8000, 1, &Alias);\r
54 \r
55         if (erc)\r
56                 printf("ERROR %d on AliasMem.\r\n", erc);\r
57 \r
58         erc = GetPhyAdd(3, Alias, &AliasPhy);\r
59 \r
60         if (erc)\r
61                 printf("ERROR %d on GetPhyAdd.\r\n", erc);\r
62 \r
63         printf("Alias Linear address is   %08x\r\n", Alias);\r
64         printf("Physical Address is       %08x\r\n", AliasPhy);\r
65 \r
66         printf("Press a key to continue...\r\n");\r
67         ReadKbd(&key, 1);\r
68 \r
69         erc = DeAliasMem(Alias, 8000, 3);\r
70         if (erc)\r
71                 printf("ERROR %d on DeAliasMem.\r\n", erc);\r
72 \r
73         exit(0);\r
74 \r
75 }\r