[OpenBIOS] [commit] r1344 - trunk/openbios-devel/arch/ppc/qemu

repository service svn at openbios.org
Sun Jun 21 20:52:45 CEST 2015


Author: mcayland
Date: Sun Jun 21 20:52:44 2015
New Revision: 1344
URL: http://tracker.coreboot.org/trac/openbios/changeset/1344

Log:
ppc: fix stack usage in mmu_claim, mem_claim

The 'phys' argument to mem_claim() and 'virt' argument to mmu_claim() are now
only popped from the stack if the 'align' argument is provided. Exception
throws have been removed to simplify crossing C <-> Forth boundaries and to
maintain consistency with other architectures.

This patch also fixes two stack diagrams with 'phys' arguments instead of
'virt' ones.

Signed-off-by: Cormac O'Brien <i.am.cormac.obrien at gmail.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/arch/ppc/qemu/methods.c

Modified: trunk/openbios-devel/arch/ppc/qemu/methods.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/methods.c	Sun Jun 21 20:52:42 2015	(r1343)
+++ trunk/openbios-devel/arch/ppc/qemu/methods.c	Sun Jun 21 20:52:44 2015	(r1344)
@@ -164,21 +164,21 @@
 DECLARE_NODE( mmu_ciface, 0, 0, "+/openprom/client-services" );
 
 
-/* ( phys size align --- base ) */
+/* ( [phys] size align --- base ) */
 static void
 mem_claim( void )
 {
 	ucell align = POP();
 	ucell size = POP();
-	ucell phys = POP();
-	ucell ret = ofmem_claim_phys( phys, size, align );
+	phys_addr_t phys = -1;
 
-	if( ret == -1 ) {
-		printk("MEM: claim failure\n");
-		throw( -13 );
-		return;
+	if (!align) {
+		phys = POP();
 	}
-	PUSH( ret );
+
+	phys = ofmem_claim_phys(phys, size, align);
+
+	PUSH(phys);
 }
 
 /* ( phys size --- ) */
@@ -188,24 +188,24 @@
 	POP(); POP();
 }
 
-/* ( phys size align --- base ) */
+/* ( [virt] size align --- base ) */
 static void
 mmu_claim( void )
 {
 	ucell align = POP();
 	ucell size = POP();
-	ucell phys = POP();
-	ucell ret = ofmem_claim_virt( phys, size, align );
+	ucell virt = -1;
 
-	if( ret == -1 ) {
-		printk("MMU: CLAIM failure\n");
-		throw( -13 );
-		return;
+	if (!align) {
+		virt = POP();
 	}
-	PUSH( ret );
+
+	virt = ofmem_claim_virt(virt, size, align);
+
+	PUSH(virt);
 }
 
-/* ( phys size --- ) */
+/* ( virt size --- ) */
 static void
 mmu_release( void )
 {



More information about the OpenBIOS mailing list