mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-09 16:01:19 +01:00
Add new functions fill_fpregs() and set_fpregs(), like fill_regs()
and set_regs() but for the floating point register state. The code is stolen from procfs_machdep.c, and moved out of there into machdep.c. These functions are needed for generating ELF core dumps.
This commit is contained in:
parent
011ee1102f
commit
1a291e0cd4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39197
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: machdep.c,v 1.11 1998/08/10 07:53:58 dfr Exp $
|
||||
* $Id: machdep.c,v 1.12 1998/08/22 10:32:38 dfr Exp $
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -1732,6 +1732,33 @@ set_regs(p, regs)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
fill_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
if (p == fpcurproc) {
|
||||
alpha_pal_wrfen(1);
|
||||
savefpstate(&p->p_addr->u_pcb.pcb_fp);
|
||||
alpha_pal_wrfen(0);
|
||||
}
|
||||
|
||||
bcopy(&p->p_addr->u_pcb.pcb_fp, fpregs, sizeof *fpregs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
set_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
if (p == fpcurproc)
|
||||
fpcurproc = NULL;
|
||||
|
||||
bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifndef DDB
|
||||
void
|
||||
Debugger(const char *msg)
|
||||
|
@ -37,7 +37,7 @@
|
||||
* @(#)procfs_machdep.c 8.3 (Berkeley) 1/27/94
|
||||
*
|
||||
* From:
|
||||
* $Id: procfs_machdep.c,v 1.10 1997/07/20 08:37:22 bde Exp $
|
||||
* $Id: procfs_machdep.c,v 1.1 1998/06/10 10:53:04 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -112,15 +112,7 @@ procfs_read_fpregs(p, fpregs)
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
if (p == fpcurproc) {
|
||||
alpha_pal_wrfen(1);
|
||||
savefpstate(&p->p_addr->u_pcb.pcb_fp);
|
||||
alpha_pal_wrfen(0);
|
||||
}
|
||||
|
||||
bcopy(&p->p_addr->u_pcb.pcb_fp, fpregs, sizeof *fpregs);
|
||||
return (0);
|
||||
return (fill_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
int
|
||||
@ -130,12 +122,7 @@ procfs_write_fpregs(p, fpregs)
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
if (p == fpcurproc)
|
||||
fpcurproc = NULL;
|
||||
|
||||
bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs);
|
||||
return (0);
|
||||
return (set_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: md_var.h,v 1.1 1998/06/10 10:55:11 dfr Exp $
|
||||
* $Id: md_var.h,v 1.2 1998/07/12 16:32:09 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_MD_VAR_H_
|
||||
@ -39,6 +39,10 @@ extern int szsigcode;
|
||||
extern int Maxmem;
|
||||
extern void (*netisrs[32]) __P((void));
|
||||
|
||||
struct fpreg;
|
||||
struct proc;
|
||||
struct reg;
|
||||
|
||||
void cpu_power_down __P((void));
|
||||
void cpu_halt __P((void));
|
||||
void cpu_reset __P((void));
|
||||
@ -47,5 +51,7 @@ void swi_vm __P((void));
|
||||
int vm_page_zero_idle __P((void));
|
||||
int fill_regs __P((struct proc *, struct reg *));
|
||||
int set_regs __P((struct proc *, struct reg *));
|
||||
int fill_fpregs __P((struct proc *, struct fpreg *));
|
||||
int set_fpregs __P((struct proc *, struct fpreg *));
|
||||
|
||||
#endif /* !_MACHINE_MD_VAR_H_ */
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.307 1998/09/01 02:04:12 kato Exp $
|
||||
* $Id: machdep.c,v 1.308 1998/09/14 11:47:40 abial Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -1795,6 +1795,24 @@ set_regs(p, regs)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
fill_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
bcopy(&p->p_addr->u_pcb.pcb_savefpu, fpregs, sizeof *fpregs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
set_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
bcopy(fpregs, &p->p_addr->u_pcb.pcb_savefpu, sizeof *fpregs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifndef DDB
|
||||
void
|
||||
Debugger(const char *msg)
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: md_var.h,v 1.23 1998/02/01 23:00:53 bde Exp $
|
||||
* $Id: md_var.h,v 1.24 1998/07/11 05:59:35 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_MD_VAR_H_
|
||||
@ -64,6 +64,7 @@ extern int szsigcode;
|
||||
typedef void alias_for_inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
|
||||
struct proc;
|
||||
struct reg;
|
||||
struct fpreg;
|
||||
|
||||
void bcopyb __P((const void *from, void *to, size_t len));
|
||||
void busdma_swi __P((void));
|
||||
@ -78,6 +79,7 @@ void doreti_popl_ds __P((void)) __asm(__STRING(doreti_popl_ds));
|
||||
void doreti_popl_ds_fault __P((void)) __asm(__STRING(doreti_popl_ds_fault));
|
||||
void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es));
|
||||
void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault));
|
||||
int fill_fpregs __P((struct proc *, struct fpreg *));
|
||||
int fill_regs __P((struct proc *p, struct reg *regs));
|
||||
void fillw __P((int /*u_short*/ pat, void *base, size_t cnt));
|
||||
int is_physical_memory __P((vm_offset_t addr));
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)reg.h 5.5 (Berkeley) 1/18/91
|
||||
* $Id: reg.h,v 1.14 1997/06/07 00:49:45 bde Exp $
|
||||
* $Id: reg.h,v 1.15 1997/06/07 04:36:06 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_REG_H_
|
||||
@ -122,6 +122,7 @@ struct fpreg {
|
||||
/*
|
||||
* XXX these interfaces are MI, so they should be declared in a MI place.
|
||||
*/
|
||||
int set_fpregs __P((struct proc *, struct fpreg *));
|
||||
int set_regs __P((struct proc *p, struct reg *regs));
|
||||
void setregs __P((struct proc *, u_long, u_long));
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.307 1998/09/01 02:04:12 kato Exp $
|
||||
* $Id: machdep.c,v 1.308 1998/09/14 11:47:40 abial Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -1795,6 +1795,24 @@ set_regs(p, regs)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
fill_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
bcopy(&p->p_addr->u_pcb.pcb_savefpu, fpregs, sizeof *fpregs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
set_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
bcopy(fpregs, &p->p_addr->u_pcb.pcb_savefpu, sizeof *fpregs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifndef DDB
|
||||
void
|
||||
Debugger(const char *msg)
|
||||
|
@ -37,7 +37,7 @@
|
||||
* @(#)procfs_machdep.c 8.3 (Berkeley) 1/27/94
|
||||
*
|
||||
* From:
|
||||
* $Id: procfs_machdep.c,v 1.9 1997/02/22 09:32:44 peter Exp $
|
||||
* $Id: procfs_machdep.c,v 1.10 1997/07/20 08:37:22 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -112,8 +112,7 @@ procfs_read_fpregs(p, fpregs)
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
bcopy(&p->p_addr->u_pcb.pcb_savefpu, fpregs, sizeof *fpregs);
|
||||
return (0);
|
||||
return (fill_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
int
|
||||
@ -123,8 +122,7 @@ procfs_write_fpregs(p, fpregs)
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
bcopy(fpregs, &p->p_addr->u_pcb.pcb_savefpu, sizeof *fpregs);
|
||||
return (0);
|
||||
return (set_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: md_var.h,v 1.23 1998/02/01 23:00:53 bde Exp $
|
||||
* $Id: md_var.h,v 1.24 1998/07/11 05:59:35 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_MD_VAR_H_
|
||||
@ -64,6 +64,7 @@ extern int szsigcode;
|
||||
typedef void alias_for_inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
|
||||
struct proc;
|
||||
struct reg;
|
||||
struct fpreg;
|
||||
|
||||
void bcopyb __P((const void *from, void *to, size_t len));
|
||||
void busdma_swi __P((void));
|
||||
@ -78,6 +79,7 @@ void doreti_popl_ds __P((void)) __asm(__STRING(doreti_popl_ds));
|
||||
void doreti_popl_ds_fault __P((void)) __asm(__STRING(doreti_popl_ds_fault));
|
||||
void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es));
|
||||
void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault));
|
||||
int fill_fpregs __P((struct proc *, struct fpreg *));
|
||||
int fill_regs __P((struct proc *p, struct reg *regs));
|
||||
void fillw __P((int /*u_short*/ pat, void *base, size_t cnt));
|
||||
int is_physical_memory __P((vm_offset_t addr));
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)reg.h 5.5 (Berkeley) 1/18/91
|
||||
* $Id: reg.h,v 1.14 1997/06/07 00:49:45 bde Exp $
|
||||
* $Id: reg.h,v 1.15 1997/06/07 04:36:06 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_REG_H_
|
||||
@ -122,6 +122,7 @@ struct fpreg {
|
||||
/*
|
||||
* XXX these interfaces are MI, so they should be declared in a MI place.
|
||||
*/
|
||||
int set_fpregs __P((struct proc *, struct fpreg *));
|
||||
int set_regs __P((struct proc *p, struct reg *regs));
|
||||
void setregs __P((struct proc *, u_long, u_long));
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: md_var.h,v 1.1 1998/06/10 10:55:11 dfr Exp $
|
||||
* $Id: md_var.h,v 1.2 1998/07/12 16:32:09 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_MD_VAR_H_
|
||||
@ -39,6 +39,10 @@ extern int szsigcode;
|
||||
extern int Maxmem;
|
||||
extern void (*netisrs[32]) __P((void));
|
||||
|
||||
struct fpreg;
|
||||
struct proc;
|
||||
struct reg;
|
||||
|
||||
void cpu_power_down __P((void));
|
||||
void cpu_halt __P((void));
|
||||
void cpu_reset __P((void));
|
||||
@ -47,5 +51,7 @@ void swi_vm __P((void));
|
||||
int vm_page_zero_idle __P((void));
|
||||
int fill_regs __P((struct proc *, struct reg *));
|
||||
int set_regs __P((struct proc *, struct reg *));
|
||||
int fill_fpregs __P((struct proc *, struct fpreg *));
|
||||
int set_fpregs __P((struct proc *, struct fpreg *));
|
||||
|
||||
#endif /* !_MACHINE_MD_VAR_H_ */
|
||||
|
@ -37,7 +37,7 @@
|
||||
* @(#)procfs_machdep.c 8.3 (Berkeley) 1/27/94
|
||||
*
|
||||
* From:
|
||||
* $Id: procfs_machdep.c,v 1.10 1997/07/20 08:37:22 bde Exp $
|
||||
* $Id: procfs_machdep.c,v 1.1 1998/06/10 10:53:04 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -112,15 +112,7 @@ procfs_read_fpregs(p, fpregs)
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
if (p == fpcurproc) {
|
||||
alpha_pal_wrfen(1);
|
||||
savefpstate(&p->p_addr->u_pcb.pcb_fp);
|
||||
alpha_pal_wrfen(0);
|
||||
}
|
||||
|
||||
bcopy(&p->p_addr->u_pcb.pcb_fp, fpregs, sizeof *fpregs);
|
||||
return (0);
|
||||
return (fill_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
int
|
||||
@ -130,12 +122,7 @@ procfs_write_fpregs(p, fpregs)
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
if (p == fpcurproc)
|
||||
fpcurproc = NULL;
|
||||
|
||||
bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs);
|
||||
return (0);
|
||||
return (set_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user