File: initctxt386.c

package info (click to toggle)
tra 20020816-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 1,696 kB
  • ctags: 2,623
  • sloc: ansic: 22,519; makefile: 406; asm: 269
file content (19 lines) | stat: -rw-r--r-- 322 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "tra.h"

void
initctxt(Ctxt *l, void (*fn)(void*), void *arg)
{
	ulong *stk;
	int n;

	n = 16;
	l->stk = emalloc(n);
	stk = (ulong*)((uchar*)l->stk + n);
	--stk;
	*--stk = (ulong)arg;
	*--stk = 0;	/* return address */
	*--stk = 0;	/* new pc */
	l->label.pc = (ulong)fn+LABELDPC;
	l->label.sp = mainlabel.sp-n;
}