Trouble-lling
Trouble-lling

Reputation: 333

Inserting the address of a constant in inline assembly code

I want to translate this function:

iowrite32(mem1, value1);

into assembly code.

mem1 is defined as:

int * mem1;

in order to use ioremap.

I've written this code:

asm volatile(
    "mov    %[whr],%[wht]"
    : [whr] "=r" (mem1)
    : [wht] "r" (value)
);

Then I've realized I don't want to move value to mem1, but to the ADDRESS stored in mem1. How do I write it in assembly?

Upvotes: 0

Views: 380

Answers (1)

NoWiS
NoWiS

Reputation: 414

You might want to take a look at the m constraint

asm volatile(
    "mov    %[wht], %[whr];"
    : [whr] "=m" (*mem1)                                                   
    : [wht] "r" (value)
);

Upvotes: 1

Related Questions