NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/56418: cannot compile INSTALL_FLOPPY kernel on current/i386
The following reply was made to PR kern/56418; it has been noted by GNATS.
From: Kouichi Hashikawa <hashikaw%mail.ru@localhost>
To: kre%munnari.oz.au@localhost, kern-bug-people%netbsd.org@localhost, gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/56418: cannot compile INSTALL_FLOPPY kernel on current/i386
Date: Thu, 30 Sep 2021 15:07:25 +0900
=EF=BB=BFHi, Robert, thank you for checking my patch.
I change src/sys/arch/i386/include/ptrace.h to match
src/sys/arch/i386/i386/process_machdep.c,
and fix other errors by changing src/sys/arch/i386/include/ptrace.h.
I have questions.
o on src/sys/compat/linux/arch/i386/linux_ptrace.c,
if PT_SETREGS, PT_SETFPREGS, ... is not defined, nothing to do?
o on src/sys/compat/linux/arch/i386/linux_ptrace.c,
in case LINUX_PTRACE_SETFPREGS:,=20
process_write_regs(lt, regs) -> process_write_fpregs(lt, fpregs) ?
--- src/sys/arch/i386/include/ptrace.h-dist 2020-05-31 21:52:17.00000000=
0=20
+0900
+++ src/sys/arch/i386/include/ptrace.h 2021-09-28 20:12:28.565839877 +0900
@@ -71,6 +71,29 @@
/*
* i386-dependent ptrace definitions
*/
+#if defined(_KERNEL) && !defined(PTRACE_HOOKS)
+
+#define PT_GETREGS (PT_FIRSTMACH + 1)
+#define PT_GETFPREGS (PT_FIRSTMACH + 3)
+#define PT_GETDBREGS (PT_FIRSTMACH + 7)
+
+#define PT_MACHDEP_STRINGS \
+ "*PT_INVALID_32*", \
+ "PT_GETREGS", \
+ "*PT_INVALID_34*", \
+ "PT_GETFPREGS", \
+ "*PT_INVALID_36*", \
+ "*PT_INVALID_37*", \
+ "*PT_INVALID_38*", \
+ "PT_GETDBREGS", \
+ "*PT_INVALID_40*", \
+ "*PT_INVALID_41*", \
+ "*PT_INVALID_42*", \
+ "*PT_INVALID_43*", \
+ "*PT_INVALID_44*"
+
+#else
+
#define PT_STEP (PT_FIRSTMACH + 0)
#define PT_GETREGS (PT_FIRSTMACH + 1)
#define PT_SETREGS (PT_FIRSTMACH + 2)
@@ -108,6 +131,8 @@
"PT_GETXSTATE", \
"PT_SETXSTATE"
+#endif /* _KERNEL && !PTRACE_HOOKS */
+
#include <machine/reg.h>
#define PTRACE_REG_PC(r) (r)->r_eip
#define PTRACE_REG_FP(r) (r)->r_ebp
@@ -124,6 +149,7 @@
#ifdef _KERNEL
+#if defined(PTRACE_HOOKS)
/*
* These are used in sys_ptrace() to find good ptrace(2) requests.
*/
@@ -187,6 +213,8 @@
struct pfsnode *, struct uio *);
int procfs_machdep_validxmmregs(struct lwp *, struct mount *);
+#endif /* PTRACE_HOOKS */
+
/*
* The fpregs structure contains an fxsave area, which must have 16-byte
* alignment.
--- src/sys/kern/sys_process_lwpstatus.c-dist 2020-12-21 16:20:40.00000000=
0=20
+0900
+++ src/sys/kern/sys_process_lwpstatus.c 2021-09-29 00:53:46.80245259=
6=20
+0900
@@ -145,6 +145,9 @@
}
#ifdef PT_REGISTERS
+#if (defined(PT_GETREGS) && defined(PT_SETREGS)) || \
+ (defined(PT_GETFPREGS) && defined(PT_SETFPREGS)) || \
+ (defined(PT_GETDBREGS) && defined(PT_SETDBREGS))
static int
proc_regio(struct lwp *l, struct uio *uio, size_t ks, ptrace_regrfunc_t r,
ptrace_regwfunc_t w)
@@ -180,13 +183,14 @@
return error;
}
#endif
+#endif
int
process_doregs(struct lwp *curl /*tracer*/,
struct lwp *l /*traced*/,
struct uio *uio)
{
-#if defined(PT_GETREGS) || defined(PT_SETREGS)
+#if defined(PT_GETREGS) && defined(PT_SETREGS)
size_t s;
ptrace_regrfunc_t r;
ptrace_regwfunc_t w;
@@ -220,7 +224,7 @@
struct lwp *l /*traced*/,
struct uio *uio)
{
-#if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
+#if defined(PT_GETFPREGS) && defined(PT_SETFPREGS)
size_t s;
ptrace_regrfunc_t r;
ptrace_regwfunc_t w;
@@ -255,7 +259,7 @@
struct lwp *l /*traced*/,
struct uio *uio)
{
-#if defined(PT_GETDBREGS) || defined(PT_SETDBREGS)
+#if defined(PT_GETDBREGS) && defined(PT_SETDBREGS)
size_t s;
ptrace_regrfunc_t r;
ptrace_regwfunc_t w;
--- src/sys/compat/linux/arch/i386/linux_ptrace.c-dist 2021-09-08 18:55:46.=
33
6270896 +0900
+++ src/sys/compat/linux/arch/i386/linux_ptrace.c 2021-09-28 19:51:34.=
02
8158505 +0900
@@ -218,6 +218,7 @@
switch (request) {
case LINUX_PTRACE_GETREGS:
+#if defined(PT_GETREGS)
error =3D process_read_regs(lt, regs);
mutex_exit(t->p_lock);
if (error) {
@@ -242,9 +243,11 @@
error =3D copyout(linux_regs, (void *)SCARG(uap, data),
sizeof(struct linux_reg));
+#endif
break;
case LINUX_PTRACE_SETREGS:
+#if defined(PT_SETREGS)
regs->r_ebx =3D linux_regs->ebx;
regs->r_ecx =3D linux_regs->ecx;
regs->r_edx =3D linux_regs->edx;
@@ -262,9 +265,11 @@
error =3D process_write_regs(lt, regs);
mutex_exit(t->p_lock);
+#endif
break;
case LINUX_PTRACE_GETFPREGS:
+#if defined(PT_GETFPREGS)
fp_size =3D sizeof fpregs;
error =3D process_read_fpregs(lt, fpregs, &fp_size);
mutex_exit(t->p_lock);
@@ -279,14 +284,17 @@
uimin(sizeof(struct linux_fpctx), fp_size));
error =3D copyout(linux_fpregs, (void *)SCARG(uap, data),
sizeof(struct linux_fpctx));
+#endif
break;
case LINUX_PTRACE_SETFPREGS:
+#if defined(PT_SETFPREGS)
memset(fpregs, '\0', sizeof(struct fpreg));
memcpy(fpregs, linux_fpregs,
uimin(sizeof(struct linux_fpctx), sizeof(struct fpreg)));
- error =3D process_write_regs(lt, regs);
+ error =3D process_write_fpregs(lt, fpregs);
mutex_exit(t->p_lock);
+#endif
break;
case LINUX_PTRACE_PEEKUSR:
--- src/sys/secmodel/extensions/secmodel_extensions.c-dist 2020-03-17 0=
6:
20:12.000000000 +0900
+++ src/sys/secmodel/extensions/secmodel_extensions.c 2021-09-28 23:11:21.=
22
6096353 +0900
@@ -29,6 +29,10 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: secmodel_extensions.c,v 1.12 2020/03/16 21:20:12=
=20
pgoyette Exp $");
+#ifdef _KERNEL_OPT
+#include "opt_ptrace.h"
+#endif
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/kauth.h>
Home |
Main Index |
Thread Index |
Old Index