这是Skyeye 0.9 版本的源代码
源代码在线查看: arm2x86_mul.c
#include "armdefs.h"
#include "arm2x86_self.h"
uint8_t *
get_op_mul_T0_T1(int *len)
{
unsigned int begin=0, end=0;
OP_BEGIN("get_op_mul_T0_T1");
T0 = T0 * T1;
OP_END("get_op_mul_T0_T1");
*len = end - begin;
return((uint8_t *)begin);
}
uint8_t *
get_op_umull_T0_T1(int *len)
{
unsigned int begin=0, end=0;
OP_BEGIN("get_op_umull_T0_T1");
__asm__ __volatile__ ("movl %"AREG_T0", %eax");
__asm__ __volatile__ ("mull %"AREG_T1);
__asm__ __volatile__ ("movl %eax, %"AREG_T0);
__asm__ __volatile__ ("movl %edx, %"AREG_T1);
OP_END("get_op_umull_T0_T1");
*len = end - begin;
return((uint8_t *)begin);
}
uint8_t *
get_op_smull_T0_T1(int *len)
{
unsigned int begin=0, end=0;
OP_BEGIN("get_op_smull_T0_T1");
__asm__ __volatile__ ("movl %"AREG_T0", %eax");
__asm__ __volatile__ ("imull %"AREG_T1);
__asm__ __volatile__ ("movl %eax, %"AREG_T0);
__asm__ __volatile__ ("movl %edx, %"AREG_T1);
OP_END("get_op_smull_T0_T1");
*len = end - begin;
return((uint8_t *)begin);
}
op_table_t op_mul_T0_T1;
op_table_t op_umull_T0_T1;
op_table_t op_smull_T0_T1;
int
arm2x86_mul_init()
{
op_mul_T0_T1.op = get_op_mul_T0_T1(&op_mul_T0_T1.len);
if (op_mul_T0_T1.len return(-1);
op_umull_T0_T1.op = get_op_umull_T0_T1(&op_umull_T0_T1.len);
if (op_umull_T0_T1.len return(-1);
op_smull_T0_T1.op = get_op_smull_T0_T1(&op_smull_T0_T1.len);
if (op_smull_T0_T1.len return(-1);
return(0);
}