aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/llvm/llabi.ml1
-rw-r--r--src/boot/llvm/llasm.ml21
2 files changed, 18 insertions, 4 deletions
diff --git a/src/boot/llvm/llabi.ml b/src/boot/llvm/llabi.ml
index 09340c53..08966efc 100644
--- a/src/boot/llvm/llabi.ml
+++ b/src/boot/llvm/llabi.ml
@@ -43,6 +43,7 @@ let declare_abi (llctx:Llvm.llcontext) (llmod:Llvm.llmodule) : abi =
(* TODO: other architectures besides x86 *)
Llvm.struct_type llctx [|
i32; (* size_t refcnt *)
+ Llvm.pointer_type i32; (* rust_task *_delegate *)
Llvm.pointer_type i32; (* stk_seg *stk *)
Llvm.pointer_type i32; (* uintptr_t runtime_sp *)
Llvm.pointer_type i32; (* uintptr_t rust_sp *)
diff --git a/src/boot/llvm/llasm.ml b/src/boot/llvm/llasm.ml
index 56448b07..5b66989d 100644
--- a/src/boot/llvm/llasm.ml
+++ b/src/boot/llvm/llasm.ml
@@ -41,10 +41,23 @@ let x86_glue
"popl %edi";
"popl %ebp";]
in
- let load_esp_from_rust_sp = ["movl 12(%edx), %esp"] in
- let load_esp_from_runtime_sp = ["movl 8(%edx), %esp"] in
- let store_esp_to_rust_sp = ["movl %esp, 12(%edx)"] in
- let store_esp_to_runtime_sp = ["movl %esp, 8(%edx)"] in
+ let load_esp_from_rust_sp =
+ [ Printf.sprintf "movl %d(%%edx), %%esp"
+ (Abi.task_field_rust_sp * 4)]
+ in
+ let load_esp_from_runtime_sp =
+ [ Printf.sprintf "movl %d(%%edx), %%esp"
+ (Abi.task_field_runtime_sp * 4) ]
+ in
+ let store_esp_to_rust_sp =
+ [ Printf.sprintf "movl %%esp, %d(%%edx)"
+ (Abi.task_field_rust_sp * 4) ]
+ in
+ let store_esp_to_runtime_sp =
+ [ Printf.sprintf "movl %%esp, %d(%%edx)"
+ (Abi.task_field_runtime_sp * 4) ]
+ in
+
let list_init i f = (Array.to_list (Array.init i f)) in
let list_init_concat i f = List.concat (list_init i f) in