marker fixed

This commit is contained in:
Nicolas 2025-10-07 22:59:24 +02:00
parent ba3c56647d
commit 7fd0bb543e
2 changed files with 17 additions and 17 deletions

View File

@ -9,7 +9,7 @@ def get_function_start() -> str:
return """ return """
int function_start(){ int function_start(){
result_int(0); // dummy call instruction before marker gets striped result_int(0); // dummy call instruction before marker gets striped
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
return 1; return 1;
} }
""" """
@ -19,7 +19,7 @@ def get_function_end() -> str:
return """ return """
int function_end(){ int function_end(){
result_int(0); result_int(0);
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
return 1; return 1;
} }
""" """
@ -28,9 +28,9 @@ def get_function_end() -> str:
def get_op_code(op: str, type1: str, type2: str, type_out: str) -> str: def get_op_code(op: str, type1: str, type2: str, type_out: str) -> str:
return f""" return f"""
void {op}_{type1}_{type2}({type1} arg1, {type2} arg2) {{ void {op}_{type1}_{type2}({type1} arg1, {type2} arg2) {{
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
result_{type_out}_{type2}(arg1 {op_signs[op]} arg2, arg2); result_{type_out}_{type2}(arg1 {op_signs[op]} arg2, arg2);
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
}} }}
""" """
@ -38,9 +38,9 @@ def get_op_code(op: str, type1: str, type2: str, type_out: str) -> str:
def get_op_code_float(op: str, type1: str, type2: str) -> str: def get_op_code_float(op: str, type1: str, type2: str) -> str:
return f""" return f"""
void {op}_{type1}_{type2}({type1} arg1, {type2} arg2) {{ void {op}_{type1}_{type2}({type1} arg1, {type2} arg2) {{
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
result_float_{type2}((float)arg1 {op_signs[op]} arg2, arg2); result_float_{type2}((float)arg1 {op_signs[op]} arg2, arg2);
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
}} }}
""" """
@ -48,9 +48,9 @@ def get_op_code_float(op: str, type1: str, type2: str) -> str:
def get_op_code_int(op: str, type1: str, type2: str) -> str: def get_op_code_int(op: str, type1: str, type2: str) -> str:
return f""" return f"""
void {op}_{type1}_{type2}({type1} arg1, {type2} arg2) {{ void {op}_{type1}_{type2}({type1} arg1, {type2} arg2) {{
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
result_int_{type2}((int)(arg1 {op_signs[op]} arg2), arg2); result_int_{type2}((int)(arg1 {op_signs[op]} arg2), arg2);
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
}} }}
""" """
@ -70,9 +70,9 @@ def get_result_stubs2(type1: str, type2: str) -> str:
def get_read_reg0_code(type1: str, type2: str, type_out: str) -> str: def get_read_reg0_code(type1: str, type2: str, type_out: str) -> str:
return f""" return f"""
void read_{type_out}_reg0_{type1}_{type2}({type1} arg1, {type2} arg2) {{ void read_{type_out}_reg0_{type1}_{type2}({type1} arg1, {type2} arg2) {{
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
result_{type_out}_{type2}(dummy_{type_out}, arg2); result_{type_out}_{type2}(dummy_{type_out}, arg2);
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
}} }}
""" """
@ -80,9 +80,9 @@ def get_read_reg0_code(type1: str, type2: str, type_out: str) -> str:
def get_read_reg1_code(type1: str, type2: str, type_out: str) -> str: def get_read_reg1_code(type1: str, type2: str, type_out: str) -> str:
return f""" return f"""
void read_{type_out}_reg1_{type1}_{type2}({type1} arg1, {type2} arg2) {{ void read_{type_out}_reg1_{type1}_{type2}({type1} arg1, {type2} arg2) {{
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
result_{type1}_{type_out}(arg1, dummy_{type_out}); result_{type1}_{type_out}(arg1, dummy_{type_out});
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
}} }}
""" """
@ -90,10 +90,10 @@ def get_read_reg1_code(type1: str, type2: str, type_out: str) -> str:
def get_write_code(type1: str) -> str: def get_write_code(type1: str) -> str:
return f""" return f"""
void write_{type1}({type1} arg1) {{ void write_{type1}({type1} arg1) {{
asm volatile (".long 0xE100441F0F"); asm volatile (".long 0xE1401F0F");
dummy_{type1} = arg1; dummy_{type1} = arg1;
result_{type1}(arg1); result_{type1}(arg1);
asm volatile (".long 0xE200441F0F"); asm volatile (".long 0xE2401F0F");
}} }}
""" """

View File

@ -5,9 +5,9 @@ from enum import Enum
ByteOrder = Literal['little', 'big'] ByteOrder = Literal['little', 'big']
START_MARKER = 0xE100441F0F # Nop on x86-64 START_MARKER = 0xE1401F0F # Nop on x86-64
END_MARKER = 0xE200441F0F # Nop on x86-64 END_MARKER = 0xE2401F0F # Nop on x86-64
MARKER_LENGTH = 5 MARKER_LENGTH = 4
# on x86_64: call or jmp instruction when tail call optimized # on x86_64: call or jmp instruction when tail call optimized
LENGTH_CALL_INSTRUCTION = 5 LENGTH_CALL_INSTRUCTION = 5