I have a problem with inline ASM
Good morning first all.
I need to do a encrypt routines for linux asm.
tha call is as:
....
unsigned int xorValue;
xorValue = 0x2030;
for (index = 0; index < 0x20; index ++) {
xor_word(*(unsignded int *)&fuffer[index],xorValue);
}
...
The problem is that if I want to use WORD (i.e. unsigned int , or int) values , RHIDE show an error.
I believe that all is fine.
Can you helpme , please?
The .H y .C files are ..
//------------------------------------------------------
//ENCRYPT.H
#ifndef _ENCRYPT_H_
#define _ENCRYPT_H_
...
BYTE rol_byte(BYTE value , BYTE bits); WORD rol_word(WORD value , BYTE bits);
......
#endif
//------------------------------------------------------
//ENCRYPT.C
BYTE rol_byte(BYTE value, BYTE bits)
{
__asm__ __volatile__("movb %1, %%al;
movb %2, %%cl;
rolb %%cl, %%al;
movb %%al, %0;"
:"=al"(value) // output
:"al"(value),"cl"(bits) // input
); return value;
}
WORD rol_word(WORD value, BYTE bits)
{
__asm__ __volatile__("movl %1, %%eax;
movb %2, %%cl;
roll %%cl, %%eax;
movl %%eax, %0;"
:"=eax"(value) // output
:"eax"(value),"cl"(bits) // input
); return value;
}
with inline ASM
Quoted 6 lines · On Thu, 04 Jul 2002 16:18:20 -0500 alter Gonzalez <[email protected]>…
WORD
rol_word(WORD value, BYTE bits)
{__asm__ __volatile__("movl %1, %%eax; movb %2, %%cl; roll %%cl, %%eax;
rolls through 32 bit
Quoted 4 lines
movl %%eax, %0;"
:"=eax"(value) // output
:"eax"(value),"cl"(bits) // input
);Signature · 6 lines
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de NO abusive software patents http://petition.eurolinux.org/pr/pr17.html - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html