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

  • SEARCH
  • Home
  • 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 7626839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:22:47+00:00 2026-05-31T05:22:47+00:00

I have a startup code for ARM926ej-s which supports ISA ARMv5TEJ. Startup code looks

  • 0

I have a startup code for ARM926ej-s which supports ISA ARMv5TEJ. Startup code looks like below, but i switched some commands/data with comments for clarity. Lines which are still unclear to me are marked with a comment “@???????????????????????????????????????????????????????“.

I wonder, why do we need to substract “#4” from value (location of “arm926ejs_reset“) stored in register “r3“? And then load it into a stack pointer 4 lines later, where we are setting the stacks for the first processor mode which is fast interrupt mode.

__start:
arm926ejs_reset:

@here there is image header data needed by ISROM

arm926ejs_reset_handler:

    @here we disable MMU, I-cache, D-cache, flush them... and prepare the mcpu.

    LDR   r5, =inVirtMem

    @here we enable MMU.

    MOV   pc, r5 

    NOP
    NOP
    NOP

inVirtMem:
    ADR   r3, arm926ejs_reset @load location of "arm926ejs_reset" label in r3
    MOV   r1, #IF_MASK

    SUB   r3, r3, #4 @???????????????????????????????????????????????????????

    ORR   r0, r1, #MODE_FIQ
    MSR   cpsr_cxsf, r0
    MOV   sp, r3 @???????????????????????????????????????????????????????????
    SUB   r3, r3, #FIQ_STACK_SIZE

...
  • 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-05-31T05:22:49+00:00Added an answer on May 31, 2026 at 5:22 am

    I found similar startup codes as yours on the net which have their code well commented. In this start up code, you can see on Line 186 that r3 is pointing to the MMU base address. MMU spans ahead of its base address. i.e if MMU_BASE_ADDRESS=0x400, MMU entries will be at 0x400, 0x404 0x408 etc. Now in Line 217 r3 is being subtracted by 4 and then assigned to SP on Line 222. If we don’t subtract 4, our first entry of stack ( observe stack is growing in the reverse direction of MMU layout ) will overwrite on the first MMU entry! Hence the subtraction.

    Likewise in your example if we don’t subtract 4, your stack will overwrite on the reset handler itself. Your program will go for a toss.

    One more example is this start up code where they are going to end of IRAM and subtracting 4. End of IRAM implies just outside the IRAM and hence the subtraction to come inside the IRAM

    Observe that stack is growing upwards in this particular example( or towards lower addresses ).( ARM stacks can grow in either ways )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some component code that I'd like to in a CakePHP Task, but
I have a wcf service application that has some application startup code in the
I'd like to have these lines of code executed on server startup (both development
In my assembly startup code for ARM9 i have some lines that i don't
I have a form that opens at startup (frmStart). That form has some code
I have some generic code which I cannot figure out how to legitimately prevent
I have some server startup code that is lying in the models.py of one
I have the following code set up in my Startup IDictionary<string, string> properties =
Introduction I have been so annoyed by applications that have a startup dialog which
I have an outlook add-in which runs only on the first startup of Outlook,

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.