1106191Smini/*
2106191Smini * Copyright (c) 2002 Jonathan Mini <mini@freebsd.org>.
3106191Smini * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>.
4106191Smini * All rights reserved.
5106191Smini *
6106191Smini * Redistribution and use in source and binary forms, with or without
7106191Smini * modification, are permitted provided that the following conditions
8106191Smini * are met:
9106191Smini * 1. Redistributions of source code must retain the above copyright
10106191Smini *    notice, this list of conditions and the following disclaimer.
11106191Smini * 2. Neither the name of the author nor the names of its contributors
12106191Smini *    may be used to endorse or promote products derived from this software
13106191Smini *    without specific prior written permission.
14106191Smini *
15106191Smini * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
16106191Smini * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17106191Smini * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18106191Smini * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19106191Smini * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20106191Smini * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21106191Smini * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22106191Smini * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23106191Smini * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24106191Smini * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25106191Smini * SUCH DAMAGE.
26106191Smini */
27106191Smini
28106191Smini#include <machine/asm.h>
29106191Smini__FBSDID("$FreeBSD$");
30106191Smini
31106191Smini
32106191Smini/*
33118277Sdeischen * _i386_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
34118277Sdeischen *     long stacksz);
35118277Sdeischen * +4 = km, +8 = uts, +12 = stack, +16 = size
36106191Smini */
37118277SdeischenENTRY(_i386_enter_uts)
38118277Sdeischen	movl	%esp, %edx		/* save stack */
39118277Sdeischen	movl	12(%edx), %eax		/* get bottom of stack */
40118277Sdeischen	addl	16(%edx), %eax		/* add length */
41118277Sdeischen	movl	%eax, %esp		/* switch to uts stack */
42118277Sdeischen	pushl	4(%edx)			/* push the address of the mailbox */
43123049Sdavidxu	call	*8(%edx)
44118277Sdeischen	ret
45