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

Re: [Debian Wiki] Update of "ArmEabiTodo" by nchip


Thanks for your work on submitting ARM EABI patches to the bts.

Regarding the ocaml patch, yes, it does modify a bit of ARM assembly
code outside __ARM_EABI__, but I think it is safe, as all it does is
preventing pushing r10 onto the stack and popping it off again (to
make sure the stack is 64bit aligned) in the following code sequence:

	ldr	r10, .Lcaml_bottom_of_stack
	str	sp, [r10, #0]
    /* Save integer registers and return address on stack */
-	stmfd	sp!, {r0,r1,r2,r3,r4,r5,r6,r7,r10,r12,lr}
+	stmfd	sp!, {r0,r1,r2,r3,r4,r5,r6,r7,r12,lr}

As you can see, r10 gets thrashed only a couple of lines above.
The restore code also thrashes the restored value immediately

-	ldmfd	sp!, {r0,r1,r2,r3,r4,r5,r6,r7,r10,r12}
+	ldmfd	sp!, {r0,r1,r2,r3,r4,r5,r6,r7,r12}
    /* Reload return address */
	ldr	r10, .Lcaml_last_return_address

Note that the FPA floating point register saving in this function
is totally broken anyway.  First it saves the registers by doing:

    /* Save non-callee-save float registers */
	stfd	f0, [sp, #-8]!
	stfd	f1, [sp, #-8]!
	stfd	f2, [sp, #-8]!
	stfd	f3, [sp, #-8]!

and then it restores them by doing:

    /* Reload callee-save registers and return */
	ldfd	f4, [sp], #8
	ldfd	f5, [sp], #8
	ldfd	f6, [sp], #8
	ldfd	f7, [sp], #8


Reply to: