Linux assembly list
 help / color / mirror / Atom feed
From: alter Gonzalez <wgonzalez@persystems.com>
To: linux-assembly@vger.kernel.org, wgonzalez@persystems.com
Subject: I have a problem with inline ASM
Date: Thu, 04 Jul 2002 16:18:20 -0500	[thread overview]
Message-ID: <3D24BB9C.E518173C@persystems.com> (raw)

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


             reply	other threads:[~2002-07-04 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-04 21:18 alter Gonzalez [this message]
2002-07-05  1:16 ` I have a problem with inline ASM h-peter recktenwald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D24BB9C.E518173C@persystems.com \
    --to=wgonzalez@persystems.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox