Skip to contentSkip to conversation

Want comments regarding patch

DISCUSSION Bodo Eggert 3 participants 3 messages Dec 30, 2006 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 10 lines · Jan Engelhardt
Quoted 5 lines · Daniel Marjamäki

It was my goal to improve the readability. I failed.

I personally prefer to use standard functions instead of writing code. In my opinion using standard functions means less code that is easier to read.

Hm in that case, what about having something like

Quoted 7 lines

void *memset_int(void *a, int x, int n) {

    asm("mov %0, %%esi;
         mov %1, %%eax;
         mov %2, %%ecx;
         repz movsd;",
       a,x,n);
}

This would copy the to-be-initialized buffer somewhere, if it compiles.

1) You want stosd, "store string", not "move string"
2) You'll want to set %%di (destination index) instead of %%si.
3) repz should be illegal for movs, it might be interpreted as rep by defective assemblers, since it generates the same prefix. "rep" is correct here, since you don't want to break on (non-)zero-words.
4) Mind the direction flag.

#6 lore raw
Quoted 19 lines · Bodo Eggert
Quoted 10 lines · Jan Engelhardt
Quoted 5 lines · Daniel Marjamäki

It was my goal to improve the readability. I failed.

I personally prefer to use standard functions instead of writing code. In my opinion using standard functions means less code that is easier to read.

Hm in that case, what about having something like

Quoted 7 lines

void *memset_int(void *a, int x, int n) {

    asm("mov %0, %%esi;
         mov %1, %%eax;
         mov %2, %%ecx;
         repz movsd;",
       a,x,n);
}
Quoted 1 line

This would copy the to-be-initialized buffer somewhere, if it compiles.

Yeah I don't do assembler soo often that I would know everything from heart. All your comments are valid of course. I just wanted to point out the idea. (However, if it's not repz, then it's repnz! :-)

	-`J'
#7 lore raw
Quoted 4 lines

Yeah I don't do assembler soo often that I would know everything from heart. All your comments are valid of course. I just wanted to point out the idea. (However, if it's not repz, then it's repnz! :-)

it's better to use a gcc builtin than handcoding the asm yourself; better for performance at least....
(gcc will pick the best code for the cpu you picked, and yes this changes every generation or so)

Signature · 2 lines
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org