コード例 #1
0
static void dc_callvm_argLongLong_ppc32_sysv(DCCallVM* in_self, DClonglong L)
{
    DCint* p = (DCint*) &L;
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    /* fillup integer register file */
    if (self->mIntRegs < 7)
    {
        /* next free integer register is even (r0, r2, r3) ? */
        /* if not, skip one integer */
        if (self->mIntRegs & 1) self->mIntRegs++;

        self->mRegData.mIntData[self->mIntRegs++] = p[0];
        self->mRegData.mIntData[self->mIntRegs++] = p[1];
    }
    /* OR push onto stack */
    else
    {
        /* in case, mIntRegs == 7, set it to 8 */
        self->mIntRegs = 8;
        /* align stack to 8 byte boundary */
        dcVecResize(&self->mVecHead , ( dcVecSize(&self->mVecHead) + 7 ) & (-8UL) );
        /* push data */
        dcVecAppend(&self->mVecHead,&L,sizeof(DClonglong));
    }
}
コード例 #2
0
static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;

  dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
  if (self->mArgCount < 2) {
/*
   call kernel
        
        mips:
        lwc1	$f12, 4($5)       <--- byte offset 4
	lwc1	$f13, 0($5)
	lwc1	$f14, 12($5)      <--- byte offset 12 
	lwc1	$f15, 8($5)
        mipsel:
        lwc1	$f12, 0($5)       <--- byte offset 4
	lwc1	$f13, 4($5)
	lwc1	$f14, 8($5)      <--- byte offset 12 
	lwc1	$f15, 12($5)

*/
#if defined(__MIPSEL__)
    /* index 0 and 2 */
    self->mRegData.floats[self->mArgCount*2] = x;
#else
    /* index 1 and 3 */
    self->mRegData.floats[self->mArgCount*2+1] = x;
#endif
  }
  self->mArgCount++;
}
コード例 #3
0
static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;

  dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
  if (self->mArgCount < 2) {
#if defined(DC__Endian_LITTLE)
    self->mRegData.u[self->mArgCount].f[0] = x;
#else
    self->mRegData.u[self->mArgCount].f[1] = x;
#endif
#if 0
    self->mRegData.u[self->mArgCount].f[1] = x;
   call kernel
        
        mips:
        lwc1	$f12, 4($5)       <--- byte offset 4
	lwc1	$f13, 0($5)
	lwc1	$f14, 12($5)      <--- byte offset 12 
	lwc1	$f15, 8($5)
        mipsel:
        lwc1	$f12, 0($5)       <--- byte offset 4
	lwc1	$f13, 4($5)
	lwc1	$f14, 8($5)      <--- byte offset 12 
	lwc1	$f15, 12($5)

#if defined(DC__Endian_LITTLE)
    /* index 0 and 2 */
    self->mRegData.floats[self->mArgCount*2] = x;
#else
    /* index 1 and 3 */
    self->mRegData.floats[self->mArgCount*2+1] = x;
#endif
#endif
  }
