Assembly Help!!

From: Marty (mail2riro_at_yahoo.co.kr)
Date: 07/22/03


Date: 21 Jul 2003 17:07:32 -0700

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.^^



Relevant Pages

  • Re: A "killer" macro
    ... could be included as a feature in another language, ... The "killer" macro, in CL ... of the functional features of Lisp. ... When confronted by fellow programmers with the question "so why is ...
    (comp.lang.lisp)
  • Re: Spell Check Protected Form with Bookmarks
    ... Language ID = wdEnglishUS. ... Bookmarks are not set to calculate on exit. ... The macro to check spelling works, but it assumes that you are working ... because the text fields get set back to not spell check and it does not ...
    (microsoft.public.word.spelling.grammar)
  • OT: sexps for other languages?
    ... macro system that is a little more powerful than C's. ... One of the big challenges is that some branch instructions have ... Following in the tradition of early C++, this language would be ... Coming back to the (incf asm) topic: I'm still very much a lisp ...
    (comp.lang.lisp)
  • Re: i disagree
    ... assembly language source file must match the machine instructions 1:1 ... One such short-cut we are used to is simply dropping "macro" when ... language maps to three machine instructions. ... powerful enough Macros system, implemented inside a Macro Assembler, ...
    (alt.lang.asm)
  • Re: Macro Question: Paraphrasing
    ... Instead, you will need to put some macro around all the forms that need to be processed, and use a code walker to process each subform, a la ... The programming language has its own grammar rules that are simpler and much more consistent than natural language. ... Far from enforcing English grammar rules on Lisp, these ideas entail adding context to arbitrary ordering and paraphrasing awkward expressions. ... The variable clauses resemble dependent clauses, and the main clause represents the independent clause. ...
    (comp.lang.lisp)