summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1998-09-14 22:43:40 +0000
committerjdp <jdp@FreeBSD.org>1998-09-14 22:43:40 +0000
commit60718890ae203c5e84c8b90f13763bf7a87e7afb (patch)
tree3631f22c088f449c222f0399cb2d77033762962b
parentbf32f01fb996d7e78702cb9d770b1459c413f597 (diff)
downloadFreeBSD-src-60718890ae203c5e84c8b90f13763bf7a87e7afb.zip
FreeBSD-src-60718890ae203c5e84c8b90f13763bf7a87e7afb.tar.gz
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.
-rw-r--r--sys/alpha/alpha/machdep.c29
-rw-r--r--sys/alpha/alpha/procfs_machdep.c19
-rw-r--r--sys/alpha/include/md_var.h8
-rw-r--r--sys/amd64/amd64/machdep.c20
-rw-r--r--sys/amd64/include/md_var.h4
-rw-r--r--sys/amd64/include/reg.h3
-rw-r--r--sys/i386/i386/machdep.c20
-rw-r--r--sys/i386/i386/procfs_machdep.c8
-rw-r--r--sys/i386/include/md_var.h4
-rw-r--r--sys/i386/include/reg.h3
-rw-r--r--sys/powerpc/include/md_var.h8
-rw-r--r--sys/powerpc/powerpc/procfs_machdep.c19
12 files changed, 99 insertions, 46 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 26b06d6..21a970e 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -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)
diff --git a/sys/alpha/alpha/procfs_machdep.c b/sys/alpha/alpha/procfs_machdep.c
index 11898d0..621280a 100644
--- a/sys/alpha/alpha/procfs_machdep.c
+++ b/sys/alpha/alpha/procfs_machdep.c
@@ -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
diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h
index 3dfdad2..cd2e667 100644
--- a/sys/alpha/include/md_var.h
+++ b/sys/alpha/include/md_var.h
@@ -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_ */
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 69ad611..12cfb08 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -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)
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index 0db9334..de71059 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -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));
diff --git a/sys/amd64/include/reg.h b/sys/amd64/include/reg.h
index 5d36f27..3e97fc1 100644
--- a/sys/amd64/include/reg.h
+++ b/sys/amd64/include/reg.h
@@ -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
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 69ad611..12cfb08 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -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)
diff --git a/sys/i386/i386/procfs_machdep.c b/sys/i386/i386/procfs_machdep.c
index d8e60b9..03a8d9d 100644
--- a/sys/i386/i386/procfs_machdep.c
+++ b/sys/i386/i386/procfs_machdep.c
@@ -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
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index 0db9334..de71059 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -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));
diff --git a/sys/i386/include/reg.h b/sys/i386/include/reg.h
index 5d36f27..3e97fc1 100644
--- a/sys/i386/include/reg.h
+++ b/sys/i386/include/reg.h
@@ -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
diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h
index 3dfdad2..cd2e667 100644
--- a/sys/powerpc/include/md_var.h
+++ b/sys/powerpc/include/md_var.h
@@ -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_ */
diff --git a/sys/powerpc/powerpc/procfs_machdep.c b/sys/powerpc/powerpc/procfs_machdep.c
index 11898d0..621280a 100644
--- a/sys/powerpc/powerpc/procfs_machdep.c
+++ b/sys/powerpc/powerpc/procfs_machdep.c
@@ -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
OpenPOWER on IntegriCloud