Assembly Help!!

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi, there.

I'm kind of a newbie in embedded programming.  Now, I'm customizing
imported BSP to fit our new platform, but Assembly language is killing
me.
I hope your help and thanks, In advance.

* We are using Intel XScale CPU, gcc and as.

Here are my questions.

1) It's a MMU page table making code. I don't understand '->' marked
parts.
It seems like to me that they're macro commands in macro definition. I
mean, It seems like using macro command even though PT_ENTRY macro
definition is not yet finished. and why they need some arguments
within double quote??? What does that mean???

.MACRO PT_ENTRY base,x,ap,p,d,c,b,total=0
.if \total
   .if \total <= 0x40
      .long (\base << 20) | (\x << 12) | (\ap << 10) | (\p << 9) | (\d
<< 5) | (\c << 3) | (\b << 2) | 2
->     PT_ENTRY "(\base+1)",\x,\ap,\p,\d,\c,\b,"(\total-1)"
   .else
       .if \total <= 0x256
->         PT_ENTRY \base,\x,\ap,\p,\d,\c,\b,0x40
->         PT_ENTRY "(\base+0x40)",\x,\ap,\p,\d,\c,\b,"(\total-0x40)"
       .else
->         PT_ENTRY \base,\x,\ap,\p,\d,\c,\b,0x256
->         PT_ENTRY "(\base+0x256)",\x,\ap,\p,\d,\c,\b,"(\total-0x256)"
       .endif
   .endif
.endif
.ENDM


2) In our assembly source file, I can also find some C language coding
too.
Actually, It includes header files and define something in exactly
same way with C. Is it a 'in-line assembly'?? But, I think it's
somewhat different.
Then, How can I call a function, written in C language, in a assembly
file ??

#include "arch/arm/arm.h"


#define CPWAIT(a) \
    mrc         p15, 0, a, c2, c0, 0  /* arbitrary read of CP15 */ ;\
    mov         a, a                  /* wait for it */ ;\
    sub         pc, pc, IMMED4            /* branch to next
instruction */ ;
#define IMMED4  #4  


That's it. I'm sorry for my poor english and foolish question, but
your help would be really helpful to me.

Thanks.^^

Re: Assembly Help!!
Quoted text here. Click to load it

It's a recursive macro.  Here's a simple example:

.MACRO RECURSIVE_TEST value
.if \value
   .long \value
   RECURSIVE_TEST "(\value-1)"
.else
   .long 0x9999
.endif
.ENDM

Write out by hand what will be generated if you call this RECURSIVE_TEST
macro with a value of, say, 4... it will create the following output:

.long 4
.long 3
.long 2
.long 1
.long 0x9999

When you understand why, you'll be able to understand the PT_ENTRY macro.

The quotes are probably just to get around some text substitution rules
in the assember input format.

Cheers,

John


Site Timeline