IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

x86 32-bits / 64-bits Assembleur Discussion :

Besoin de votre aide pour opcode RCL


Sujet :

x86 32-bits / 64-bits Assembleur

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2011
    Messages
    905
    Détails du profil
    Informations personnelles :
    Localisation : France, Vienne (Poitou Charente)

    Informations forums :
    Inscription : Mai 2011
    Messages : 905
    Points : 85
    Points
    85
    Par défaut Besoin de votre aide pour opcode RCL
    Bonjour,

    Je cherche à reproduire l'instruction RCL , mais je n'y arrive pas.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    void _emurol(PPROCESSOR pp,DWORD &v,BYTE imm8,BYTE _eb)
    {
    	if (imm8==0)
    		return;
     
    	DWORD eb=e2pb(_eb);
    	BYTE count=imm8;
    	DWORD _v=v;
    	DWORD *flags=pp->registers.eflags;
    	BYTE tmpcf=0;
    	while (count!=0)
    	{
    		tmpcf=((_v&eb)==eb);
     
    		_v<<=1;
    		_v+=tmpcf;
    		count--;
    	}
    	//debug
    	if (tmpcf==0)
    			(*flags)&=~LF_MASK_CF;
    	else
    		(*flags)|=LF_MASK_CF;
    	if (imm8==1)
    	{
    		BYTE otmpcf=((_v&eb)==eb);
    		if (otmpcf!=tmpcf)		
    			(*flags)|=LF_MASK_OF;
    		else
    			(*flags)&=~LF_MASK_OF;
    	}
    	v=_v;
     
     
    }
    void _emurcl(PPROCESSOR pp,DWORD &v,BYTE imm8,BYTE _eb)
    {
    	if (imm8==0)
    		return;
    	DWORD *flags=pp->registers.eflags;
    	BYTE tmpcf=((*flags)&LF_MASK_CF)==LF_MASK_CF;
    	DWORD eb=e2pb(_eb);
    	BYTE count=imm8;
    	DWORD _v=v;
     
     
     
    	_emurol(pp,_v,imm8-1,_eb);
    	_v<<=1;
    	_v|=tmpcf;
    	if (imm8==1)
    	{
    		BYTE otmpcf=((v&eb)==eb);
    		if (otmpcf!=tmpcf)		
    			(*flags)|=LF_MASK_OF;
    		else
    			(*flags)&=~LF_MASK_OF;
    	}
    	v=_v;
    }
    Pour les instruction SHR,SAR,ROL,ROR,SAL,SAR , j'y suis arriver.
    La fonctions _emurol est bon , mais pas la fonction _emurcl.

    Info structure :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #define LF_MASK_CF 0x01
    #define LF_MASK_AF 0x10
    #define LF_MASK_ZF 0x40
    #define LF_MASK_SF 0x80
    #define LF_MASK_PF 0x04
    #define LF_MASK_OF 0x800
    #define LF_MASK_DF 0x400
     
    typedef struct {
    	//....
    	DWORD _eflags;
    	//....
    	DWORD *eflags;
    	//....
    }TREGISTERS;
     
    typedef struct {
    	//....
    	TREGISTERS registers;
    	//.....
    }TPROCESSOR,*PPROCESSOR;

    merci de votre aide.

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2011
    Messages
    905
    Détails du profil
    Informations personnelles :
    Localisation : France, Vienne (Poitou Charente)

    Informations forums :
    Inscription : Mai 2011
    Messages : 905
    Points : 85
    Points
    85
    Par défaut
    Résolu avec ceux-ci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    void _emurcl(PPROCESSOR pp,DWORD &v,BYTE imm8,BYTE _eb)
    {
    	if (imm8==0)
    		return;
    	DWORD *flags=pp->registers.eflags;
    	BYTE getB_CF=((*flags)&LF_MASK_CF);
    	DWORD result_32;
    	DWORD op1_32=v;
    	DWORD count=imm8;
        if (count==1) {
    		result_32 = (op1_32 << 1) | (getB_CF);
    	  }
    	  else {
    		result_32 = (op1_32 << count) | (getB_CF << (count - 1)) |
    					(op1_32 >> (/*33*/ (_eb+1) - count));
    	  }
        BYTE cf = (op1_32 >> (/*32*/_eb - count)) & 0x1;
        BYTE of = cf ^ (result_32 >> (_eb-1)/*31*/); // of = cf ^ result31 
    	if (cf==1)
    		(*flags)|=LF_MASK_CF;
    	else
    		(*flags)&=~LF_MASK_CF;
    	if (imm8==1)
    	{
    		if(of==1)
    			(*flags)|=LF_MASK_OF;
    		else
    			(*flags)&=~LF_MASK_OF;
    	}
    	v=result_32;
    }
     
    void _emushr(PPROCESSOR pp,DWORD &v,BYTE imm8,BYTE _eb)
    {
    	if (imm8==0)
    		return;
    	DWORD eb=e2pb(_eb);
    	DWORD *flags=pp->registers.eflags;
     
    	v>>=(imm8-1);
    	if ((v&1)==1)
    		(*flags)|=LF_MASK_CF;
    	else
    		(*flags)&=~LF_MASK_CF;
    	v>>=1;
    	if (imm8==1)
    	{
    		BYTE tmpcf=(v&eb)==eb;
     
    		if (tmpcf!=1)
    			(*flags)&=~LF_MASK_OF;
    		else
    			(*flags)|=LF_MASK_OF;
    	}
     
     
    }
    Merci à Bochs

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 16
    Dernier message: 01/02/2007, 16h04
  2. J'ai besoin de votre aide pour une requête
    Par ovdz dans le forum Langage SQL
    Réponses: 6
    Dernier message: 20/05/2005, 11h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo