Skip to contentSkip to conversation

about ".set push"

U-Boot-Users wangjiankun820624 2 participants 2 messages May 23, 2008

lore
Share & tools
lore
#0 lore raw

Hello,
the following codes below comes from the file of u-boot\lib_mips\octeon_boot.c. I don't know the function of the ".set push", and I don't know which type of the "push", symbol,dirctive or others? I read this section, but make me more confused.
Please help me, thanks!
set

Syntax: .set symbol, expression

Set the value of symbol to expression. This changes symbol's value and type to conform to expression. If symbol was flagged as external, it remains flagged (see Symbol Attributes).

You may .set a symbol many times in the same assembly.

If you .set a global symbol, the value stored in the object file is the last value stored into it.

void octeon_write64(uint64_t csr_addr, uint64_t val)

{

    volatile uint32_t val_low  = val & 0xffffffff;

    volatile uint32_t val_high = val  >> 32;

 

    volatile uint32_t addr_low  = csr_addr & 0xffffffff;

    volatile uint32_t addr_high = csr_addr  >> 32;

 

    asm volatile (

      "  .set push                         \n"

      "  .set mips64                       \n"

      "  .set noreorder                    \n"

      /* Standard twin 32 bit -> 64 bit construction */

      "  dsll  %[valh], 32                 \n"

      "  dsll  %[vall], 32          \n"

      "  dsrl  %[vall], 32          \n"

      "  daddu %[valh], %[valh], %[vall]   \n"

      /* Combined value is in valh */

      /* Standard twin 32 bit -> 64 bit construction */

      "  dsll  %[addrh], 32                 \n"

      "  dsll  %[addrl], 32          \n"

      "  dsrl  %[addrl], 32          \n"

      "  daddu %[addrh], %[addrh], %[addrl]   \n"

      /* Combined value is in addrh */

      "  sd %[valh], 0(%[addrh])   \n"

      "  .set pop                          \n"

      : : [valh] "r" (val_high), [vall] "r" (val_low), [addrh] "r" (addr_high), [addrl] "r" (addr_low): "memory");

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080523/210de729/attachment.htm

#1 lore raw
Quoted 1 line · On Fri, 23 May 2008 16:21:24 +0800 (CST) wangjiankun820624…

I don't know the function of the ".set push", and I don't know which type of the "push", symbol,dirctive or others?

From the as info pages ("info as"):

The directives .set push' and .set pop' may be used to save and restore the current settings for all the options which are controlled by .set'. The .set push' directive saves the current settings on a stack. The `.set pop' directive pops the stack and restores the settings.

I think what it means here is in the context of the assembly:

Quoted 6 lines
      "  .set push                         \n"
      "  .set mips64                       \n"
      "  .set noreorder                    \n"

[...]
" .set pop \n"

That regardless of if reordering was on or off where the inlined call was made, it should be restored to it's old value by the ".set pop". The same for the other directives.

// Simon