[OpenBIOS] [PATCH] ppc: fix stack usage in mmu_claim, mem_claim
Cormac O'Brien
i.am.cormac.obrien at gmail.com
Wed Jun 17 22:19:41 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.
Signed-off-by: Cormac O'Brien <i.am.cormac.obrien at gmail.com>
---
arch/ppc/qemu/methods.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/arch/ppc/qemu/methods.c b/arch/ppc/qemu/methods.c
index fd993da..d587dc7 100644
--- a/arch/ppc/qemu/methods.c
+++ b/arch/ppc/qemu/methods.c
@@ -168,17 +168,17 @@ DECLARE_NODE( mmu_ciface, 0, 0, "+/openprom/client-services" );
static void
mem_claim( void )
{
+ phys_addr_t phys = -1UL;
ucell align = POP();
ucell size = POP();
- ucell phys = POP();
- ucell ret = ofmem_claim_phys( phys, size, align );
- 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 --- ) */
@@ -192,17 +192,18 @@ mem_release( void )
static void
mmu_claim( void )
{
- ucell align = POP();
- ucell size = POP();
- ucell phys = POP();
- ucell ret = ofmem_claim_virt( phys, size, align );
+ ucell virt, size, align;
+ virt = -1UL;
+ align = POP();
+ size = POP();
- 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 --- ) */
--
2.4.3
More information about the OpenBIOS
mailing list