Deleted Added
full compact
trap.c (269752) trap.c (274648)
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

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

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 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
38 */
39
40#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

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

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 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: stable/10/sys/i386/i386/trap.c 269752 2014-08-09 14:05:01Z markj $");
41__FBSDID("$FreeBSD: stable/10/sys/i386/i386/trap.c 274648 2014-11-18 12:53:32Z kib $");
42
43/*
44 * 386 Trap and System call handling
45 */
46
47#include "opt_clock.h"
48#include "opt_cpu.h"
49#include "opt_hwpmc_hooks.h"

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

1057}
1058
1059int
1060cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
1061{
1062 struct proc *p;
1063 struct trapframe *frame;
1064 caddr_t params;
42
43/*
44 * 386 Trap and System call handling
45 */
46
47#include "opt_clock.h"
48#include "opt_cpu.h"
49#include "opt_hwpmc_hooks.h"

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

1057}
1058
1059int
1060cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
1061{
1062 struct proc *p;
1063 struct trapframe *frame;
1064 caddr_t params;
1065 long tmp;
1065 int error;
1066
1067 p = td->td_proc;
1068 frame = td->td_frame;
1069
1070 params = (caddr_t)frame->tf_esp + sizeof(int);
1071 sa->code = frame->tf_eax;
1072
1073 /*
1074 * Need to check if this is a 32 bit or 64 bit syscall.
1075 */
1076 if (sa->code == SYS_syscall) {
1077 /*
1078 * Code is first argument, followed by actual args.
1079 */
1066 int error;
1067
1068 p = td->td_proc;
1069 frame = td->td_frame;
1070
1071 params = (caddr_t)frame->tf_esp + sizeof(int);
1072 sa->code = frame->tf_eax;
1073
1074 /*
1075 * Need to check if this is a 32 bit or 64 bit syscall.
1076 */
1077 if (sa->code == SYS_syscall) {
1078 /*
1079 * Code is first argument, followed by actual args.
1080 */
1080 sa->code = fuword(params);
1081 error = fueword(params, &tmp);
1082 if (error == -1)
1083 return (EFAULT);
1084 sa->code = tmp;
1081 params += sizeof(int);
1082 } else if (sa->code == SYS___syscall) {
1083 /*
1084 * Like syscall, but code is a quad, so as to maintain
1085 * quad alignment for the rest of the arguments.
1086 */
1085 params += sizeof(int);
1086 } else if (sa->code == SYS___syscall) {
1087 /*
1088 * Like syscall, but code is a quad, so as to maintain
1089 * quad alignment for the rest of the arguments.
1090 */
1087 sa->code = fuword(params);
1091 error = fueword(params, &tmp);
1092 if (error == -1)
1093 return (EFAULT);
1094 sa->code = tmp;
1088 params += sizeof(quad_t);
1089 }
1090
1091 if (p->p_sysent->sv_mask)
1092 sa->code &= p->p_sysent->sv_mask;
1093 if (sa->code >= p->p_sysent->sv_size)
1094 sa->callp = &p->p_sysent->sv_table[0];
1095 else

--- 66 unchanged lines hidden ---
1095 params += sizeof(quad_t);
1096 }
1097
1098 if (p->p_sysent->sv_mask)
1099 sa->code &= p->p_sysent->sv_mask;
1100 if (sa->code >= p->p_sysent->sv_size)
1101 sa->callp = &p->p_sysent->sv_table[0];
1102 else

--- 66 unchanged lines hidden ---