Deleted Added
full compact
exec_machdep.c (258257) exec_machdep.c (258259)
1/*-
2 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3 * Copyright (C) 1995, 1996 TooLs GmbH.
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:

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

50 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
52 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 * $NetBSD: machdep.c,v 1.74.2.1 2000/11/01 16:13:48 tv Exp $
55 */
56
57#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3 * Copyright (C) 1995, 1996 TooLs GmbH.
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:

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

50 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
52 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 * $NetBSD: machdep.c,v 1.74.2.1 2000/11/01 16:13:48 tv Exp $
55 */
56
57#include <sys/cdefs.h>
58__FBSDID("$FreeBSD: head/sys/powerpc/powerpc/exec_machdep.c 258257 2013-11-17 14:44:22Z nwhitehorn $");
58__FBSDID("$FreeBSD: head/sys/powerpc/powerpc/exec_machdep.c 258259 2013-11-17 15:12:03Z nwhitehorn $");
59
60#include "opt_compat.h"
59
60#include "opt_compat.h"
61#include "opt_fpu_emu.h"
61
62#include <sys/param.h>
63#include <sys/proc.h>
64#include <sys/systm.h>
65#include <sys/bio.h>
66#include <sys/buf.h>
67#include <sys/bus.h>
68#include <sys/cons.h>

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

87#include <machine/elf.h>
88#include <machine/fpu.h>
89#include <machine/pcb.h>
90#include <machine/reg.h>
91#include <machine/sigframe.h>
92#include <machine/trap.h>
93#include <machine/vmparam.h>
94
62
63#include <sys/param.h>
64#include <sys/proc.h>
65#include <sys/systm.h>
66#include <sys/bio.h>
67#include <sys/buf.h>
68#include <sys/bus.h>
69#include <sys/cons.h>

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

88#include <machine/elf.h>
89#include <machine/fpu.h>
90#include <machine/pcb.h>
91#include <machine/reg.h>
92#include <machine/sigframe.h>
93#include <machine/trap.h>
94#include <machine/vmparam.h>
95
96#ifdef FPU_EMU
97#include <powerpc/fpu/fpu_extern.h>
98#endif
99
95#ifdef COMPAT_FREEBSD32
96#include <compat/freebsd32/freebsd32_signal.h>
97#include <compat/freebsd32/freebsd32_util.h>
98#include <compat/freebsd32/freebsd32_proto.h>
99
100typedef struct __ucontext32 {
101 sigset_t uc_sigmask;
102 mcontext32_t uc_mcontext;

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

1033 tf->srr1 |= PSL_HV;
1034 #endif
1035 td->td_pcb->pcb_flags = 0;
1036
1037 td->td_retval[0] = (register_t)entry;
1038 td->td_retval[1] = 0;
1039}
1040
100#ifdef COMPAT_FREEBSD32
101#include <compat/freebsd32/freebsd32_signal.h>
102#include <compat/freebsd32/freebsd32_util.h>
103#include <compat/freebsd32/freebsd32_proto.h>
104
105typedef struct __ucontext32 {
106 sigset_t uc_sigmask;
107 mcontext32_t uc_mcontext;

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

1038 tf->srr1 |= PSL_HV;
1039 #endif
1040 td->td_pcb->pcb_flags = 0;
1041
1042 td->td_retval[0] = (register_t)entry;
1043 td->td_retval[1] = 0;
1044}
1045
1046int
1047ppc_instr_emulate(struct trapframe *frame, struct pcb *pcb)
1048{
1049 uint32_t instr;
1050 int reg, sig;
1051
1052 instr = fuword32((void *)frame->srr0);
1053 sig = SIGILL;
1054
1055 if ((instr & 0xfc1fffff) == 0x7c1f42a6) { /* mfpvr */
1056 reg = (instr & ~0xfc1fffff) >> 21;
1057 frame->fixreg[reg] = mfpvr();
1058 frame->srr0 += 4;
1059 return (0);
1060 }
1061
1062 if ((instr & 0xfc000ffe) == 0x7c0004ac) { /* various sync */
1063 powerpc_sync(); /* Do a heavy-weight sync */
1064 frame->srr0 += 4;
1065 return (0);
1066 }
1067
1068#ifdef FPU_EMU
1069 if (!(pcb->pcb_flags & PCB_FPREGS)) {
1070 bzero(&pcb->pcb_fpu, sizeof(pcb->pcb_fpu));
1071 pcb->pcb_flags |= PCB_FPREGS;
1072 }
1073 sig = fpu_emulate(frame, (struct fpreg *)&pcb->pcb_fpu);
1074#endif
1075
1076 return (sig);
1077}
1078