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 7816285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:48:54+00:00 2026-06-02T05:48:54+00:00

I have a simple function written in ARM assembler. The first time it’s ran,

  • 0

I have a simple function written in ARM assembler. The first time it’s ran, everything works as desired (it prints BOOT\n). However, the second time the function is executed, nothing is printed.

.globl __printTest
.text
.align 2

__printTest:
 sub sp, #64 /* yes, I know this is too much */

 mov r0, #66
 str r0, [sp]
 mov r0, #79
 str r0, [sp, #1]
 mov r0, #79
 str r0, [sp, #2]
 mov r0, #84
 str r0, [sp, #3]
 mov r0, #10
 str r0, [sp, #4]

 mov r0, #0
 mov r1, sp
 mov r2, #5

 bl _write
 add sp, #64

 bx lr

What could be the issue? I suspect that this somehow screws up the buffer that it no longer works. Write is a function that calls the write syscall on Linux using the svc instruction.

  • 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-02T05:48:55+00:00Added an answer on June 2, 2026 at 5:48 am

    The problem is that you’re not saving lr.

         bl _write
         add sp, #64
         bx lr
    

    bl _write will overwrite lr which then points to add sp, #64, so your bx lr will just result in an endless loop on the last two instructions.

    It should work if you modify your code like this:

    __printTest:
     push {lr}
     sub sp, #64 /* yes, I know this is too much */
     ....
     bl _write
     add sp, #64
     pop {pc}
    

    As already stated in another answer, you should also use strb instead of str for byte-stores.

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

Sidebar

Related Questions

I have written a very simple function: function editCategory() { $ID = urlencode($_GET['id']); $cname
I have written a simple jQuery.ajax function which loads a user control from the
I have simple from written on C/gtk+ and i have function in this appliction.
I have written a simple function: function inputChanged() { $('input').change(function(){ $(this).addClass('changed'); }); } I
I have written some simple jquery code : function Generate(result, counter) { $(#ArchivesContent).append( <table
I have written a simple script that calls a function in a while loop.
I have written a simple timer function and compiled in g++, and strangely it
I have a simple function written in Oracle 9i (version 9.2.0.4.0) to simulate an
I have written simple first stage bootloader which displays Hello world using interrupt to
I have a simple function written to check for directories: :direxist if not exist

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.