Skip to content

Commit e010f32

Browse files
authored
Merge pull request #169 from alistair23/alistair/app_head
bors causes trouble. Manually merging...
2 parents 004a3f5 + 0e1ba0a commit e010f32

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

core/src/entry_point/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ libtock_codegen::make_read_env_var!("APP_HEAP_SIZE");
8484
/// into the rustc-generated main(). This cannot use mutable global variables or
8585
/// global references to globals until it is done setting up the data segment.
8686
#[no_mangle]
87-
unsafe extern "C" fn rust_start(app_start: usize, stacktop: usize, _app_heap_break: usize) -> ! {
87+
unsafe extern "C" fn rust_start(app_start: usize, stacktop: usize, app_heap_start: usize) -> ! {
8888
extern "C" {
8989
// This function is created internally by `rustc`. See
9090
// `src/lang_items.rs` for more details.
@@ -122,9 +122,6 @@ unsafe extern "C" fn rust_start(app_start: usize, stacktop: usize, _app_heap_bre
122122
// We get this from the environment to make it easy to set per compile.
123123
let app_heap_size: usize = read_APP_HEAP_SIZE();
124124

125-
// Make the heap start exactly at bss_end. The suggested _app_heap_break
126-
// is almost always going to be too big and leads to us wasting memory.
127-
let app_heap_start = bss_end;
128125
let app_heap_end = app_heap_start + app_heap_size;
129126

130127
// Tell the kernel the new app heap break.

core/src/entry_point/start_item_riscv32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub unsafe extern "C" fn _start() -> ! {
7878
//
7979
// memop(11, stacktop + appdata_size);
8080
li a0, 4 // a0 = 4 // memop syscall
81-
li a1, 11 // a1 = 10
81+
li a1, 11 // a1 = 11
8282
mv a2, t1 // a2 = appdata_size
8383
ecall // memop
8484
//
@@ -88,7 +88,7 @@ pub unsafe extern "C" fn _start() -> ! {
8888
mv a0, s0 // first arg is app_start
8989
mv s0, sp // Set the frame pointer to sp.
9090
mv a1, s1 // second arg is stacktop
91-
mv a2, s2 // third arg is app_heap_break
91+
mv a2, t1 // third arg is app_heap_break that we told the kernel
9292
jal rust_start"
9393
: // No output operands
9494
:

0 commit comments

Comments
 (0)