Jamie Prescott writes: > > From: Adam Nemet <ane...@caviumnetworks.com> > > Jamie Prescott writes: > > > static inline int set_prop(char const *path, char const *name, > > > void const *data, int size) > > > { > > > int error; > > > > > > asm volatile ("int\t11\n\t" > > > : "=a0" (error): "a0" (path), "a1" (name), "a2" > > > (data), > > > "a3" (size)); > > > > > > return error; > > > } > > > > > > extern int calc(int); > > > > > > int proc(int i) > > > { > > > int j = calc(i); > > > > > > return set_prop(0, 0, &j, sizeof(int)); > > > } > > ... > > > > > > Why is the memory clobber required, and why GCC does not understand to > > > sync the value to memory when passing the address to a function? > > > > Because you never inform GCC that you will use the value at > > address *NAME. Try to use "m"(*name) rather than "a1"(name) in the asm. > > That's 'data', not 'name'. But OK, got it. unfortunately, I cannot use "m" > since > that value need to go into a specific register. > Any other solution?
You can also have it *in addition* as an argument to the asm that's never used: asm volatile ("int\t11\n\t" : "=a0" (error): "a0" (path), "a1" (name), "a2" (data), "a3" (size), "m"(*data)); after changing data's type into something that can be dereferenced. Adam