static void openter(Cpu *cpu, Inst *i) { print_func_entry(); Iarg *sp, *bp; unsigned long oframe, nframe; int j, n; sp = areg(cpu, cpu->slen, RSP); bp = areg(cpu, cpu->slen, RBP); push(sp, bp); oframe = ar(bp); nframe = ar(sp); n = ar(i->a2) % 32; if(n > 0){ for(j=1; j<n; j++){ aw(bp, oframe - i->olen*j); push(sp, bp); } push(sp, acon(cpu, i->olen, nframe)); } aw(bp, nframe); aw(sp, nframe - ar(i->a1)); print_func_exit(); }
static void oppush(Cpu *cpu, Inst *i) { print_func_entry(); Iarg *sp; sp = areg(cpu, cpu->slen, RSP); if(i->a1->len == 1) /* 0x6A push imm8 */ push(sp, acon(cpu, i->olen, ar(i->a1))); else push(sp, i->a1); print_func_exit(); }
static void oppusha(Cpu *cpu, Inst *i) { print_func_entry(); Iarg *sp, *osp; sp = areg(cpu, cpu->slen, RSP); osp = acon(cpu, i->olen, ar(sp)); push(sp, areg(cpu, i->olen, RAX)); push(sp, areg(cpu, i->olen, RCX)); push(sp, areg(cpu, i->olen, RDX)); push(sp, areg(cpu, i->olen, RBX)); push(sp, osp); push(sp, areg(cpu, i->olen, RBP)); push(sp, areg(cpu, i->olen, RSI)); push(sp, areg(cpu, i->olen, RDI)); print_func_exit(); }
/*! \brief This function check if a box intersect this shape * * \param b is the box to check * \return true if the box intersect the cylinder cone shape * */ template <typename distance> bool Intersect(Box<dim,T> b) { // std::cout << "Intersection between" << "\n"; /* for (int i = 0 ; i < dim ; i++) { std::cout << "Box: " << boost::fusion::at_c<0>(b.data)[i] << " " << boost::fusion::at_c<1>(b.data)[i] << "\n"; }*/ // We have to check if the upper-base of the box intersect the shape, if not we have done // we get the upper base that is a box of dimension dim-1 Box<dim-1,T> upBase = b.getSubBox(); // Get the up level T up = b.template getBase<Base::UP>(dim-1); // we get the circle of dimension n-1 at the same level of the upper base of the box // this is the radius of the circle T r_p = 0; // if the plane is at lower level than the point r_p is the cylinder radius // otherwise is the cone cut if (b.template getBase<Base::UP>(dim-1) < boost::fusion::at_c<PointA::x>(data)[dim-1] ) { r_p = boost::fusion::at_c<PointA::x>(data)[dim-1]; } else { // r_p is the cone cut (plane of base box cutting the cone) r_p = b.template getBase<Base::UP>(dim-1); } // Create the cone-cylinder cut with the plane of the base Sphere<dim-1,T> acon(data,up); return upBase.Intersect<distance>(acon); }