Deleted Added
full compact
ia32_signal.c (119336) ia32_signal.c (122292)
1/*-
2 * Copyright (c) 2003 Peter Wemm
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * William Jolitz.
8 *

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

31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Peter Wemm
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * William Jolitz.
8 *

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

31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/amd64/ia32/ia32_signal.c 119336 2003-08-23 00:04:53Z peter $");
39__FBSDID("$FreeBSD: head/sys/amd64/ia32/ia32_signal.c 122292 2003-11-08 03:33:38Z peter $");
40
41#include "opt_compat.h"
42
43#include <sys/param.h>
44#include <sys/exec.h>
45#include <sys/fcntl.h>
46#include <sys/imgact.h>
47#include <sys/kernel.h>

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

103 * unportabilized using __attribute__((aligned(16))) like the
104 * declaration of struct savemm, and anyway, alignment doesn't work
105 * for auto variables since we don't use gcc's pessimal stack
106 * alignment. Work around this by abusing the spare fields after
107 * mcp->mc_fpstate.
108 *
109 * XXX unpessimize most cases by only aligning when fxsave might be
110 * called, although this requires knowing too much about
40
41#include "opt_compat.h"
42
43#include <sys/param.h>
44#include <sys/exec.h>
45#include <sys/fcntl.h>
46#include <sys/imgact.h>
47#include <sys/kernel.h>

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

103 * unportabilized using __attribute__((aligned(16))) like the
104 * declaration of struct savemm, and anyway, alignment doesn't work
105 * for auto variables since we don't use gcc's pessimal stack
106 * alignment. Work around this by abusing the spare fields after
107 * mcp->mc_fpstate.
108 *
109 * XXX unpessimize most cases by only aligning when fxsave might be
110 * called, although this requires knowing too much about
111 * npxgetregs()'s internals.
111 * fpugetregs()'s internals.
112 */
113 addr = (struct savefpu *)&mcp->mc_fpstate;
114 if (td == PCPU_GET(fpcurthread) && ((uintptr_t)(void *)addr & 0xF)) {
115 do
116 addr = (void *)((char *)addr + 4);
117 while ((uintptr_t)(void *)addr & 0xF);
118 }
112 */
113 addr = (struct savefpu *)&mcp->mc_fpstate;
114 if (td == PCPU_GET(fpcurthread) && ((uintptr_t)(void *)addr & 0xF)) {
115 do
116 addr = (void *)((char *)addr + 4);
117 while ((uintptr_t)(void *)addr & 0xF);
118 }
119 mcp->mc_ownedfp = npxgetregs(td, addr);
119 mcp->mc_ownedfp = fpugetregs(td, addr);
120 if (addr != (struct savefpu *)&mcp->mc_fpstate) {
121 bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
122 bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2));
123 }
120 if (addr != (struct savefpu *)&mcp->mc_fpstate) {
121 bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
122 bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2));
123 }
124 mcp->mc_fpformat = npxformat();
124 mcp->mc_fpformat = fpuformat();
125}
126
127static int
128ia32_set_fpcontext(struct thread *td, const struct ia32_mcontext *mcp)
129{
130 struct savefpu *addr;
131
132 if (mcp->mc_fpformat == _MC_FPFMT_NODEV)

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

143 if (td == PCPU_GET(fpcurthread) &&
144 ((uintptr_t)(void *)addr & 0xF)) {
145 do
146 addr = (void *)((char *)addr + 4);
147 while ((uintptr_t)(void *)addr & 0xF);
148 bcopy(&mcp->mc_fpstate, addr, sizeof(mcp->mc_fpstate));
149 }
150 /*
125}
126
127static int
128ia32_set_fpcontext(struct thread *td, const struct ia32_mcontext *mcp)
129{
130 struct savefpu *addr;
131
132 if (mcp->mc_fpformat == _MC_FPFMT_NODEV)

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

143 if (td == PCPU_GET(fpcurthread) &&
144 ((uintptr_t)(void *)addr & 0xF)) {
145 do
146 addr = (void *)((char *)addr + 4);
147 while ((uintptr_t)(void *)addr & 0xF);
148 bcopy(&mcp->mc_fpstate, addr, sizeof(mcp->mc_fpstate));
149 }
150 /*
151 * XXX we violate the dubious requirement that npxsetregs()
151 * XXX we violate the dubious requirement that fpusetregs()
152 * be called with interrupts disabled.
153 */
152 * be called with interrupts disabled.
153 */
154 npxsetregs(td, addr);
154 fpusetregs(td, addr);
155 /*
156 * Don't bother putting things back where they were in the
157 * misaligned case, since we know that the caller won't use
158 * them again.
159 */
160 } else
161 return (EINVAL);
162 return (0);

--- 398 unchanged lines hidden ---
155 /*
156 * Don't bother putting things back where they were in the
157 * misaligned case, since we know that the caller won't use
158 * them again.
159 */
160 } else
161 return (EINVAL);
162 return (0);

--- 398 unchanged lines hidden ---