summaryrefslogtreecommitdiff
path: root/py/asmx64.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/asmx64.c')
-rw-r--r--py/asmx64.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/py/asmx64.c b/py/asmx64.c
index 8706b806e..4e45f77a4 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -63,15 +63,15 @@
#define OPCODE_SUB_R64_FROM_RM64 (0x29)
#define OPCODE_SUB_I32_FROM_RM64 (0x81) /* /5 */
#define OPCODE_SUB_I8_FROM_RM64 (0x83) /* /5 */
-//#define OPCODE_SHL_RM32_BY_I8 (0xc1) /* /4 */
-//#define OPCODE_SHR_RM32_BY_I8 (0xc1) /* /5 */
-//#define OPCODE_SAR_RM32_BY_I8 (0xc1) /* /7 */
+// #define OPCODE_SHL_RM32_BY_I8 (0xc1) /* /4 */
+// #define OPCODE_SHR_RM32_BY_I8 (0xc1) /* /5 */
+// #define OPCODE_SAR_RM32_BY_I8 (0xc1) /* /7 */
#define OPCODE_SHL_RM64_CL (0xd3) /* /4 */
#define OPCODE_SAR_RM64_CL (0xd3) /* /7 */
-//#define OPCODE_CMP_I32_WITH_RM32 (0x81) /* /7 */
-//#define OPCODE_CMP_I8_WITH_RM32 (0x83) /* /7 */
+// #define OPCODE_CMP_I32_WITH_RM32 (0x81) /* /7 */
+// #define OPCODE_CMP_I8_WITH_RM32 (0x83) /* /7 */
#define OPCODE_CMP_R64_WITH_RM64 (0x39) /* /r */
-//#define OPCODE_CMP_RM32_WITH_R32 (0x3b)
+// #define OPCODE_CMP_RM32_WITH_R32 (0x3b)
#define OPCODE_TEST_R8_WITH_RM8 (0x84) /* /r */
#define OPCODE_JMP_REL8 (0xeb)
#define OPCODE_JMP_REL32 (0xe9)
@@ -121,14 +121,14 @@ static inline byte *asm_x64_get_cur_to_write_bytes(asm_x64_t *as, int n) {
}
STATIC void asm_x64_write_byte_1(asm_x64_t *as, byte b1) {
- byte* c = asm_x64_get_cur_to_write_bytes(as, 1);
+ byte *c = asm_x64_get_cur_to_write_bytes(as, 1);
if (c != NULL) {
c[0] = b1;
}
}
STATIC void asm_x64_write_byte_2(asm_x64_t *as, byte b1, byte b2) {
- byte* c = asm_x64_get_cur_to_write_bytes(as, 2);
+ byte *c = asm_x64_get_cur_to_write_bytes(as, 2);
if (c != NULL) {
c[0] = b1;
c[1] = b2;
@@ -136,7 +136,7 @@ STATIC void asm_x64_write_byte_2(asm_x64_t *as, byte b1, byte b2) {
}
STATIC void asm_x64_write_byte_3(asm_x64_t *as, byte b1, byte b2, byte b3) {
- byte* c = asm_x64_get_cur_to_write_bytes(as, 3);
+ byte *c = asm_x64_get_cur_to_write_bytes(as, 3);
if (c != NULL) {
c[0] = b1;
c[1] = b2;
@@ -145,7 +145,7 @@ STATIC void asm_x64_write_byte_3(asm_x64_t *as, byte b1, byte b2, byte b3) {
}
STATIC void asm_x64_write_word32(asm_x64_t *as, int w32) {
- byte* c = asm_x64_get_cur_to_write_bytes(as, 4);
+ byte *c = asm_x64_get_cur_to_write_bytes(as, 4);
if (c != NULL) {
c[0] = IMM32_L0(w32);
c[1] = IMM32_L1(w32);
@@ -155,7 +155,7 @@ STATIC void asm_x64_write_word32(asm_x64_t *as, int w32) {
}
STATIC void asm_x64_write_word64(asm_x64_t *as, int64_t w64) {
- byte* c = asm_x64_get_cur_to_write_bytes(as, 8);
+ byte *c = asm_x64_get_cur_to_write_bytes(as, 8);
if (c != NULL) {
c[0] = IMM32_L0(w64);
c[1] = IMM32_L1(w64);
@@ -382,11 +382,11 @@ void asm_x64_xor_r64_r64(asm_x64_t *as, int dest_r64, int src_r64) {
asm_x64_generic_r64_r64(as, dest_r64, src_r64, OPCODE_XOR_R64_TO_RM64);
}
-void asm_x64_shl_r64_cl(asm_x64_t* as, int dest_r64) {
+void asm_x64_shl_r64_cl(asm_x64_t *as, int dest_r64) {
asm_x64_generic_r64_r64(as, dest_r64, 4, OPCODE_SHL_RM64_CL);
}
-void asm_x64_sar_r64_cl(asm_x64_t* as, int dest_r64) {
+void asm_x64_sar_r64_cl(asm_x64_t *as, int dest_r64) {
asm_x64_generic_r64_r64(as, dest_r64, 7, OPCODE_SAR_RM64_CL);
}
@@ -496,7 +496,7 @@ void asm_x64_jmp_label(asm_x64_t *as, mp_uint_t label) {
}
} else {
// is a forwards jump, so need to assume it's large
- large_jump:
+ large_jump:
rel -= 5;
asm_x64_write_byte_1(as, OPCODE_JMP_REL32);
asm_x64_write_word32(as, rel);
@@ -518,7 +518,7 @@ void asm_x64_jcc_label(asm_x64_t *as, int jcc_type, mp_uint_t label) {
}
} else {
// is a forwards jump, so need to assume it's large
- large_jump:
+ large_jump:
rel -= 6;
asm_x64_write_byte_2(as, OPCODE_JCC_REL32_A, OPCODE_JCC_REL32_B | jcc_type);
asm_x64_write_word32(as, rel);
@@ -612,12 +612,12 @@ void asm_x64_call_i1(asm_x64_t *as, void* func, int i1) {
void asm_x64_call_ind(asm_x64_t *as, void *ptr, int temp_r64) {
assert(temp_r64 < 8);
-#ifdef __LP64__
+ #ifdef __LP64__
asm_x64_mov_i64_to_r64_optimised(as, (int64_t)ptr, temp_r64);
-#else
+ #else
// If we get here, sizeof(int) == sizeof(void*).
asm_x64_mov_i64_to_r64_optimised(as, (int64_t)(unsigned int)ptr, temp_r64);
-#endif
+ #endif
asm_x64_write_byte_2(as, OPCODE_CALL_RM32, MODRM_R64(2) | MODRM_RM_REG | MODRM_RM_R64(temp_r64));
// this reduces code size by 2 bytes per call, but doesn't seem to speed it up at all
// doesn't work anymore because calls are 64 bits away