Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2013 15:57:16 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r259653 - in projects/specific_leg/sys/arm: arm include
Message-ID:  <201312201557.rBKFvG9d020578@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Fri Dec 20 15:57:15 2013
New Revision: 259653
URL: http://svnweb.freebsd.org/changeset/base/259653

Log:
  Correctly allocate enough space on the stack for the boot params. As this
  bug can be hidden by the stack alignment use the stack pointer before we
  align the stack to help catch this if it happens again.

Modified:
  projects/specific_leg/sys/arm/arm/locore.S
  projects/specific_leg/sys/arm/include/cpu.h

Modified: projects/specific_leg/sys/arm/arm/locore.S
==============================================================================
--- projects/specific_leg/sys/arm/arm/locore.S	Fri Dec 20 15:46:24 2013	(r259652)
+++ projects/specific_leg/sys/arm/arm/locore.S	Fri Dec 20 15:57:15 2013	(r259653)
@@ -211,10 +211,10 @@ mmu_done:
 	ldr	pc, .Lvirt_done
 
 virt_done:
-	mov	r1, #20			/* loader info size is 20 bytes also second arg */
+	mov	r1, #28			/* loader info size is 28 bytes also second arg */
 	subs	sp, sp, r1		/* allocate arm_boot_params struct on stack */
-	bic	sp, sp, #7		/* align stack to 8 bytes */
 	mov	r0, sp			/* loader info pointer is first arg */
+	bic	sp, sp, #7		/* align stack to 8 bytes */
 	str	r1, [r0]		/* Store length of loader info */
 	str	r9, [r0, #4]		/* Store r0 from boot loader */
 	str	r8, [r0, #8]		/* Store r1 from boot loader */

Modified: projects/specific_leg/sys/arm/include/cpu.h
==============================================================================
--- projects/specific_leg/sys/arm/include/cpu.h	Fri Dec 20 15:46:24 2013	(r259652)
+++ projects/specific_leg/sys/arm/include/cpu.h	Fri Dec 20 15:57:15 2013	(r259653)
@@ -35,6 +35,11 @@ get_cyclecount(void)
 
 extern vm_offset_t vector_page;
 
+/*
+ * Params passed into initarm. If you change the size of this you will
+ * need to update locore.S to allocate more memory on the stack before
+ * it calls initarm.
+ */
 struct arm_boot_params {
 	register_t	abp_size;	/* Size of this structure */
 	register_t	abp_r0;		/* r0 from the boot loader */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312201557.rBKFvG9d020578>