Hi,
I am trying to call a C function (that calls another function, that calls another one) from an assembler routine. But inside the third function there is a malloc() that keeps on giving me a Data misaligned error. The rest of the function seems to run normally.
Here is what I am doing to call it:
Now, I use r11 as my data storage pointer. The routine pointer is stored into this area. I also use r10 register as a temporary variable here and there.
Is there something wrong with the way I call this C function?
C function:
I am trying to call a C function (that calls another function, that calls another one) from an assembler routine. But inside the third function there is a malloc() that keeps on giving me a Data misaligned error. The rest of the function seems to run normally.
Here is what I am doing to call it:
- Code:
// Push registers to stack
stmfd sp!, {r0-r11}
// Save link register
mov lr, pc
// Assign register pc with [r11, #08]
ldr pc, [r11, #08]
// Pop registers from stack
ldmfd sp!, {r0-r11}
Now, I use r11 as my data storage pointer. The routine pointer is stored into this area. I also use r10 register as a temporary variable here and there.
Is there something wrong with the way I call this C function?
C function:
- Code:
Function 1:
Calls Function 2
Function 2:
Calls Function 3
Function 3:
malloc(); // crash here.