Compatible problem in JIAJIA

In 32-bite system, the size of long and point is 4 Bytes;

In 64-bite system, the size of long and point is 8 Bytes;

There is the key point.

Solution:

We still user the long as the type of address, but only the low four bytes is used actually.

1 Initial the long variable as zero.

2 In mem.c line 760

previous 

unsigned long s2l(unsigned char *str)                                                                              
{union {                                                                                                           
    unsigned long l;                                                                                               
    unsigned char c[Intbytes];                                                                                     
         } notype;                                                                                                   
                                                                                                                    
 notype.c[0]=str[0];                                                                                                
 notype.c[1]=str[1];                                                                                                
 notype.c[2]=str[2];                                                                                                
 notype.c[3]=str[3];                                                                                                                                                                                                   
 return(notype.l);                                                                                                  
 }          

Modified

unsigned int s2l(unsigned char *str)
 {union {                      
     unsigned int l;           
     unsigned char c[Intbytes];
        } notype;              
  
 notype.c[0]=str[0];           
 notype.c[1]=str[1];           
 notype.c[2]=str[2];           
 notype.c[3]=str[3];           
 return(notype.l);             
 }

3 In syn.h line 45

Previous

#define stol(x)      (*((unsigned long *) (x))) 
typedef struct wtnttype {
 
    unsigned char*  wtnts[Maxwtnts];
    
 
     int             from[Maxwtnts];   /*from pid or from scope*/
     int             wtntc;
     struct wtnttype *more;
 } wtnt_t;


Modified

#define stol(x)      (*((unsigned int *) (x)))
typedef struct wtnttype {
 
     unsigned int  wtnts[Maxwtnts];
 
     int             from[Maxwtnts];   /*from pid or from scope*/
     int             wtntc;
     struct wtnttype *more;
 } wtnt_t;


4 In syn.c line 75 and 76

Previous

void grantlock(long lock, int toproc, int acqscope);
void grantbarr(long lock);

Modified

void grantlock(int lock, int toproc, int acqscope);
void grantbarr(int lock);



發佈了52 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章