Make unix-cpy cross platform; remove dependency of asmx64 on mpconfig.
parent
cd340c44c2
commit
212c296c0b
|
@ -5,7 +5,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "mpconfig.h"
|
|
||||||
#include "asmx64.h"
|
#include "asmx64.h"
|
||||||
|
|
||||||
/* all offsets are measured in multiples of 8 bytes */
|
/* all offsets are measured in multiples of 8 bytes */
|
||||||
|
@ -603,7 +602,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) {
|
void asm_x64_call_ind(asm_x64_t* as, void *ptr, int temp_r64) {
|
||||||
asm_x64_mov_i64_to_r64_optimised(as, (machine_int_t)ptr, temp_r64);
|
#ifdef __LP64__
|
||||||
|
asm_x64_mov_i64_to_r64_optimised(as, (int64_t)ptr, temp_r64);
|
||||||
|
#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
|
||||||
asm_x64_write_byte_2(as, OPCODE_CALL_RM32, MODRM_R64(2) | MODRM_RM_REG | MODRM_RM_R64(temp_r64));
|
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
|
// 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
|
// doesn't work anymore because calls are 64 bits away
|
||||||
|
|
|
@ -283,12 +283,12 @@ void mp_show_byte_code(const byte *ip, int len) {
|
||||||
|
|
||||||
case MP_BC_BUILD_SET:
|
case MP_BC_BUILD_SET:
|
||||||
DECODE_UINT;
|
DECODE_UINT;
|
||||||
printf("BUILD_SET %lu", unum);
|
printf("BUILD_SET " UINT_FMT, unum);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_BC_SET_ADD:
|
case MP_BC_SET_ADD:
|
||||||
DECODE_UINT;
|
DECODE_UINT;
|
||||||
printf("SET_ADD %lu", unum);
|
printf("SET_ADD " UINT_FMT, unum);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_BC_UNPACK_SEQUENCE:
|
case MP_BC_UNPACK_SEQUENCE:
|
||||||
|
|
|
@ -171,6 +171,9 @@ $(BUILD)/%.o: $(CC3KSRC)/%.c
|
||||||
$(BUILD)/%.o: $(PYSRC)/%.s
|
$(BUILD)/%.o: $(PYSRC)/%.s
|
||||||
$(AS) -o $@ $<
|
$(AS) -o $@ $<
|
||||||
|
|
||||||
|
$(BUILD)/%.o: $(PYSRC)/%.S
|
||||||
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(BUILD)/%.o: $(PYSRC)/%.c mpconfig.h
|
$(BUILD)/%.o: $(PYSRC)/%.c mpconfig.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ SRC_C = \
|
||||||
main.c \
|
main.c \
|
||||||
|
|
||||||
PY_O = \
|
PY_O = \
|
||||||
|
nlrx86.o \
|
||||||
nlrx64.o \
|
nlrx64.o \
|
||||||
malloc.o \
|
malloc.o \
|
||||||
qstr.o \
|
qstr.o \
|
||||||
|
@ -57,13 +58,13 @@ $(PROG): $(BUILD) $(OBJ)
|
||||||
$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
|
$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
|
||||||
|
|
||||||
$(BUILD):
|
$(BUILD):
|
||||||
mkdir $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(BUILD)/%.o: %.c
|
$(BUILD)/%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(BUILD)/%.o: $(PYSRC)/%.s
|
$(BUILD)/%.o: $(PYSRC)/%.S
|
||||||
$(AS) -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(BUILD)/%.o: $(PYSRC)/%.c mpconfig.h
|
$(BUILD)/%.o: $(PYSRC)/%.c mpconfig.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
|
@ -8,10 +8,22 @@
|
||||||
|
|
||||||
// type definitions for the specific machine
|
// type definitions for the specific machine
|
||||||
|
|
||||||
#define BYTES_PER_WORD (8)
|
#ifdef __LP64__
|
||||||
|
typedef long machine_int_t; // must be pointer size
|
||||||
|
typedef unsigned long machine_uint_t; // must be pointer size
|
||||||
|
#define UINT_FMT "%lu"
|
||||||
|
#define INT_FMT "%ld"
|
||||||
|
#else
|
||||||
|
// These are definitions for machines where sizeof(int) == sizeof(void*),
|
||||||
|
// regardless for actual size.
|
||||||
|
typedef int machine_int_t; // must be pointer size
|
||||||
|
typedef unsigned int machine_uint_t; // must be pointer size
|
||||||
|
#define UINT_FMT "%u"
|
||||||
|
#define INT_FMT "%d"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BYTES_PER_WORD sizeof(machine_int_t)
|
||||||
|
|
||||||
typedef int64_t machine_int_t; // must be pointer size
|
|
||||||
typedef uint64_t machine_uint_t; // must be pointer size
|
|
||||||
typedef void *machine_ptr_t; // must be of pointer size
|
typedef void *machine_ptr_t; // must be of pointer size
|
||||||
typedef const void *machine_const_ptr_t; // must be of pointer size
|
typedef const void *machine_const_ptr_t; // must be of pointer size
|
||||||
typedef double machine_float_t;
|
typedef double machine_float_t;
|
||||||
|
|
|
@ -72,9 +72,6 @@ $(BUILD):
|
||||||
$(BUILD)/%.o: %.c
|
$(BUILD)/%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(BUILD)/%.o: $(PYSRC)/%.s
|
|
||||||
$(AS) -o $@ $<
|
|
||||||
|
|
||||||
$(BUILD)/%.o: $(PYSRC)/%.S
|
$(BUILD)/%.o: $(PYSRC)/%.S
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue