reset the floating-point register state upon exec.
ok guenther@
-/* $OpenBSD: machdep.c,v 1.12 2017/03/13 00:53:56 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.13 2017/04/11 06:52:13 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
#include <machine/kcore.h>
#include <machine/bootconfig.h>
#include <machine/bus.h>
+#include <machine/vfp.h>
#include <arm64/arm64/arm64var.h>
#include <machine/db_machdep.h>
{
struct trapframe *tf;
+ /* If we were using the FPU, forget about it. */
+ if (p->p_addr->u_pcb.pcb_fpcpu != NULL)
+ vfp_discard(p);
+ p->p_addr->u_pcb.pcb_flags &= ~PCB_FPU;
+
tf = p->p_addr->u_pcb.pcb_tf;
memset (tf,0, sizeof(*tf));
-/* $OpenBSD: process_machdep.c,v 1.2 2017/03/21 18:43:40 kettenis Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.3 2017/04/11 06:52:13 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
int
process_read_fpregs(struct proc *p, struct fpreg *regs)
{
- memset(regs, 0, sizeof(*regs));
+ if (p->p_addr->u_pcb.pcb_flags & PCB_FPU)
+ memcpy(regs, &p->p_addr->u_pcb.pcb_fpstate, sizeof(*regs));
+ else
+ memset(regs, 0, sizeof(*regs));
+
return(0);
}
-/* $OpenBSD: reg.h,v 1.2 2017/03/21 18:43:40 kettenis Exp $ */
+/* $OpenBSD: reg.h,v 1.3 2017/04/11 06:52:13 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
};
struct fpreg {
- uint64_t fp_registers[64]; // really 32 128 bit registers.
+ __uint128_t fp_reg[32];
uint32_t fp_sr;
uint32_t fp_cr;
};