This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Where are function parameters/return values stored?

Hi,

I'm looking at calling an ASM routine from some C code. I'd like to pass some parameters into the ASM routine, and have it return a value. I don't believe function arguments are passed on the stack, but am not sure of the general mechanism that is used. Any advice?

Thanks

David


Parents
  • A struct that is returned from a function:

    struct bob_st func (void)
    {
    .
    .
    .
    }
    

    is returned via pointer in R1, R2, and R3.

    A struct passed to a function:

    void func (struct bob_st)
    {
    .
    .
    .
    }
    

    is passed in fixed memory locations using the usual passing conventions. Registers are NOT used for passing a struct as an argument.

    Jon

Reply
  • A struct that is returned from a function:

    struct bob_st func (void)
    {
    .
    .
    .
    }
    

    is returned via pointer in R1, R2, and R3.

    A struct passed to a function:

    void func (struct bob_st)
    {
    .
    .
    .
    }
    

    is passed in fixed memory locations using the usual passing conventions. Registers are NOT used for passing a struct as an argument.

    Jon

Children
No data