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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:40:38+00:00 2026-05-29T21:40:38+00:00

I have an iPhone app that I am disassembling. It is my understanding that

  • 0

I have an iPhone app that I am disassembling.

It is my understanding that a CBNZ instruction is “Compare and Branch on Non-Zero.” and a CBZ is “Compare and Branch on Zero”

I can not find anywhere online to confirm this but to me it seems that CBNZ is represented by B9 in an address like so “0x B9 DC” and CBZ is “0x B3 DC”.

The full address is:
DC B9 53 48 03 99 78 44 00 68 BF F1 74 EE 51 49

I am modifying it to:
DC B3 53 48 03 99 78 44 00 68 BF F1 74 EE 51 49

Previously I had patched this same check in ARMv6 though it was represented by a BNE “0x D1 30″ that I patched to a B “0x E0 32″

This:
32 D1 5B 48 5C 49 78 44 79 44 00 68 09 68 AC F1

To:
32 E0 5B 48 5C 49 78 44 79 44 00 68 09 68 AC F1

This behaved exactly how I expected to, taking the branch and continuing on as I wanted it to. Normally it only takes such branch if it passes a check.

I figured patching a CBNZ to a CBZ would have similar results though it seems not.

Hope someone can help me understand. Sorry if this is not a forum where I should post questions like this though it seems like a good place to ask. If you need more info I will be happy to provide.

  • 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-29T21:40:40+00:00Added an answer on May 29, 2026 at 9:40 pm

    To understand the assembly, you need to go to bit level. If you don’t want to spend time to understand the ARM encoding, get a disassembler (e.g. otool -tV) and an assembler (e.g. as) and they will figure out the instruction encoding/decoding for you.


    The encoding of the CBZ/CBNZ instructions are

    15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0   <-- bit
     1  0  1  1 op  0  i  1 [         imm5][     Rn]  <-- meaning
    

    where op = 1 means CBNZ, op = 0 means CBZ, ‘i :imm5:0′ is the relative address to jump, and Rn is the register to check (see ARMv7-ARM §A8.6.27).

    Therefore, the word B9DC, in binary,

    (1  0  1  1 op  0  i  1 [         imm5][     Rn])
     1  0  1  1  1  0  0  1 [1  1  0  1  1][1  0  0]
    

    means

    • op = 1
    • i = 0
    • imm5 = 11011
    • Rn = 100

    means

    CBNZ R4, (PC+54)   ; 54 = 0b0110110
    

    while B3DC, in binary,

    (1  0  1  1 op  0  i  1 [         imm5][     Rn])
     1  0  1  1  0  0  1  1 [1  1  0  1  1][1  0  0]
    

    means

    • op = 0
    • i = 1
    • imm5 = 11011
    • Rn = 100

    means

    CBZ R4, (PC+118)  ; 118 = 0b1110110
    

    Note that your patch B9 → B3 changed the i bit as well, which changed the address it should jump to. You should only change the op bit, meaning you should patch the byte as B1.

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

Sidebar

Related Questions

I have an iPhone app that uses an action sheet but I can't work
I have an iPhone app that is using sqlite 3.6 (not with FMDB) to
We have an iPhone app that can display an image dataset and pass it
Essentially, I currently have an iPhone app that can query and parse an XML
I have an iPhone app that hides the status bar. However, my main view
I have an iPhone app that compiles and runs fine in the Simulator on
I have an iPhone app that heavily relies on the OpenCV library; as such,
I have an iPhone app that is based on a navigation controller. I have
I have an iphone app that I built based off a tutorial (for a
I have an iPhone app that shows a simple view (View 1) that has

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.