Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fpstate stack alignment



On Fri, Jan 12, 2018 at 07:50:30AM +0100, Martin Husemann wrote:
> The stack (and framepointer) seem to be fine, e851acb0 and e851ae20 resp.,
> but the code generated for fpu_init is strange:

And of course it depends on exact optimization flags.
Gcc is allowed to do this, AFAICT, as nowhere in the struct declaration
we enforce an 8 byte alignemnt, so the patch below is probably the proper
fix.

Martin


Index: reg.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/include/reg.h,v
retrieving revision 1.9
diff -u -p -r1.9 reg.h
--- reg.h	30 Dec 2016 17:54:43 -0000	1.9
+++ reg.h	12 Jan 2018 13:20:33 -0000
@@ -106,7 +106,11 @@ struct fp_qentry {
 struct fpreg {
 	u_int	fr_regs[32];		/* our view is 32 32-bit registers */
 	int	fr_fsr;			/* %fsr */
-};
+}
+#ifdef _KERNEL
+ __aligned(8)				/* asm code uses std instructions */
+#endif
+;
 struct fpstate {
 	struct fpreg fs_reg;
 #define fs_regs fs_reg.fr_regs



Home | Main Index | Thread Index | Old Index