annotate test/device.d @ 935:7672a37e7545 default tip

Raspbery PI ARM support begin
author kono
date Sat, 24 Dec 2016 03:02:57 +0000
parents d35df41eac69
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
1 struct env_segment1 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
2 void *fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
3 void *sp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
4 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
5
d35df41eac69 Initial revision
kono
parents:
diff changeset
6 struct cont_segment1 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
7 int value;
d35df41eac69 Initial revision
kono
parents:
diff changeset
8 *return();
d35df41eac69 Initial revision
kono
parents:
diff changeset
9 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
10
d35df41eac69 Initial revision
kono
parents:
diff changeset
11 segment1(env_segment1 e,
d35df41eac69 Initial revision
kono
parents:
diff changeset
12 cont_segment1 c) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
13 cont_segment1 c1 =
d35df41eac69 Initial revision
kono
parents:
diff changeset
14 new_continuation(c,e);
d35df41eac69 Initial revision
kono
parents:
diff changeset
15 c.return = segment2;
d35df41eac69 Initial revision
kono
parents:
diff changeset
16 call_segment(e,c1);
d35df41eac69 Initial revision
kono
parents:
diff changeset
17 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
18
d35df41eac69 Initial revision
kono
parents:
diff changeset
19 call_segment(env_segment1 e,
d35df41eac69 Initial revision
kono
parents:
diff changeset
20 cont_segment1 c) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
21 c.value = 1;
d35df41eac69 Initial revision
kono
parents:
diff changeset
22 c.return();
d35df41eac69 Initial revision
kono
parents:
diff changeset
23 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
24
d35df41eac69 Initial revision
kono
parents:
diff changeset
25 segment2(env_segment2 e,
d35df41eac69 Initial revision
kono
parents:
diff changeset
26 cont_segment1 c) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
27 cont_segment1 c1 =
d35df41eac69 Initial revision
kono
parents:
diff changeset
28 old_continuation(e);
d35df41eac69 Initial revision
kono
parents:
diff changeset
29 halt(e,c);
d35df41eac69 Initial revision
kono
parents:
diff changeset
30 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
31
d35df41eac69 Initial revision
kono
parents:
diff changeset
32 inline type new_continuation(c,e) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
33 e.fp -= sizeof(type);
d35df41eac69 Initial revision
kono
parents:
diff changeset
34 return (type)e.fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
35 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
36
d35df41eac69 Initial revision
kono
parents:
diff changeset
37 inline type old_continuation(c,e) {
d35df41eac69 Initial revision
kono
parents:
diff changeset
38 e.fp += sizeof(c);
d35df41eac69 Initial revision
kono
parents:
diff changeset
39 return (type)e.fp;
d35df41eac69 Initial revision
kono
parents:
diff changeset
40 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
41