1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6/*
7 * os_BSD_386_2.s
8 * We need to define our own setjmp/longjmp on BSDI 2.x because libc's
9 * implementation does some sanity checking that defeats user level threads.
10 * This should no longer be necessary in BSDI 3.0.
11 */
12
13.globl _setjmp
14.align 2
15_setjmp:
16		movl	4(%esp),%eax
17		movl	0(%esp),%edx
18		movl	%edx, 0(%eax)           /* rta */
19		movl	%ebx, 4(%eax)
20		movl	%esp, 8(%eax)
21		movl	%ebp,12(%eax)
22		movl	%esi,16(%eax)
23		movl	%edi,20(%eax)
24		movl	$0,%eax
25		ret
26
27.globl _longjmp
28.align 2
29_longjmp:
30		movl	4(%esp),%edx
31		movl	8(%esp),%eax
32		movl	0(%edx),%ecx
33		movl	4(%edx),%ebx
34		movl	8(%edx),%esp
35		movl	12(%edx),%ebp
36		movl	16(%edx),%esi
37		movl	20(%edx),%edi
38		cmpl	$0,%eax
39		jne		1f
40		movl	$1,%eax
411:		movl	%ecx,0(%esp)
42		ret
43