Skip to content

Commit 39d1c00

Browse files
authored
Merge pull request #1 from rust-console/0.2
Updates to dependencies and Rust nightly
2 parents 01e2be8 + dc840ef commit 39d1c00

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rrt0"
3-
version = "0.1.3"
3+
version = "0.2.0"
44
authors = ["Jay Oster <[email protected]>"]
55
repository = "https://github.com/rust-console/rrt0"
66
description = "Simple cross-platform runtime / startup (like crt0)"
@@ -11,4 +11,4 @@ keywords = ["crt0", "runtime", "startup", "nintendo", "n64"]
1111
edition = "2018"
1212

1313
[dependencies]
14-
libm = "0.1"
14+
libm = "0.2"

src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(core_intrinsics)]
12
#![feature(global_asm)]
23
#![feature(lang_items)]
34
#![warn(rust_2018_idioms)]
@@ -7,16 +8,17 @@
78
mod math;
89
mod platforms;
910

10-
use core::panic::PanicInfo;
1111
pub use crate::platforms::*;
12+
use core::panic::PanicInfo;
1213

1314
/// This is the executable start function, which directly follows the entry point.
1415
#[cfg_attr(not(test), lang = "start")]
1516
#[cfg(not(test))]
16-
extern "C" fn start<T>(user_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize
17+
extern "C" fn start<T>(user_main: *const (), _argc: isize, _argv: *const *const u8) -> isize
1718
where
1819
T: Termination,
1920
{
21+
let user_main: fn() -> T = unsafe { core::mem::transmute(user_main) };
2022
user_main().report() as isize
2123
}
2224

@@ -37,11 +39,10 @@ impl Termination for () {
3739
#[cfg_attr(not(test), panic_handler)]
3840
#[no_mangle]
3941
fn panic(_info: &PanicInfo<'_>) -> ! {
40-
#[allow(clippy::empty_loop)]
41-
loop {}
42+
core::intrinsics::abort();
4243
}
4344

4445
/// Error handler personality language item (current no-op, to satisfy clippy).
4546
#[cfg_attr(not(test), lang = "eh_personality")]
4647
#[no_mangle]
47-
extern fn rust_eh_personality() {}
48+
extern "C" fn rust_eh_personality() {}

src/platforms.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#[cfg(any(unix, windows, target_vendor = "nintendo64"))]
22
pub use crate::math::*;
33

4-
#[cfg(any(unix, windows, target_vendor = "nintendo64"))]
5-
pub use libm::{F32Ext, F64Ext};
6-
74
#[cfg(target_vendor = "nintendo64")]
85
global_asm!(include_str!("platforms/n64/entrypoint.s"));

src/platforms/n64/entrypoint.s

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
_start:
2121
// Initialize stack
22-
lw $t0, OS_MEM_SIZE
22+
li $t0, OS_MEM_SIZE
23+
lw $t0, 0($t0)
2324
li $t1, 0x7FFFFFF0
2425
addu $sp, $t0, $t1
2526

@@ -46,7 +47,8 @@ _start:
4647

4748
// Store the FS location for the OS
4849
la $t0, __rom_end
49-
sw $t0, FS_START
50+
li $t1, FS_START
51+
sw $t0, 0($t1)
5052

5153
// So if we want to get fancy, we can load a second stage here.
5254
// The second stage should contain an ELF parser and TLB Initialization.

0 commit comments

Comments
 (0)