i386: move signal delivery code to exec_machdep.c

also move ptrace-related helpers to ptrace_machdep.c
Apply some style. Use ANSI C function definitions.
Remove MPSAFE annotations.

Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
This commit is contained in:
Konstantin Belousov 2021-10-04 04:29:26 +03:00
parent 4313e2ae44
commit 4c5bf59152
4 changed files with 1476 additions and 1391 deletions

View File

@ -104,6 +104,7 @@ i386/i386/copyout.c standard
i386/i386/db_disasm.c optional ddb
i386/i386/db_interface.c optional ddb
i386/i386/db_trace.c optional ddb
i386/i386/exec_machdep.c standard
i386/i386/elan-mmcr.c optional cpu_elan | cpu_soekris
i386/i386/elf_machdep.c standard
i386/i386/exception.s standard

1443
sys/i386/i386/exec_machdep.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <machine/frame.h>
@ -196,3 +198,33 @@ cpu_ptrace(struct thread *td, int req, void *addr, int data)
return (error);
}
int
ptrace_set_pc(struct thread *td, u_long addr)
{
td->td_frame->tf_eip = addr;
return (0);
}
int
ptrace_single_step(struct thread *td)
{
PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
if ((td->td_frame->tf_eflags & PSL_T) == 0) {
td->td_frame->tf_eflags |= PSL_T;
td->td_dbgflags |= TDB_STEP;
}
return (0);
}
int
ptrace_clear_single_step(struct thread *td)
{
PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
td->td_frame->tf_eflags &= ~PSL_T;
td->td_dbgflags &= ~TDB_STEP;
return (0);
}