0

I am new to xtensa architecture and as the first step tried to map the reset vector. Google search took me to Uboot port of xtensa (https://github.com/jcmvbkbc/u-boot-tensa/blob/master/arch/xtensa/cpu/start.S), and following is the code;

.section .ResetVector.text, "awx"
.global _ResetVector
   _ResetVector:

 j  1f
.align 4
    2:  .long   _start
    1:  l32r    a2, 2b
       jx   a2

I got the xtensa ISA from the link https://0x04.net/~mwk/doc/xtensa.pdf (section 3.8.4 for jump instruction)

Here is my question;

    j  1f   

should move the pc by '1f', then what is the use of the code after that?
What is the use of the labels 2: and 1:?

This stops me further from trying to understand the rest of the code. I appreciate in advance for any help to understand the code better and any additional reference on how to map the vectors in xtensa. I am NOT sure if the tags are appropriate, but I could not create a tag xtensa so I chose the closest I could.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847

1 Answers1

1

1f is not a hex value, it's a local label reference. See the manual. The author was just lazy or didn't think it important enough to pick better label names. The code is equivalent to:

    j  skip
.align 4
 addr:
    .long   _start
 skip:
    l32r    a2, addr
    jx   a2

As such the first j is there to jump over the embedded data which the l32r subsequently loads and the jx jumps to.

Jester
  • 56,577
  • 4
  • 81
  • 125