blob: a0124425503d74e29d2474c0447400683df1769b [file] [log] [blame]
Andrew Walbrandd74b902022-04-14 16:12:50 +00001// Copyright 2022, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Basic functionality for bare-metal binaries to run in a VM under crosvm.
16
17#![no_std]
18
19pub mod console;
Andrew Walbranb996b4a2022-04-22 15:15:41 +000020mod entry;
Pierre-Clément Tosi9a658f72022-10-10 15:18:54 +010021pub mod layout;
22mod linker;
David Brazdil8b557772022-07-05 12:22:20 +010023pub mod logger;
Andrew Walbrandd74b902022-04-14 16:12:50 +000024pub mod power;
25pub mod uart;
26
27use core::panic::PanicInfo;
28use power::reboot;
29
30#[panic_handler]
31fn panic(info: &PanicInfo) -> ! {
32 eprintln!("{}", info);
33 reboot()
34}
David Brazdila51c6f02022-10-12 09:51:48 +000035
Pierre-Clément Tosi9a658f72022-10-10 15:18:54 +010036/// Reference to __stack_chk_guard.
37pub static STACK_CHK_GUARD: &u64 = unsafe { &linker::__stack_chk_guard };
38
David Brazdila51c6f02022-10-12 09:51:48 +000039#[no_mangle]
40extern "C" fn __stack_chk_fail() -> ! {
41 panic!("stack guard check failed");
42}