Deleted Added
full compact
kse_asm.S (107138) kse_asm.S (107165)
1/*
2 * Copyright (c) 2002 Jonathan Mini <mini@freebsd.org>.
3 * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*
2 * Copyright (c) 2002 Jonathan Mini <mini@freebsd.org>.
3 * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/tools/KSE/ksetest/kse_asm.S 107138 2002-11-21 09:48:39Z davidxu $
27 * $FreeBSD: head/tools/KSE/ksetest/kse_asm.S 107165 2002-11-22 00:23:02Z julian $
28 */
29
30#include <machine/asm.h>
28 */
29
30#include <machine/asm.h>
31__FBSDID("$FreeBSD: head/tools/KSE/ksetest/kse_asm.S 107138 2002-11-21 09:48:39Z davidxu $");
31__FBSDID("$FreeBSD: head/tools/KSE/ksetest/kse_asm.S 107165 2002-11-22 00:23:02Z julian $");
32
33/*
34 * Where do we define these?
35 */
36#define MC_SIZE 640 /* sizeof mcontext_t */
37#define UC_MC_OFFSET 16 /* offset to mcontext from ucontext */
38#define UC_MC_LEN_OFFSET 96 /* offset to mc_len from mcontext */
39#define MC_LEN_OFFSET 80 /* offset to mc_len from mcontext */

--- 17 unchanged lines hidden (view full) ---

57 jne 1f
58 movl $-1, %eax
59 jmp 5f
601: cmpl $MC_SIZE, UC_MC_LEN_OFFSET(%edx) /* is context valid? */
61 je 2f
62 movl $-1, %eax /* bzzzt, invalid context */
63 jmp 5f
642: movl 8(%esp), %eax /* get address of curthreadp */
32
33/*
34 * Where do we define these?
35 */
36#define MC_SIZE 640 /* sizeof mcontext_t */
37#define UC_MC_OFFSET 16 /* offset to mcontext from ucontext */
38#define UC_MC_LEN_OFFSET 96 /* offset to mc_len from mcontext */
39#define MC_LEN_OFFSET 80 /* offset to mc_len from mcontext */

--- 17 unchanged lines hidden (view full) ---

57 jne 1f
58 movl $-1, %eax
59 jmp 5f
601: cmpl $MC_SIZE, UC_MC_LEN_OFFSET(%edx) /* is context valid? */
61 je 2f
62 movl $-1, %eax /* bzzzt, invalid context */
63 jmp 5f
642: movl 8(%esp), %eax /* get address of curthreadp */
65 movl %edx, (%eax) /* we're now the current thread */
65 movl %edx, %ebx /* save the pointer for later */
66 /*
67 * From here on, we don't touch the old stack.
68 */
69 addl $UC_MC_OFFSET, %edx /* add offset to mcontext */
70 movl 4(%edx), %gs
71 movl 8(%edx), %fs
72 movl 12(%edx), %es
73 movl 16(%edx), %ds

--- 6 unchanged lines hidden (view full) ---

80 movl 60(%edx), %eax /* put return address at top of stack */
81 movl %eax, (%esp)
82 cmpl $0, MC_OWNEDFP_OFFSET(%edx) /* are FP regs valid? */
83 jz 3f
84 frstor MC_FP_REGS_OFFSET(%edx) /* restore FP regs */
85 jmp 4f
863: fninit
87 fldcw MC_FP_CW_OFFSET(%edx)
66 /*
67 * From here on, we don't touch the old stack.
68 */
69 addl $UC_MC_OFFSET, %edx /* add offset to mcontext */
70 movl 4(%edx), %gs
71 movl 8(%edx), %fs
72 movl 12(%edx), %es
73 movl 16(%edx), %ds

--- 6 unchanged lines hidden (view full) ---

80 movl 60(%edx), %eax /* put return address at top of stack */
81 movl %eax, (%esp)
82 cmpl $0, MC_OWNEDFP_OFFSET(%edx) /* are FP regs valid? */
83 jz 3f
84 frstor MC_FP_REGS_OFFSET(%edx) /* restore FP regs */
85 jmp 4f
863: fninit
87 fldcw MC_FP_CW_OFFSET(%edx)
884: movl 48(%edx), %eax /* restore ax, bx, cx */
89 movl 36(%edx), %ebx
90 movl 44(%edx), %ecx
91 pushl 68(%edx) /* flags on stack */
92 pushl 40(%edx) /* %edx on stack */
93 popl %edx /* %edx off stack */
94 popf /* flags off stack */
955: ret /* %eip off stack */
884: pushl 68(%edx) /* flags */
89 pushl 48(%edx) /* eax */
90 pushl 36(%edx) /* ebx */
91 movl 40(%edx), %edx /* edx */
92 movl %ebx, (%eax) /* <---- set new mailbox pointer */
93 popl %ebx
94 popl %eax
95 popf
965: ret
96
97/*
98 * int thread_to_uts(struct kse_thr_mailbox *tm, struct kse_mailbox *km);
99 *
100 * Does not return on success, returns -1 otherwise.
101 */
102ENTRY(thread_to_uts)
103 movl 4(%esp), %eax /* get address of context */

--- 48 unchanged lines hidden ---
97
98/*
99 * int thread_to_uts(struct kse_thr_mailbox *tm, struct kse_mailbox *km);
100 *
101 * Does not return on success, returns -1 otherwise.
102 */
103ENTRY(thread_to_uts)
104 movl 4(%esp), %eax /* get address of context */

--- 48 unchanged lines hidden ---