1#ifndef _NSEEL_GLUE_X86_H_
2#define _NSEEL_GLUE_X86_H_
4#define GLUE_MAX_FPSTACK_SIZE 8
7#define GLUE_JMP_SET_OFFSET(endOfInstruction,offset) (((int *)(endOfInstruction))[-1] = (offset))
9static const unsigned char GLUE_JMP_NC[] = { 0xE9, 0,0,0,0, };
13#define GLUE_FUNC_ENTER_SIZE 0
14#define GLUE_FUNC_LEAVE_SIZE 0
34 *buf++ = 0xB8; *(
void **) buf = destptr; buf+=4;
36 *buf++ = 0x8f; *buf++ = 0x00;
37 *buf++ = 0x8f; *buf++ = 0x40; *buf++ = 4;
50 *buf++ = 0x8B; *buf++ = 0x38;
51 *buf++ = 0x8B; *buf++ = 0x48; *buf++ = 0x04;
54 *buf++ = 0xB8; *(
void **) buf = destptr; buf+=4;
55 *buf++ = 0x89; *buf++ = 0x38;
56 *buf++ = 0x89; *buf++ = 0x48; *buf++ = 0x04;
59 return 2 + 3 + 5 + 2 + 3;
66 *buf++ = 0xB8; *(
void **) buf = destptr; buf+=4;
67 *buf++ = 0xDD; *buf++ = 0x18;
73 #define GLUE_MOV_PX_DIRECTVALUE_SIZE 5
74 #define GLUE_MOV_PX_DIRECTVALUE_TOSTACK_SIZE 6
80 const static unsigned char t[2] = {0xDD, 0x05};
82 b= ((
unsigned char *)
b)+2;
86 const static unsigned char tab[3] = {
91 *((
unsigned char *)
b) = tab[wv];
92 b= ((
unsigned char *)
b)+1;
98 #define GLUE_STORE_P1_TO_STACK_AT_OFFS_SIZE(x) 7
101 ((
unsigned char *)
b)[0] = 0x89;
102 ((
unsigned char *)
b)[1] = 0x84;
103 ((
unsigned char *)
b)[2] = 0x24;
104 *(
int *)((
unsigned char *)
b+3) = offs;
107 #define GLUE_MOVE_PX_STACKPTR_SIZE 2
119 #define GLUE_MOVE_STACK_SIZE 6
122 ((
unsigned char *)
b)[0] = 0x81;
125 ((
unsigned char *)
b)[1] = 0xEC;
126 *(
int *)((
char*)
b+2) = -amt;
130 ((
unsigned char *)
b)[1] = 0xc4;
131 *(
int *)((
char*)
b+2) = amt;
136 #define GLUE_POP_PX_SIZE 4
141 {0x58, 0x83, 0xC4, 12 },
142 {0x5F, 0x83, 0xC4, 12},
143 {0x59, 0x83, 0xC4, 12},
148 #define GLUE_SET_PX_FROM_P1_SIZE 2
159 #define GLUE_POP_FPSTACK_SIZE 2
177 #define GLUE_SET_PX_FROM_WTP_SIZE 2
188 #define GLUE_PUSH_VAL_AT_PX_TO_FPSTACK_SIZE 2
199#define GLUE_POP_FPSTACK_TO_WTP_TO_PX_SIZE (GLUE_SET_PX_FROM_WTP_SIZE + sizeof(GLUE_POP_FPSTACK_TO_WTP))
217 return 1+
sizeof(
void *);
223#pragma warning(disable: 4731)
226#define GLUE_TABPTR_IGNORED
227#define GLUE_CALL_CODE(bp, cp, rt) do { \
228 if (h->compile_flags&NSEEL_CODE_COMPILE_FLAG_NOFPSTATE) eel_callcode32_fast(cp, rt); \
229 else eel_callcode32(cp, rt);\
234 #ifndef NSEEL_EEL1_COMPAT_MODE
241#ifndef NSEEL_EEL1_COMPAT_MODE
269#ifndef NSEEL_EEL1_COMPAT_MODE
276#ifndef NSEEL_EEL1_COMPAT_MODE
284 "movl %%ecx, %%ebx\n"
286 "movl %%esp, %%ebp\n"
292#ifndef NSEEL_EEL1_COMPAT_MODE
296 "d" (
cp),
"c" (ramptr)
297#ifndef NSEEL_EEL1_COMPAT_MODE
298 ,
"m" (oldsw),
"m" (newsw)
300 :
"%eax",
"%esi",
"%edi");
319 "movw (%%ecx), %%ax\n"
321 "movw %%ax, 4(%%ecx)\n"
323 ::
"c" (
s) :
"%eax");
337 ::
"c" (
s) :
"%eax");
372 "movl %%ecx, %%ebx\n"
374 "movl %%esp, %%ebp\n"
381 "d" (
cp),
"c" (ramptr)
382 :
"%eax",
"%esi",
"%edi");
397 return (
unsigned char *) (((
INT_PTR*)
p)+1);
400#define INT_TO_LECHARS(x) ((x)&0xff),(((x)>>8)&0xff), (((x)>>16)&0xff), (((x)>>24)&0xff)
403#define GLUE_INLINE_LOOPS
405#define GLUE_LOOP_LOADCNT_SIZE (nseel_has_sse3() ? sizeof(GLUE_LOOP_LOADCNT_SSE3) : sizeof(GLUE_LOOP_LOADCNT_NOSSE3))
406#define GLUE_LOOP_LOADCNT (nseel_has_sse3() ? GLUE_LOOP_LOADCNT_SSE3 : GLUE_LOOP_LOADCNT_NOSSE3)
416 0x66, 0x8b, 0x46, 0x04,
417 0x66, 0x0d, 0x00, 0x0c,
418 0x66, 0x89, 0x46, 0x08,
427#if NSEEL_LOOPFUNC_SUPPORT_MAXLEN > 0
428#define GLUE_LOOP_CLAMPCNT_SIZE sizeof(GLUE_LOOP_CLAMPCNT)
436#define GLUE_LOOP_CLAMPCNT_SIZE 0
437#define GLUE_LOOP_CLAMPCNT ""
441#define GLUE_LOOP_BEGIN_SIZE sizeof(GLUE_LOOP_BEGIN)
445 0x81, 0xEC, 0x08, 0,0,0,
448 0x81, 0xC4, 0x08, 0,0,0,
456#if NSEEL_LOOPFUNC_SUPPORT_MAXLEN > 0
457#define GLUE_WHILE_SETUP_SIZE sizeof(GLUE_WHILE_SETUP)
464 0x81, 0xEC, 0x08, 0,0,0,
467 0x81, 0xC4, 0x08, 0,0,0,
479#define GLUE_WHILE_SETUP_SIZE 0
480#define GLUE_WHILE_SETUP ""
481#define GLUE_WHILE_END_NOJUMP
484 0x81, 0xEC, 12, 0,0,0,
487 0x81, 0xC4, 12, 0,0,0,
510#define GLUE_INVSQRT_NEEDREPL &negativezeropointfive, &onepointfive,
513#define GLUE_HAS_NATIVE_TRIGSQRTLOG
556 const int isz =
flag == 2 ? 3 : 2;
557 while (
p+isz <= endp && np > 0)
559 if (
flag == 0 &&
p[0] == 0xdf && (
p[1]&0xbe) == 0x3e)
566 else if (
flag == 1 &&
p[0] == 0xdb && (
p[1]&0xbe) == 0x1e)
572 else if (
flag == 2 &&
p[0] == 0xdb && (
p[1]&0xbf) == 0x1c &&
p[2] == 0x24)
604 :
"=c" (features) : :
"%eax");
606 c=(features&1) ? 1 : -1;
612 static const unsigned char sig[12] = { 0x89, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
613 unsigned char *
p = (
unsigned char *)
fn;
617 for (rmatch = 0; rmatch < nmatch &&
s_round_fixes[rmatch].fn !=
fn; rmatch++);
624 #if defined(_DEBUG) && defined(_MSC_VER)
627 p += 5 + *(
int *)(
p+1);
631 while (memcmp(
p,sig,
sizeof(sig)))
p++;
635 while (memcmp(
p,sig,
sizeof(sig)))
p++;
636 *
size =
p - (
unsigned char *)
fn;
640 static const unsigned char prefix[] = {
642 0x66, 0x8b, 0x46, 0x10,
643 0x66, 0x0d, 0x00, 0x0c,
644 0x66, 0x89, 0x46, 0x14,
647 static const unsigned char postfix[] = {
653 unsigned char *tmp = (
unsigned char *)
malloc(*
size + (has_sse ? 0 :
sizeof(prefix) +
sizeof(
postfix)));
663 memcpy(tmp,prefix,
sizeof(prefix));
string postfix
Definition Nio.cpp:18
void nseel_asm_xor_op(void)
Definition asm-nseel-aarch64-gcc.c:440
void nseel_asm_mod_op(void)
Definition asm-nseel-aarch64-gcc.c:368
void nseel_asm_or0(void)
Definition asm-nseel-aarch64-gcc.c:402
void nseel_asm_or_op(void)
Definition asm-nseel-aarch64-gcc.c:412
void nseel_asm_and(void)
Definition asm-nseel-aarch64-gcc.c:456
void nseel_asm_or(void)
Definition asm-nseel-aarch64-gcc.c:390
void nseel_asm_shl(void)
Definition asm-nseel-aarch64-gcc.c:344
void nseel_asm_stack_peek(void)
Definition asm-nseel-aarch64-gcc.c:1152
void nseel_asm_shr(void)
Definition asm-nseel-aarch64-gcc.c:356
void nseel_asm_xor(void)
Definition asm-nseel-aarch64-gcc.c:428
void _asm_gmegabuf(void)
Definition asm-nseel-aarch64-gcc.c:1028
void nseel_asm_mod(void)
Definition asm-nseel-aarch64-gcc.c:329
void _asm_megabuf(void)
Definition asm-nseel-aarch64-gcc.c:985
void nseel_asm_and_op(void)
Definition asm-nseel-aarch64-gcc.c:467
struct huft * t
Definition inflate.c:943
unsigned v[N_MAX]
Definition inflate.c:1584
unsigned s
Definition inflate.c:1555
void(* eel_leavefp)(int s[2])
Definition eel_import.h:43
void(* eel_enterfp)(int s[2])
Definition eel_import.h:42
static const unsigned int GLUE_PUSH_P1PTR_AS_VALUE[]
Definition glue_aarch64.h:183
#define GLUE_SET_PX_FROM_P1_SIZE
Definition glue_aarch64.h:176
static const unsigned int GLUE_POP_FPSTACK_TOSTACK[]
Definition glue_aarch64.h:303
static const unsigned int GLUE_POP_FPSTACK[1]
Definition glue_aarch64.h:301
#define GLUE_SET_PX_FROM_WTP_SIZE
Definition glue_aarch64.h:281
#define GLUE_MOVE_PX_STACKPTR_SIZE
Definition glue_aarch64.h:143
static const unsigned int GLUE_FUNC_LEAVE[1]
Definition glue_aarch64.h:106
static const unsigned int GLUE_POP_FPSTACK_TO_WTP[]
Definition glue_aarch64.h:308
#define GLUE_PUSH_VAL_AT_PX_TO_FPSTACK_SIZE
Definition glue_aarch64.h:312
static const unsigned int GLUE_JMP_NC[]
Definition glue_aarch64.h:72
static const unsigned int GLUE_JMP_IF_P1_NZ[]
Definition glue_aarch64.h:79
static const unsigned int GLUE_FUNC_ENTER[2]
Definition glue_aarch64.h:104
static const unsigned int GLUE_SET_P1_Z[]
Definition glue_aarch64.h:325
static const unsigned int GLUE_RET[]
Definition glue_aarch64.h:108
static const unsigned int GLUE_JMP_IF_P1_Z[]
Definition glue_aarch64.h:74
#define GLUE_POP_PX_SIZE
Definition glue_aarch64.h:170
static const unsigned int GLUE_PUSH_P1[1]
Definition glue_aarch64.h:118
static const unsigned int GLUE_SET_P1_NZ[]
Definition glue_aarch64.h:326
#define GLUE_WHILE_SETUP
Definition glue_port.h:185
static unsigned char GLUE_POP_STACK_TO_FPSTACK[1]
Definition glue_port.h:341
#define GLUE_LOOP_BEGIN
Definition glue_port.h:175
#define GLUE_LOOP_CLAMPCNT
Definition glue_port.h:177
static void GLUE_MOVE_STACK(void *b, int amt)
Definition glue_x86.h:120
static void GLUE_SET_PX_FROM_WTP(void *b, int wv)
Definition glue_x86.h:178
void nseel_asm_xor_op(void)
Definition asm-nseel-aarch64-gcc.c:440
static void GLUE_POP_FPSTACK_TO_WTP_TO_PX(unsigned char *buf, int wv)
Definition glue_x86.h:200
static void GLUE_MOV_PX_DIRECTVALUE_GEN(void *b, INT_PTR v, int wv)
Definition glue_x86.h:76
static const unsigned char GLUE_FLD1[]
Definition glue_x86.h:506
static const unsigned char GLUE_LOOP_LOADCNT_SSE3[]
Definition glue_x86.h:407
void nseel_asm_mod_op(void)
Definition asm-nseel-aarch64-gcc.c:368
static const unsigned char GLUE_LOOP_LOADCNT_NOSSE3[]
Definition glue_x86.h:414
void nseel_asm_or0(void)
Definition asm-nseel-aarch64-gcc.c:402
static EEL_F negativezeropointfive
Definition glue_x86.h:508
static void * GLUE_realAddress(void *fn, int *size)
Definition glue_x86.h:610
static EEL_F onepointfive
Definition glue_x86.h:509
void nseel_asm_or_op(void)
Definition asm-nseel-aarch64-gcc.c:412
void nseel_asm_and(void)
Definition asm-nseel-aarch64-gcc.c:456
static int GLUE_RESET_WTP(unsigned char *out, void *ptr)
Definition glue_x86.h:209
void nseel_asm_or(void)
Definition asm-nseel-aarch64-gcc.c:390
static int GLUE_POP_VALUE_TO_ADDR(unsigned char *buf, void *destptr)
Definition glue_x86.h:30
static struct roundinftab s_round_fixes[]
void nseel_asm_shl(void)
Definition asm-nseel-aarch64-gcc.c:344
void nseel_asm_stack_peek(void)
Definition asm-nseel-aarch64-gcc.c:1152
static void GLUE_MOVE_PX_STACKPTR_GEN(void *b, int wv)
Definition glue_x86.h:108
void nseel_asm_shr(void)
Definition asm-nseel-aarch64-gcc.c:356
static const unsigned char GLUE_FLDZ[]
Definition glue_x86.h:504
static int nseel_has_sse3()
Definition glue_x86.h:584
static void eel_fixup_sse3(unsigned char *p, unsigned char *endp, int np, int flag)
Definition glue_x86.h:554
static const unsigned char GLUE_WHILE_CHECK_RV[]
Definition glue_x86.h:493
void nseel_asm_xor(void)
Definition asm-nseel-aarch64-gcc.c:428
static void eel_callcode32_fast(INT_PTR cp, INT_PTR ramptr)
Definition glue_x86.h:341
static void GLUE_STORE_P1_TO_STACK_AT_OFFS(void *b, int offs)
Definition glue_x86.h:99
static void GLUE_POP_PX(void *b, int wv)
Definition glue_x86.h:137
static const unsigned char GLUE_WHILE_END[]
Definition glue_x86.h:486
static const unsigned char GLUE_LOOP_END[]
Definition glue_x86.h:447
static int GLUE_POP_FPSTACK_TO_PTR(unsigned char *buf, void *destptr)
Definition glue_x86.h:62
void _asm_gmegabuf(void)
Definition asm-nseel-aarch64-gcc.c:1028
static unsigned char * EEL_GLUE_set_immediate(void *_p, INT_PTR newv)
Definition glue_x86.h:391
#define INT_TO_LECHARS(x)
Definition glue_x86.h:400
void nseel_asm_mod(void)
Definition asm-nseel-aarch64-gcc.c:329
static void GLUE_PUSH_VAL_AT_PX_TO_FPSTACK(void *b, int wv)
Definition glue_x86.h:189
static void GLUE_SET_PX_FROM_P1(void *b, int wv)
Definition glue_x86.h:149
void _asm_megabuf(void)
Definition asm-nseel-aarch64-gcc.c:985
static const unsigned char GLUE_FXCH[]
Definition glue_x86.h:501
static const unsigned char GLUE_WHILE_BEGIN[]
Definition glue_x86.h:482
void nseel_asm_and_op(void)
Definition asm-nseel-aarch64-gcc.c:467
static int GLUE_COPY_VALUE_AT_P1_TO_PTR(unsigned char *buf, void *destptr)
Definition glue_x86.h:46
static void eel_callcode32(INT_PTR cp, INT_PTR ramptr)
Definition glue_x86.h:232
float out
Definition lilv_test.c:1461
#define NSEEL_LOOPFUNC_SUPPORT_MAXLEN
Definition ns-eel.h:209
Definition glue_x86.h:531
int newsz
Definition glue_x86.h:535
char istores
Definition glue_x86.h:533
char flag
Definition glue_x86.h:534
void * newfn
Definition glue_x86.h:536
void * fn
Definition glue_x86.h:532
const char const char const char const char char * fn
Definition swell-functions.h:168
intptr_t INT_PTR
Definition swell-types.h:42
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
memcpy(hh, h, RAND_HEAD_LEN)
char * cp
Definition unix.c:513
int flag
Definition unix.c:754
#define WDL_ASSERT(x)
Definition wdltypes.h:164