Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:58:25+00:00 2026-06-04T03:58:25+00:00

I am trying to pass more than four parameters from my C++ code to

  • 0

I am trying to pass more than four parameters from my C++ code to Assembly.

The C++ function looks like :

static float armFunction(float, float, float, float, float);

I can retrieve the first four parameters from the registers r0-r3 without any problem.

I expect that my fifth float argument is on the stack and i should be able to access it using the stack pointer sp e.g. I try to load my fifth argument in r4 like :

ldr r4, [sp]

or even:

ldr r4, [sp, #-0x4]

But this doesn’t work and the assembly code immediately exits with some stack corruption output.

My complete assembly code looks like this here: http://pastie.org/3933875

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:58:27+00:00Added an answer on June 4, 2026 at 3:58 am

    My asm code has no trouble reading the 5th parameter from a JNI call from C to asm. Here are the first 2 lines of my asm function:

      stmfd    sp!,{r4-r12,lr}
      ldr      r12,[sp,#40]   @ first stack variable
    

    In the case where you’re not needing to preserve any registers, the 5th parameter is on the top of the stack:

      ldr r12,[sp]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to pass two parameters to a function, i being an int value
I am trying to pass parameters from Visual Studio using VB.net to a Crystal
Essentially what I'm trying to do is fairly simple....pass more than one parameter (4
I am trying to pass multiple options for UIView 's transitionWithView:duration:options:animations:completion: method. More specifically,
Trying to pass a string argument to a function, which will then be used
I'm trying to find all coverage_set_id with more than one benefit_id attached summary_attribute (value=2004687).
I'm trying to pass two values to a function, so that i can check
I'm trying to match a URL something like http://example.com/this.is.my.full.hostname/something/else apparently when I pass the
O.K. this is some older code, but it's inserting more than it should. Before
I'm trying to write some metaprogramming code such that: Inheriting from some class foo<c1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.