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