about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-09-28 11:31:44 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-09-28 11:31:44 -0700
commit1eaaae860fb725f5afdd8912fb2200f4f9929daa (patch)
tree2e92a5f6a4ec86fe349b9e5db748f64ec3e68870 /src/rt/rust_upcall.cpp
parente8757ea01f39826911a4c05ddf4b7e6990a56f27 (diff)
downloadrust-1eaaae860fb725f5afdd8912fb2200f4f9929daa.tar.gz
rust-1eaaae860fb725f5afdd8912fb2200f4f9929daa.zip
rt: Add an upcall to allocate space on the C stack. This will be used for native calls on the C stack.
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 60802be4ac0..e196adf70f0 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -202,6 +202,16 @@ upcall_dynastack_free(rust_task *task, void *ptr) {
     return task->dynastack.free(ptr);
 }
 
+/**
+ * Allocates |nbytes| bytes in the C stack and returns a pointer to the start
+ * of the allocated space.
+ */
+extern "C" CDECL void *
+upcall_alloc_c_stack(size_t nbytes) {
+    rust_scheduler *sched = rust_scheduler::get_task()->sched;
+    return sched->c_context.alloc_stack(nbytes);
+}
+
 extern "C" _Unwind_Reason_Code
 __gxx_personality_v0(int version,
                      _Unwind_Action actions,