コード例 #4
0
static void dc_callvm_argDouble_arm32_thumb_eabi(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;

  /* 64 bit values need to be aligned on 8 byte boundaries */
  dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4);
  dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
}
コード例 #5
0
ファイル: dyncall_callvm_x64.c プロジェクト: QAndot/dyncall
static void dc_callvm_argPointer_x64(DCCallVM* in_self, DCpointer x)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  if(self->mRegCount.i < numIntRegs)
    *(DCpointer*)&self->mRegData.i[self->mRegCount.i++] = x;
  else
    dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));
}
コード例 #6
0
ファイル: dyncall_callvm_x64.c プロジェクト: QAndot/dyncall
static void dc_callvm_argDouble_x64(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  if(self->mRegCount.f < numFloatRegs)
    self->mRegData.f[self->mRegCount.f++] = x;
  else
    dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
}
コード例 #7
0
static void dc_callvm_argFloat_mips_eabi(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_eabi* self = (DCCallVM_mips_eabi*)in_self;
  if (self->mSingleRegs < 8) {
    self->mRegData.mSingleData[self->mSingleRegs++] = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
  }
}
コード例 #8
0
static void dc_callvm_argInt_mips_eabi(DCCallVM* in_self, DCint i)
{
  DCCallVM_mips_eabi* self = (DCCallVM_mips_eabi*)in_self;
  /* fillup integer register file */
  if (self->mIntRegs < 8)
    self->mRegData.mIntData[self->mIntRegs++] = i;
  else
    dcVecAppend(&self->mVecHead, &i, sizeof(DCint));
}
コード例 #9
0
static void dc_callvm_argLongLong_mips_n64(DCCallVM* in_self, DClonglong Lv)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  /* fillup integer register file */
  if (self->mRegCount < 8)
    self->mRegData.mIntData[self->mRegCount++] = Lv;
  else
    dcVecAppend(&self->mVecHead, &Lv, sizeof(DClonglong));
}
コード例 #10
0
static void dc_callvm_argInt_ppc32_darwin(DCCallVM* in_self, DCint i)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    /* fillup integer register file */
    if (self->mIntRegs < 8)
        self->mRegData.mIntData[self->mIntRegs++] = i;
    /* AND push onto stack */
    dcVecAppend(&self->mVecHead,&i,sizeof(DCint));
}
コード例 #11
0
static void dc_callvm_argLongLong_mips_o32(DCCallVM* in_self, DClonglong Lv)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;
    
  /* 64-bit values need to be aligned on 8 byte boundaries */
  dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4);
  dcVecAppend(&self->mVecHead, &Lv, sizeof(DClonglong));
  self->mArgCount += 1;
}
コード例 #12
0
ファイル: dyncall_callvm_x64.c プロジェクト: QAndot/dyncall
static void dc_callvm_argLongLong_x64(DCCallVM* in_self, DClonglong x)
{
  /* A long long always has 64 bits on the supported x64 platforms (lp64 on unix and llp64 on windows). */
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  if(self->mRegCount.i < numIntRegs)
    self->mRegData.i[self->mRegCount.i++] = x;
  else
    dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
}
コード例 #13
0
ファイル: dyncall_callvm_x86.c プロジェクト: MoarVM/dyncall
static void dc_callvm_argInt_x86_win32_fast_gnu(DCCallVM* in_self, DCint x)
{
  DCCallVM_x86* self = (DCCallVM_x86*) in_self;
  if (self->mIntRegs < 2) {
    *( (int*) dcVecAt(&self->mVecHead, sizeof(DCint) * self->mIntRegs ) ) = x;
    ++( self->mIntRegs );
  } else
    dcVecAppend(&self->mVecHead, &x, sizeof(DCint) );
}
コード例 #14
0
ファイル: dyncall_callvm_x64.c プロジェクト: QAndot/dyncall
static void dc_callvm_argStruct_x64(DCCallVM* in_self, DCstruct* s, DCpointer x)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  dcVecAppend(&self->mVecHead, x, s->size);
  /*printf("dc_callvm_argStruct_x64 size = %d\n", (int)s->size);@@@*/
  if (s->size <= 64)
  	  dcArgStructUnroll(in_self, s, x);
  /*else@@@*/
  /*	  dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));@@@*/
}
コード例 #15
0
static void a_double(DCCallVM* in_p, DCdouble x)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
  if (p->f < 8) {
    p->u.D[ p->f ] = x;
    p->f++; 
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCdouble));
  }
}
コード例 #16
0
static void dc_callvm_argDouble_mips_o32(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;
  /* 64-bit values need to be aligned on 8 byte boundaries */
  dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4);
  dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble) );
  if (self->mArgCount < 2)
    self->mRegData.doubles[self->mArgCount] = x;
  self->mArgCount++;
}
コード例 #17
0
static void dc_callvm_argLongLong_sparc64(DCCallVM* in_self, DClonglong x)
{
  DCCallVM_sparc64* self = (DCCallVM_sparc64*)in_self;
  if (self->mIntRegs < IREGS) {
    * ( (DClonglong*) ( dcVecAt(&self->mVecHead, (self->mIntRegs++)*8) ) ) = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
  }
  if (self->mFloatRegs < FREGS) self->mFloatRegs++;
}
コード例 #18
0
static void a_i64(DCCallVM* in_self, DClonglong x)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_self;
  if (p->i < 8) {
    p->I[p->i] = x;
    p->i++;
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DClonglong));
  }
}
コード例 #19
0
static void a_int(DCCallVM* in_self, DCint x)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_self;
  if (p->i < 16) {
    * (DCint*) dcVecAt(&p->mVecHead, p->i) = x;
    p->i += 4;
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCint));
  }
}
コード例 #20
0
static void dc_callvm_argDouble_mips_n64(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  if (self->mRegCount < 8) {
    self->mRegData.mUseDouble |= 1<<( self->mRegCount );
    self->mRegData.mFloatData[self->mRegCount++].d = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble) );
  }
}
コード例 #21
0
static void dc_callvm_argFloat_mips_n64(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  if (self->mRegCount < 8) {
    /*self->mRegData.mFloatData[self->mRegCount++].d = (DCdouble) x;*/
    self->mRegData.mFloatData[self->mRegCount++].f = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
    dcVecSkip(&self->mVecHead, sizeof(DCfloat) );
  }
}
コード例 #22
0
static void a_float(DCCallVM* in_p, DCfloat x)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;

  if (p->f < 8) {
    p->u.S[ p->f << 1 ] = x;
    p->f++;
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCfloat));
    dcVecSkip(&p->mVecHead, 4);	/* align to 8-bytes */
  }
}
コード例 #23
0
static void dc_callvm_argFloat_ppc32_sysv(DCCallVM* in_self, DCfloat f)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;

    /* Put as float register (casted to double) */

    if (self->mFloatRegs < 8)
        self->mRegData.mFloatData[self->mFloatRegs++] = (DCdouble) (f);

    else /* OR put float on stack */
        dcVecAppend(&self->mVecHead, &f, sizeof(DCfloat));
}
コード例 #24
0
static void dc_callvm_argDouble_sparc64(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_sparc64* self = (DCCallVM_sparc64*)in_self;
  if (self->mFloatRegs < FREGS) {
    * ((double*)dcVecAt(&self->mVecHead,(IREGS+(self->mFloatRegs++))*8)) = x;
  }
  if (self->mIntRegs < IREGS) {
    self->mIntRegs++;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
  }
}
コード例 #25
0
static void dc_callvm_argDouble_ppc32_sysv(DCCallVM* in_self, DCdouble d)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    if (self->mFloatRegs < 8)
        self->mRegData.mFloatData[self->mFloatRegs++] = d;
    else /* OR push data on stack */
    {
        /* align stack to 8 byte boundary */
        dcVecResize(&self->mVecHead , ( dcVecSize(&self->mVecHead) + 7UL ) & -8UL );
        /* AND push data */
        dcVecAppend(&self->mVecHead,(DCpointer) &d,sizeof(DCdouble));
    }
}
コード例 #26
0
static void dc_callvm_argLongLong_ppc64_ellipsis(DCCallVM* in_self, DClonglong L)
{
  DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;

  if (dcVecSize(&self->mVecHead) == 0) 
    dcVecSkip(&self->mVecHead,(sizeof(DClonglong))*(self->mIntRegs));

  if (self->mIntRegs < 8) 
    self->mRegData.mIntData[self->mIntRegs++] = L;

  /* push on stack */
  dcVecAppend(&self->mVecHead,&L,sizeof(DClonglong));
}
コード例 #27
0
static void a_float(DCCallVM* in_p, DCfloat x)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_p;
  if (p->s < 16) {
    p->S[p->s++] = x;
    if (p->d < p->s) {
      p->d = (p->s+1) & ~(1U);
    } else {
      p->s = p->d;
    }
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCfloat));
  } 
}
コード例 #28
0
static void a_longlong(DCCallVM* in_self, DClonglong x)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_self;

  p->i = (p->i+4) & -8;
  if (p->i < 16) {
    * (DClonglong*) dcVecAt(&p->mVecHead, p->i) = x;
    p->i += 8;
  } else {
    /* 64 bit values need to be aligned on 8 byte boundaries */
    dcVecSkip(&p->mVecHead, dcVecSize(&p->mVecHead) & 4);
    dcVecAppend(&p->mVecHead, &x, sizeof(DClonglong));
  }
}
コード例 #29
0
static void dc_callvm_argDouble_ppc32_darwin(DCCallVM* in_self, DCdouble d)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    if (self->mFloatRegs < 13) {
        self->mRegData.mFloatData[self->mFloatRegs++] = d;
        /* skip two integer register file entries */
        if (self->mIntRegs < 8)
            self->mRegData.mIntData[self->mIntRegs++] = ( (DCint*) &d )[0];
        if (self->mIntRegs < 8)
            self->mRegData.mIntData[self->mIntRegs++] = ( (DCint*) &d )[1];
    }
    /* push on stack */
    dcVecAppend(&self->mVecHead, &d, sizeof(DCdouble));
}
コード例 #30
0
static void dc_callvm_argFloat_ppc32_darwin(DCCallVM* in_self, DCfloat f)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    if (self->mFloatRegs < 13) {
        self->mRegData.mFloatData[self->mFloatRegs++] = (DCdouble) (f);
    }

    /* AND skip one integer register file entry (write in - for ellipsis calls) */

    if (self->mIntRegs < 8)
        self->mRegData.mIntData[self->mIntRegs++] = *( (DCint*) &f );

    /* AND push on stack */

    dcVecAppend(&self->mVecHead, &f, sizeof(DCfloat));
}