Skip to content

Commit 05f34b0

Browse files
committed
Adjust llasm, llabi to be aware of changes to rust_task structure. Still not working fully.
1 parent 9935a48 commit 05f34b0

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/boot/llvm/llabi.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ let declare_abi (llctx:Llvm.llcontext) (llmod:Llvm.llmodule) : abi =
4343
(* TODO: other architectures besides x86 *)
4444
Llvm.struct_type llctx [|
4545
i32; (* size_t refcnt *)
46+
Llvm.pointer_type i32; (* rust_task *_delegate *)
4647
Llvm.pointer_type i32; (* stk_seg *stk *)
4748
Llvm.pointer_type i32; (* uintptr_t runtime_sp *)
4849
Llvm.pointer_type i32; (* uintptr_t rust_sp *)

src/boot/llvm/llasm.ml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,23 @@ let x86_glue
4141
"popl %edi";
4242
"popl %ebp";]
4343
in
44-
let load_esp_from_rust_sp = ["movl 12(%edx), %esp"] in
45-
let load_esp_from_runtime_sp = ["movl 8(%edx), %esp"] in
46-
let store_esp_to_rust_sp = ["movl %esp, 12(%edx)"] in
47-
let store_esp_to_runtime_sp = ["movl %esp, 8(%edx)"] in
44+
let load_esp_from_rust_sp =
45+
[ Printf.sprintf "movl %d(%%edx), %%esp"
46+
(Abi.task_field_rust_sp * 4)]
47+
in
48+
let load_esp_from_runtime_sp =
49+
[ Printf.sprintf "movl %d(%%edx), %%esp"
50+
(Abi.task_field_runtime_sp * 4) ]
51+
in
52+
let store_esp_to_rust_sp =
53+
[ Printf.sprintf "movl %%esp, %d(%%edx)"
54+
(Abi.task_field_rust_sp * 4) ]
55+
in
56+
let store_esp_to_runtime_sp =
57+
[ Printf.sprintf "movl %%esp, %d(%%edx)"
58+
(Abi.task_field_runtime_sp * 4) ]
59+
in
60+
4861
let list_init i f = (Array.to_list (Array.init i f)) in
4962
let list_init_concat i f = List.concat (list_init i f) in
5063

0 commit comments

Comments
 (0)