Skip to content

Commit

Permalink
Merge pull request torvalds#184 from ojeda/improv
Browse files Browse the repository at this point in the history
A few improvements
  • Loading branch information
ojeda authored Apr 12, 2021
2 parents 8374974 + 4140620 commit 1fa10de
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -15557,6 +15557,7 @@ W: https://github.com/Rust-for-Linux/linux
B: https://github.com/Rust-for-Linux/linux/issues
T: git https://github.com/Rust-for-Linux/linux.git rust-next
F: rust/
F: samples/rust/
F: Documentation/rust/
K: \b(?i:rust)\b

Expand Down
15 changes: 10 additions & 5 deletions rust/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_RUST) += helpers.o exports.o
obj-$(CONFIG_RUST) += core.o compiler_builtins.o alloc.o kernel.o
extra-$(CONFIG_RUST) += bindings_generated.rs libmodule.so
extra-$(CONFIG_RUST) += exports_core_generated.h exports_alloc_generated.h
extra-$(CONFIG_RUST) += exports_kernel_generated.h
obj-$(CONFIG_RUST) += core.o compiler_builtins.o helpers.o
extra-$(CONFIG_RUST) += exports_core_generated.h

extra-$(CONFIG_RUST) += libmodule.so

extra-$(CONFIG_RUST) += bindings_generated.rs
obj-$(CONFIG_RUST) += alloc.o kernel.o
extra-$(CONFIG_RUST) += exports_alloc_generated.h exports_kernel_generated.h

obj-$(CONFIG_RUST) += exports.o

RUSTDOC = rustdoc

Expand Down
11 changes: 11 additions & 0 deletions rust/compiler_builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,14 @@ define_panicking_intrinsics!("`u128` should not be used", {
__udivti3,
__umodti3,
});

extern "C" {
fn rust_helper_BUG() -> !;
}

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
unsafe {
rust_helper_BUG();
}
}
2 changes: 1 addition & 1 deletion rust/kernel/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::fmt;

/// A pre-allocated buffer that implements [`core::fmt::Write`].
///
/// Consequtive writes will append to what has already been written.
/// Consecutive writes will append to what has already been written.
/// Writes that don't fit in the buffer will fail.
pub struct Buffer<'a> {
slice: &'a mut [u8],
Expand Down
13 changes: 0 additions & 13 deletions rust/kernel/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#[cfg(not(CONFIG_RUST))]
compile_error!("Missing kernel configuration for conditional compilation");

use core::panic::PanicInfo;

mod allocator;

#[doc(hidden)]
Expand Down Expand Up @@ -130,17 +128,6 @@ impl<'a> Drop for KParamGuard<'a> {
}
}

extern "C" {
fn rust_helper_BUG() -> !;
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
unsafe {
rust_helper_BUG();
}
}

/// Calculates the offset of a field from the beginning of the struct it belongs to.
///
/// # Example
Expand Down

0 comments on commit 1fa10de

Please sign in to comment.