All of lore.kernel.org
 help / color / mirror / Atom feed
* 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

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.