* I have a problem with inline ASM
@ 2002-07-04 21:18 alter Gonzalez
2002-07-05 1:16 ` h-peter recktenwald
0 siblings, 1 reply; 2+ messages in thread
From: alter Gonzalez @ 2002-07-04 21:18 UTC (permalink / raw)
To: linux-assembly, wgonzalez
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: I have a problem with inline ASM
2002-07-04 21:18 I have a problem with inline ASM alter Gonzalez
@ 2002-07-05 1:16 ` h-peter recktenwald
0 siblings, 0 replies; 2+ messages in thread
From: h-peter recktenwald @ 2002-07-05 1:16 UTC (permalink / raw)
Cc: linux-assembly, wgonzalez
On Thu, 04 Jul 2002 16:18:20 -0500
alter Gonzalez <wgonzalez@persystems.com> wrote:
>
> WORD rol_word(WORD value, BYTE bits)
> {
> __asm__ __volatile__("movl %1, %%eax;
> movb %2, %%cl;
> roll %%cl, %%eax;
rolls through 32 bit
> movl %%eax, %0;"
> :"=eax"(value) // output
> :"eax"(value),"cl"(bits) // input
> );
--
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-05 1:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-04 21:18 I have a problem with inline ASM alter Gonzalez
2002-07-05 1:16 ` h-peter recktenwald
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.