summaryrefslogtreecommitdiff
path: root/config/bsd/i386.c
blob: 1eecd7c3903473e2d67ac77dd7ac2071fc60e334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * coswitch for the i386 architecture
 */

int
coswitch (int *old_cs, int *new_cs, int first)
{
	asm ("movl 8(%ebp),%eax");
	asm ("movl %esp,0(%eax)");
	asm ("movl %ebp,4(%eax)");
	asm ("movl 12(%ebp),%eax");

	if (first == 0) {                    /* this is the first activation */
		asm ("movl 0(%eax),%esp");
		asm ("movl $0,%ebp");
		new_context (0, 0);
		syserr ("new_context() returned in coswitch");
	}
	else {
		asm ("movl 0(%eax),%esp");
		asm ("movl 4(%eax),%ebp");
	}
}