1 /* $NetBSD: context.c,v 1.2 2004/03/01 12:04:18 drochner Exp $ */
8 #define STACKSZ (10*1024)
19 if (n
!= DEPTH
- calls
- 1)
23 for (i
= 0; i
< 9; i
++) {
26 errx(2, "arg[%d]=%d", i
, ia
);
37 for (i
= 0; i
< DEPTH
; i
++) {
38 res
= getcontext(&uc
[i
]);
41 uc
[i
].uc_stack
.ss_sp
= malloc(STACKSZ
);
42 uc
[i
].uc_stack
.ss_size
= STACKSZ
;
44 uc
[i
].uc_link
= &uc
[i
- 1];
45 makecontext(&uc
[i
], (void *)run
, 10, i
,
46 0, 1, 2, 3, 4, 5, 6, 7, 8);
48 res
= setcontext(&uc
[DEPTH
-1]);