Skip to content

Commit

Permalink
Fix x86-64 and i686
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtbucher committed Oct 25, 2024
1 parent 5ed7c19 commit f287f8d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Python/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ emit_prelude(unsigned char *code, const _PyUOpInstruction *instruction)
// 04 00 E0 F2 movk x4, #0, lsl #48
// 1F 20 03 D5 nop
unsigned char code_body[PRELUDE_SIZE] = {
0x03, 0x00, 0x80, 0x52, 0x04, 0x00, 0x80, 0xd2,
0x04, 0x00, 0xa0, 0xf2, 0x04, 0x00, 0xc0, 0xf2,
0x03, 0x00, 0x80, 0x52, 0x04, 0x00, 0x80, 0xd2,
0x04, 0x00, 0xa0, 0xf2, 0x04, 0x00, 0xc0, 0xf2,
0x04, 0x00, 0xe0, 0xf2, 0x1f, 0x20, 0x03, 0xd5,
};
memcpy(code, code_body, sizeof(code_body));
Expand All @@ -504,10 +504,10 @@ emit_prelude(unsigned char *code, const _PyUOpInstruction *instruction)
static void
emit_prelude(unsigned char *code, const _PyUOpInstruction *instruction)
{
// BF 00 00 00 00 mov edi, 0
// 49 BF 00 00 00 00 00 00 00 00 movabs r15, 0
// B9 00 00 00 00 mov ecx, 0
// 49 BF 00 00 00 00 00 00 00 00 movabs r8, 0
unsigned char code_body[PRELUDE_SIZE] = {
0xbf, 0x00, 0x00, 0x00, 0x00, 0x49, 0xbf, 0x00,
0xb9, 0x00, 0x00, 0x00, 0x00, 0x49, 0xbf, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
memcpy(code, code_body, sizeof(code_body));
Expand All @@ -524,11 +524,11 @@ emit_prelude(unsigned char *code, const _PyUOpInstruction *instruction)
{
// 66 41 B9 00 00 mov r9w, 0
// 48 B8 00 00 00 00 00 00 00 00 movabs rax, 0
// 48 89 44 24 28 mov qword ptr [rsp + 0x28], rax
// 48 89 44 24 40 mov qword ptr [rsp + 0x40], rax
unsigned char code_body[PRELUDE_SIZE] = {
0x66, 0x41, 0xb9, 0x00, 0x00, 0x48, 0xb8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48,
0x89, 0x44, 0x24, 0x28,
0x66, 0x41, 0xb9, 0x00, 0x00, 0x48, 0xb8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48,
0x89, 0x44, 0x24, 0x40,
};
memcpy(code, code_body, sizeof(code_body));
patch_16(code + 0x3, instruction->oparg);
Expand All @@ -542,13 +542,13 @@ emit_prelude(unsigned char *code, const _PyUOpInstruction *instruction)
static void
emit_prelude(unsigned char *code, const _PyUOpInstruction *instruction)
{
// 66 C7 44 24 10 00 00 mov word ptr [esp + 0x10], 0
// C7 44 24 14 00 00 00 00 mov dword ptr [esp + 0x14], 0
// C7 44 24 18 00 00 00 00 mov dword ptr [esp + 0x18], 0
// 66 C7 44 24 10 00 00 mov word ptr [esp + 0x16], 0
// C7 44 24 14 00 00 00 00 mov dword ptr [esp + 0x20], 0
// C7 44 24 18 00 00 00 00 mov dword ptr [esp + 0x24], 0
unsigned char code_body[PRELUDE_SIZE] = {
0x66, 0xc7, 0x44, 0x24, 0x10, 0x00, 0x00, 0xc7,
0x44, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00, 0xc7,
0x44, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00,
0x66, 0xc7, 0x44, 0x24, 0x10, 0x00, 0x00, 0xc7,
0x44, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00, 0xc7,
0x44, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00,
};
memcpy(code, code_body, sizeof(code_body));
patch_16(code + 0x5, instruction->oparg);
Expand Down

0 comments on commit f287f8d

Please sign in to comment.