We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The compiler panicked when I tried to compile the following code:
extern crate x86; use core::{ptr, intrinsics}; use self::x86::io::{inb, outb}; /***** Serial I/O code *****/ const COM1: u16 = 0x3f8; const COM_RX: u16 = 0; // In: Receive buffer (DLAB=0) const COM_TX: u16 = 0; // Out: Transmit buffer (DLAB=0) const COM_DLL: u16 = 1; // Out: Divisor Latch Low (DLAB=1) const COM_DLM: u16 = 1; // Out: Divisor Latch High (DLAB=1) const COM_IER: u16 = 1; // Out: Interrupt Enable Register const COM_IER_RDI: u8 = 0x01; // Enable receiver data interrupt const COM_IIR: u16 = 2; // In: Interrupt ID Register const COM_FCR: u16 = 2; // Out: FIFO Control Register const COM_LCR: u16 = 3; // Out: Line Control Register const COM_LCR_DLAB: u8 = 0x80; // Divisor latch access bit const COM_LCR_WLEN8: u8 = 0x03; // Wordlength: 8 bits const COM_MCR: u16 = 4; // Out: Modem Control Register const COM_MCR_RTS: u8 = 0x02; // RTS complement const COM_MCR_DTR: u8 = 0x01; // DTR complement const COM_MCR_OUT2: u8 = 0x08; // Out2 complement const COM_LSR: u16 = 5; // In: Line Status Register const COM_LSR_DATA: u8 = 0x01; // Data available const COM_LSR_TXRDY: u8 = 0x20; // Transmit buffer avail const COM_LSR_TSRE: u8 = 0x40; // Transmitter off static mut serial_exists: bool = false; const MONO_BASE: u16 = 0x3b4u16; const MONO_BUF: u32 = 0xb0000; const CGA_BASE: u16 = 0x3D4u16; const CGA_BUF: u32 = 0xb8000; const CRT_ROWS: u32 = 25; const CRT_COLS: u32 = 80; const CRT_SIZE: u32 = CRT_ROWS * CRT_COLS; static mut crt_buf: *mut u16 = 0 as *mut u16; static mut crt_pos: u16 = 0; pub enum Color { Black = 0, Blue = 1, Green = 2, Cyan = 3, Red = 4, Pink = 5, Brown = 6, LightGray = 7, DarkGray = 8, LightBlue = 9, LightGreen = 10, LightCyan = 11, LightRed = 12, LightPink = 13, Yellow = 14, White = 15, } pub fn clear_screen(background: u16) { for i in 0..80*25 { unsafe { *((0xb8000 + i * 2) as *mut u16) = (background as u16) << 12; } } } fn cga_init() { unsafe { crt_buf = CGA_BUF as *mut u16; let was: u16 = intrinsics::volatile_load(crt_buf); intrinsics::volatile_store(crt_buf, 0xa55a); let addr_6845: u16 = if intrinsics::volatile_load(crt_buf as *const u16) != 0xa55a { crt_buf = MONO_BUF as *mut u16; MONO_BASE } else { intrinsics::volatile_store(crt_buf, was); CGA_BASE }; outb(addr_6845, 14); crt_pos = (inb(addr_6845 + 1) as u16) << 8; outb(addr_6845, 15); crt_pos |= inb(addr_6845 + 1) as u16; } } fn serial_init() { unsafe { // Turn off the FIFO outb(COM1+COM_FCR, 0); // Set speed; requires DLAB latch outb(COM1+COM_LCR, COM_LCR_DLAB); outb(COM1+COM_DLL, (115200 / 9600) as u8); outb(COM1+COM_DLM, 0); // 8 data bits, 1 stop bit, parity off; turn off DLAB latch outb(COM1+COM_LCR, COM_LCR_WLEN8 & (!COM_LCR_DLAB)); // No modem controls outb(COM1+COM_MCR, 0); // Enable rcv interrupts outb(COM1+COM_IER, COM_IER_RDI); // Clear any preexisting overrun indications and interrupts // Serial port doesn't exist if COM_LSR returns 0xFF serial_exists = inb(COM1+COM_LSR) != 0xff; inb(COM1+COM_IIR); inb(COM1+COM_RX); } } pub fn console_init() { cga_init(); serial_init(); }
stack backtrace:
1: 0x7fca77ef7579 - sys::backtrace::tracing::imp::write::h4dc38f76be463a237ls 2: 0x7fca77eff296 - panicking::on_panic::h6397ac94db38aaebEmx 3: 0x7fca77ec350e - rt::unwind::begin_unwind_inner::h75c2cf93044e2230iPw 4: 0x7fca77ec4257 - rt::unwind::begin_unwind_fmt::h330a5507242e40f4oOw 5: 0x7fca77efee91 - rust_begin_unwind 6: 0x7fca77f5072f - panicking::panic_fmt::h8cd068804ffdc08dJ7E 7: 0x7fca77f4aa42 - panicking::panic_bounds_check::hdce11bec4da8707bP6E 8: 0x7fca775f7ae2 - back::write::report_inline_asm::he486ded170c4b7abAsd 9: 0x7fca775f7bfe - back::write::inline_asm_handler::h24be2a5729e82af9Gtd 10: 0x7fca73ffceb0 - _ZN12_GLOBAL__N_19AsmParser11DiagHandlerERKN4llvm12SMDiagnosticEPv 11: 0x7fca7423fab4 - _ZNK4llvm9SourceMgr12PrintMessageERNS_11raw_ostreamENS_5SMLocENS0_8DiagKindERKNS_5TwineENS_8ArrayRefINS_7SMRangeEEENS8_INS_7SMFixItEEEb 12: 0x7fca7423fbc4 - _ZNK4llvm9SourceMgr12PrintMessageENS_5SMLocENS0_8DiagKindERKNS_5TwineENS_8ArrayRefINS_7SMRangeEEENS6_INS_7SMFixItEEEb 13: 0x7fca73ffd4b4 - _ZN12_GLOBAL__N_19AsmParser5ErrorEN4llvm5SMLocERKNS1_5TwineENS1_8ArrayRefINS1_7SMRangeEEE 14: 0x7fca736ae361 - _ZN12_GLOBAL__N_112X86AsmParser26MatchAndEmitATTInstructionEN4llvm5SMLocERjRNS1_15SmallVectorImplISt10unique_ptrINS1_18MCParsedAsmOperandESt14default_deleteIS6_EEEERNS1_10MCStreamerERmb.constprop.217 15: 0x7fca740052bf - _ZN12_GLOBAL__N_19AsmParser14parseStatementERNS_18ParseStatementInfoEPN4llvm23MCAsmParserSemaCallbackE.constprop.430 16: 0x7fca740076d0 - _ZN12_GLOBAL__N_19AsmParser3RunEbb 17: 0x7fca739438ad - _ZNK4llvm10AsmPrinter13EmitInlineAsmENS_9StringRefERKNS_15MCSubtargetInfoERKNS_15MCTargetOptionsEPKNS_6MDNodeENS_9InlineAsm10AsmDialectE 18: 0x7fca7394457b - _ZNK4llvm10AsmPrinter13EmitInlineAsmEPKNS_12MachineInstrE 19: 0x7fca739413bc - _ZN4llvm10AsmPrinter16EmitFunctionBodyEv 20: 0x7fca736af1b5 - _ZN4llvm13X86AsmPrinter20runOnMachineFunctionERNS_15MachineFunctionE 21: 0x7fca741b0c2e - _ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE 22: 0x7fca741b0faa - _ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE 23: 0x7fca741b07e8 - _ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE 24: 0x7fca73171653 - LLVMRustWriteOutputFile at /home/dongz/scratch/rust/src/rustllvm/PassWrapper.cpp:251 25: 0x7fca775f6113 - back::write::write_output_file::h8ba8deba603b318bW9c 26: 0x7fca775f88dd - back::write::optimize_and_codegen::closure.46515 27: 0x7fca7760032b - back::write::execute_work_item::h8b77bd32204d4bf1dZd 28: 0x7fca775f98c8 - back::write::run_passes::hf3594005c97f9531rKd 29: 0x7fca784625e6 - driver::phase_5_run_llvm_passes::h45d30a833d0bcb75rOa 30: 0x7fca7841892a - driver::compile_input::h5e69299e94f977e5Tba 31: 0x7fca7857a80b - run_compiler::hb83720387e7df0e70bc 32: 0x7fca785780d7 - boxed::F.FnBox::call_box::h13079848712025015541 33: 0x7fca78577b44 - rt::unwind::try::try_fn::h13173708879882063258 34: 0x7fca77efee38 - __rust_try 35: 0x7fca77eeb6a2 - rt::unwind::try::inner_try::hf6306aae862ccdd9bLw 36: 0x7fca78577cd8 - boxed::F.FnBox::call_box::h14316091596318611009 37: 0x7fca77efe283 - sys::thread::Thread::new::thread_start::h03e9a5e6682fce11YUv 38: 0x7fca7271e0a3 - start_thread 39: 0x7fca77b7e07c - clone 40: 0x0 -
rust version: rustc 1.4.0-dev (7bb0d0d 2015-08-30) binary: rustc commit-hash: 7bb0d0d commit-date: 2015-08-30 host: x86_64-unknown-linux-gnu release: 1.4.0-dev
The text was updated successfully, but these errors were encountered:
Any update on this?
Sorry, something went wrong.
What is the code for x86?
x86
@dongz9 reiterating what arielb1 said, can you supply the code for the extern crate you're using?
extern crate
直接运行cargo命令没问题,用插件编译遇到这问题,,
Closing as non-reproducible. Please reopen if we can obtain a code sample for x86.
No branches or pull requests
The compiler panicked when I tried to compile the following code:
stack backtrace:
rust version:
rustc 1.4.0-dev (7bb0d0d 2015-08-30)
binary: rustc
commit-hash: 7bb0d0d
commit-date: 2015-08-30
host: x86_64-unknown-linux-gnu
release: 1.4.0-dev
The text was updated successfully, but these errors were encountered: