Exemple #1
0
void dc_callvm_call_x86_plan9(DCCallVM* in_self, DCpointer target)
{
  /* Calls with 32-bit return values have it returned via EAX, so we don't */
  /* need to do anything special here.                                     */
  DCCallVM_x86* self = (DCCallVM_x86*) in_self;
  dcCall_x86_plan9(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
}
void call(DCCallVM* in_p, DCpointer target)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
  
  /*
  ** copy 'size' argument is given in number of 16-byte 'pair' blocks.
  */
  
  dcCall_arm64(target, dcVecData(&p->mVecHead), ( dcVecSize(&p->mVecHead) + 15 ) & -16, &p->u.S[0]);
}
void dc_callvm_call_mips_n64(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  /* at minimum provide 16-bytes
     which hold the first four integer register as spill area 
     and are automatically loaded to $4-$7
   */
  size_t size = DC_MAX(16, ( ( (unsigned) dcVecSize(&self->mVecHead) ) +7UL ) & (-8UL) );
  dcCall_mips_n64(target, &self->mRegData, size, dcVecData(&self->mVecHead));
}
Exemple #4
0
DClonglong dc_callvm_call_x86_plan9_ll(DCCallVM* in_self, DCpointer target)
{
  /* Call for 64 bit integer return values is a bit different, call a    */
  /* different assembler stub that stores the return value in a variable */
  /* for us, and return the latter.                                      */
  DClonglong ret;
  DCCallVM_x86* self = (DCCallVM_x86*) in_self;
  dcCall_x86_plan9_ll(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead), &ret );
  return ret;
}
void dc_callvm_call_ppc32_darwin(DCCallVM* in_self, DCpointer target)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    dcCall_ppc32_darwin(
        target,
        &self->mRegData,
        DC_MAX(dcVecSize(&self->mVecHead), 8*4),
        dcVecData(&self->mVecHead)
    );
}
void dc_callvm_call_ppc64(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_ppc64* self = (DCCallVM_ppc64*) in_self;
  int size = dcVecSize(&self->mVecHead);

  if (size < 64) {
	dcVecSkip(&self->mVecHead, 64-size);
  }
  
  dcCall_ppc64( target, &self->mRegData, dcVecSize(&self->mVecHead) , dcVecData(&self->mVecHead));
}
Exemple #7
0
/* Call. */
void dc_callvm_call_x64(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
#if defined(DC_UNIX)
  dcCall_x64_sysv(
#else
  dcCall_x64_win64(
#endif
    dcVecSize(&self->mVecHead),  /* Size of stack data.                           */
    dcVecData(&self->mVecHead),  /* Pointer to stack arguments.                   */
    self->mRegData.i,            /* Pointer to register arguments (ints on SysV). */
#if defined(DC_UNIX)
    self->mRegData.f,            /* Pointer to floating point register arguments. */
#endif
    target
  );
}
Exemple #8
0
void dcVecAppend(DCVecHead* pHead, const void* pData, size_t size)
{
  size_t newSize = pHead->mSize + size;
  if(newSize <= pHead->mTotal) 
  {
  	void* dst = (DCchar*)dcVecData(pHead) + pHead->mSize;
  	switch (size) {
  	  case 1: *(DCchar    *)dst = *(const DCchar    *)pData; break;
  	  case 2: *(DCshort   *)dst = *(const DCshort   *)pData; break;
  	  case 4: *(DCint     *)dst = *(const DCint     *)pData; break;
  	  case 8: *(DCint     *)( ( (char*)dst )+4) = *(const DCint     *)( ( (char*)pData )+4); 
  	          *(DCint     *)dst = *(const DCint     *)pData; break;
 	  /* On sparc 32-bit, this one crashes if ptrs are not aligned.
          case 8: *(DClonglong*)dst = *(const DClonglong*)pData; break;
  	  */
          default: memcpy(dst, pData, size); /* for all the rest. */
  	}
    pHead->mSize = newSize;
  }
  /*else @@@ warning? error?*/
}
DClonglong dc_callvm_call_arm32_thumb_dword(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;
  return dcCall_arm32_thumb_dword(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
}
/* Call. */
void dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;
  dcCall_arm32_thumb(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
}
void call(DCCallVM* in_p, DCpointer target)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_p;
  dcCall_arm32_armhf(target, dcVecData(&p->mVecHead), dcVecSize(&p->mVecHead), &p->S[0]);
}
void dc_callvm_call_ppc64_syscall(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_ppc64* self = (DCCallVM_ppc64*) in_self;
  dcCall_ppc64_syscall( target, &self->mRegData, dcVecSize(&self->mVecHead) , dcVecData(&self->mVecHead));
}
/* call: delegate to default call kernel */
static void dc_callvm_call_sparc(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_sparc* self = (DCCallVM_sparc*)in_self;
  dcCall_sparc(target, dcVecSize(&self->mVecHead), dcVecData(&self->mVecHead));
}
Exemple #14
0
void dc_callvm_call_x86_sys_int80h_bsd(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_x86* self = (DCCallVM_x86*) in_self;
  dcCall_x86_sys_int80h_bsd( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
}
Exemple #15
0
void dc_callvm_call_x86_win32_this_ms(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_x86* self = (DCCallVM_x86*) in_self;
  dcCall_x86_win32_msthis( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
}
/* Call. */
void dc_callvm_call_mips_eabi(DCCallVM* in_self, DCpointer target)
{
  DCCallVM_mips_eabi* self = (DCCallVM_mips_eabi*)in_self;
  dcCall_mips_eabi(target, &self->mRegData, dcVecSize(&self->mVecHead), dcVecData(&self->mVecHead));
}