[OpenBIOS] [PATCH 4/6] ppc: fix stack usage in mmu_claim, mem_claim
Cormac O'Brien
i.am.cormac.obrien at gmail.com
Sat Jun 20 19:49:00 CEST 2015
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>
---
arch/ppc/qemu/methods.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/arch/ppc/qemu/methods.c b/arch/ppc/qemu/methods.c
index fd993da..cb72bc1 100644
--- a/arch/ppc/qemu/methods.c
+++ b/arch/ppc/qemu/methods.c
@@ -164,21 +164,21 @@ DECLARE_UNNAMED_NODE( mmu, INSTALL_OPEN, 0 );
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 @@ mem_release( void )
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 )
{
--
2.4.4
More information about the OpenBIOS
mailing list