ms_abi added

This commit is contained in:
Nicolas 2025-10-07 23:13:18 +02:00
parent 4ead695a06
commit a965ab607e
3 changed files with 15 additions and 9 deletions

View File

@ -26,8 +26,14 @@ jobs:
- name: Install Python dependencies - name: Install Python dependencies
run: python -m pip install -e .[dev] run: python -m pip install -e .[dev]
- name: Build ops obj files and runner - name: Build ops obj files
run: bash src/copapy/obj/nativecompile.sh run: |
bash src/copapy/obj/nativecompile.sh
- name: Compile coparun
run: |
mkdir -p bin
gcc -O3 -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -Werror -g src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o bin/coparun
#- name: Lint code with flake8 #- name: Lint code with flake8
# run: flake8 # run: flake8
@ -82,7 +88,7 @@ jobs:
with: with:
vs-version: 'latest' vs-version: 'latest'
- name: Compile - name: Compile coparun
shell: cmd shell: cmd
run: | run: |
mkdir bin mkdir bin

View File

@ -10,7 +10,7 @@ optimization (/O2). For MSVC without optimization and gcc with -O3 there is no i
The callee code is composed of stencils build with gcc-12 -O3: The callee code is composed of stencils build with gcc-12 -O3:
``` bash ```
1000: f3 0f 1e fa endbr64 1000: f3 0f 1e fa endbr64
1004: 48 83 ec 08 sub $0x8,%rsp 1004: 48 83 ec 08 sub $0x8,%rsp
1008: 31 ff xor %edi,%edi 1008: 31 ff xor %edi,%edi
@ -35,7 +35,7 @@ The callee code is composed of stencils build with gcc-12 -O3:
## Caller ## Caller
The caller (src/copapy/runmem.c): The caller (src/copapy/runmem.c) calls the callee (here named "entr_point") like so:
``` c ``` c
case RUN_PROG: case RUN_PROG:
@ -51,7 +51,7 @@ case RUN_PROG:
Compiled with MSVC and optimization (crash): Compiled with MSVC and optimization (crash):
``` bash ```
00000001400078CA: 8B 1E mov ebx,dword ptr [rsi] 00000001400078CA: 8B 1E mov ebx,dword ptr [rsi]
00000001400078CC: 48 8D 0D AD 30 08 lea rcx,[??_C@_0BM@DFBMBFEB@RUN_PROG?5rel_entr_point?$DN?$CFi?6@] 00000001400078CC: 48 8D 0D AD 30 08 lea rcx,[??_C@_0BM@DFBMBFEB@RUN_PROG?5rel_entr_point?$DN?$CFi?6@]
00 00
@ -75,7 +75,7 @@ Compiled with MSVC and optimization (crash):
Compiled with MSVC and no optimization (no crash): Compiled with MSVC and no optimization (no crash):
``` bash ```
0000000140007978: 48 8B 44 24 70 mov rax,qword ptr [rsp+70h] 0000000140007978: 48 8B 44 24 70 mov rax,qword ptr [rsp+70h]
000000014000797D: 8B 00 mov eax,dword ptr [rax] 000000014000797D: 8B 00 mov eax,dword ptr [rax]
000000014000797F: 89 44 24 4C mov dword ptr [rsp+4Ch],eax 000000014000797F: 89 44 24 4C mov dword ptr [rsp+4Ch],eax

View File

@ -7,7 +7,7 @@ op_signs = {'add': '+', 'sub': '-', 'mul': '*', 'div': '/',
def get_function_start() -> str: def get_function_start() -> str:
return """ return """
int function_start(){ __attribute__((ms_abi)) 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 0xE2401F0F"); asm volatile (".long 0xE2401F0F");
return 1; return 1;
@ -17,7 +17,7 @@ def get_function_start() -> str:
def get_function_end() -> str: def get_function_end() -> str:
return """ return """
int function_end(){ __attribute__((ms_abi)) int function_end(){
result_int(0); result_int(0);
asm volatile (".long 0xE1401F0F"); asm volatile (".long 0xE1401F0F");
return 1; return 1;