How to identify the function parameters when calling a function written in assembly from C?

Viewed 40
func cactus_entrypoint
    /* Entry reason is primary EC cold boot */
    mov x19, #1
secondary_cold_entry:
    /* Entry reason is secondary EC cold boot */
    mrs x0, mpidr_el1
    bl  platform_get_core_pos

    /* Setup the stack pointer. */
    adr x1, stacks_end
    mov x2, #CACTUS_STACKS_SIZE
    mul x2, x0, x2
    sub sp, x1, x2

The above code snippet is from cactus_entrypoint.S. The cactus_entrypoint and secondary_cold_entry function is called from a C program. In the C source code, I see declaration like this:

extern void cactus_entrypoint(uint64_t arg);
extern void secondary_cold_entry(void);

Why and how do I see that cactus_entrypoint takes 1 parameter and secondary_cold_entry does not take parameters from the assembly code?

1 Answers
void hello ( uint64_t );

void world ( void )
{
    hello(0x12345678AABBCCDDULL);
}

Disassembly of section .text:

0000000000000000 <world>:
   0:   d2999ba0    mov x0, #0xccdd                 // #52445
   4:   f2b55760    movk    x0, #0xaabb, lsl #16
   8:   f2cacf00    movk    x0, #0x5678, lsl #32
   c:   f2e24680    movk    x0, #0x1234, lsl #48
  10:   14000000    b   0 <hello>
Related