1 |
689 |
jeremybenn |
/* { dg-message "undeclared identifier is reported only once" "reminder for mmu_base" { target *-*-* } 0 } */
|
2 |
|
|
typedef BYTE unsigned char; /* { dg-error "expected" } */
|
3 |
|
|
typedef int item_n;
|
4 |
|
|
typedef int perm_set;
|
5 |
|
|
struct PENT { caddr_t v_addr; };/* { dg-error "unknown type name" } */
|
6 |
|
|
typedef struct PENT prec;
|
7 |
|
|
typedef struct PENT *prec_t;
|
8 |
|
|
prec_t mem_hash;
|
9 |
|
|
BYTE *mem_base; /* { dg-error "unknown type name" } */
|
10 |
|
|
struct PTE {
|
11 |
|
|
BYTE *p_page; /* { dg-error "unknown type name" } */
|
12 |
|
|
perm_set p_perms;
|
13 |
|
|
};
|
14 |
|
|
typedef struct PTE pte;
|
15 |
|
|
struct PTP {
|
16 |
|
|
union {
|
17 |
|
|
struct *PTP p_tablep; /* { dg-error "expected" } */
|
18 |
|
|
struct *PTE p_entry;
|
19 |
|
|
} u;
|
20 |
|
|
int valid;
|
21 |
|
|
};
|
22 |
|
|
typedef struct PTP (u.p_tablep);/* { dg-error "expected" } */
|
23 |
|
|
int pfree=0;
|
24 |
|
|
int pcount=0;
|
25 |
|
|
|
26 |
|
|
void
|
27 |
|
|
mmu_walk_find(va)
|
28 |
|
|
caddr_t va; /* { dg-error "unknown type name" } */
|
29 |
|
|
{
|
30 |
|
|
BYTE *page_addr; /* { dg-error "unknown type name" } */
|
31 |
|
|
if (mmu_base[Level1(va)]->valid==0x0) { /* { dg-error "undeclared" } */
|
32 |
|
|
l1_base = mmu_base[Level1(va)]->(u.p_tablep) = p_alloc(); /* { dg-error "expected|undeclared" } */
|
33 |
|
|
mmu_base[Level1(va)]->valid = 0x3;
|
34 |
|
|
for (idx=0; idx<LEVEL1_ENTRIES; idx++) /* { dg-error "undeclared" } */
|
35 |
|
|
l1_base[idx]->valid = 0x0;
|
36 |
|
|
goto build_level2;
|
37 |
|
|
} else
|
38 |
|
|
l1_base = mmu_base[Level1(va)]->(u.p_tablep); /* { dg-error "expected" } */
|
39 |
|
|
|
40 |
|
|
if (l1_base[Level2(va)]->valid==0x0) {
|
41 |
|
|
build_level2:
|
42 |
|
|
l2_base = l1_base[Level2(va)]->(u.p_tablep) = p_alloc(); /* { dg-error "expected|undeclared" } */
|
43 |
|
|
l1_base[Level2(va)]->valid = 0x3;
|
44 |
|
|
for (idx=0; idx<LEVEL2_ENTRIES; idx++) /* { dg-error "undeclared" } */
|
45 |
|
|
l2_base[idx]->valid=0x0;
|
46 |
|
|
goto build_page; /* { dg-error "used but not defined" } */
|
47 |
|
|
} else
|
48 |
|
|
l2_base = mmu_base[Level2(va)]->(u.p_tablep); /* { dg-error "expected" } */
|
49 |
|
|
|
50 |
|
|
page_addr = l2_base[Level2(va)]->valid;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
void *
|
54 |
|
|
a_translate(va_op, v_addr)
|
55 |
|
|
int va_op;
|
56 |
|
|
caddr_t v_addr; /* { dg-error "unknown type name" } */
|
57 |
|
|
{
|
58 |
|
|
register prec_t bucket;
|
59 |
|
|
register caddr_t p_addr; /* { dg-error "unknown type name" } */
|
60 |
|
|
bucket = mem_hash+((((v_addr)>>ITEMBITS))&hash_mask); /* { dg-error "undeclared" } */
|
61 |
|
|
do {
|
62 |
|
|
if (bucket->v_addr == ((v_addr)>>ITEMBITS) { /* { dg-error "expected|undeclared|no member" } */
|
63 |
|
|
if(!(bucket->perm_set&va_op))
|
64 |
|
|
goto prot_fault;
|
65 |
|
|
return mem_base + v_addr;
|
66 |
|
|
}
|
67 |
|
|
} while((bucket++)->v_addr != ((caddr_t)0)); /* { dg-error "expected|undeclared|no member" } */
|
68 |
|
|
|
69 |
|
|
page_miss:
|
70 |
|
|
p_addr = (--bucket)->p_addr; /* { dg-error "no member" } */
|
71 |
|
|
page_type:
|
72 |
|
|
switch (p_addr) {
|
73 |
|
|
case BUCKET_FULL: /* { dg-error "undeclared" } */
|
74 |
|
|
enlarge_hash_table(mem_hash);
|
75 |
|
|
case((caddr_t)0): /* { dg-error "expected" } */
|
76 |
|
|
p_addr = fill_item_entry(va_op, v_addr);
|
77 |
|
|
goto page_type;
|
78 |
|
|
case((caddr_t)1): /* { dg-error "expected" } */
|
79 |
|
|
default:
|
80 |
|
|
((void)(((0))?0:(__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
|
81 |
|
|
"FALSE", 327, "b.c"), 0)));
|
82 |
|
|
}
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
void
|
86 |
|
|
flush_hash(hasht, hash_size)
|
87 |
|
|
prec_t hasht;
|
88 |
|
|
int hash_size;
|
89 |
|
|
{
|
90 |
|
|
register prec_t bucket;
|
91 |
|
|
register int idx;
|
92 |
|
|
bucket = hasht;
|
93 |
|
|
for(idx=(hash_size*3)-1; idx>=0; idx--) {
|
94 |
|
|
bucket->v_addr = ((caddr_t)0);/* { dg-error "undeclared|expected|no member" } */
|
95 |
|
|
bucket->p_addr = ((caddr_t)0);/* { dg-error "no member|expected" } */
|
96 |
|
|
bucket->perm_set = VA_EMPTY; /* { dg-error "undeclared|no member" } */
|
97 |
|
|
}
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
extern void *calloc(__SIZE_TYPE__, __SIZE_TYPE__);
|
101 |
|
|
|
102 |
|
|
void
|
103 |
|
|
init_mem()
|
104 |
|
|
{
|
105 |
|
|
mem_base = (BYTE *) calloc(1024, (1<<13)); /* { dg-error "undeclared|expected" } */
|
106 |
|
|
((void)((mem_base != (BYTE *)0) /* { dg-error "expected" } */
|
107 |
|
|
? 0
|
108 |
|
|
: (__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
|
109 |
|
|
"mem_base != (BYTE *)0", 366, "b.c"),
|
110 |
|
|
0)));
|
111 |
|
|
hash_num = INIT_NUM_ENTRIES * 3; /* { dg-error "undeclared" } */
|
112 |
|
|
mem_hash = (prec_t) calloc(hash_num, sizeof(prec));
|
113 |
|
|
((void)((mem_hash != (prec_t)0)
|
114 |
|
|
? 0
|
115 |
|
|
: (__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
|
116 |
|
|
"mem_hash != (prec_t)0", 370, "b.c"),
|
117 |
|
|
0)));
|
118 |
|
|
flush_hash(mem_hash, 32);
|
119 |
|
|
build_ptables(mem_base, 1024*(1<<13)); /* { dg-bogus "integer overflow" "int smaller than 32 bits" { xfail int16 } } */
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
struct tm {
|
123 |
|
|
int tm_sec; int tm_min; int tm_hour;
|
124 |
|
|
int tm_mday;int tm_mon; int tm_year;
|
125 |
|
|
int tm_wday;int tm_yday;int tm_isdst;
|
126 |
|
|
char*tm_zone; long tm_gmtoff;
|
127 |
|
|
};
|