Merge branch 'update-toolchain-2022' into 'master'

Update toolchain to 2022-03-18.

See merge request redox-os/drivers!79
This commit is contained in:
4lDO2
2022-03-27 10:04:06 +00:00
31 changed files with 248 additions and 384 deletions
Generated
+161 -280
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -13,5 +13,5 @@ num-traits = "0.2"
parking_lot = "0.11.1"
plain = "0.2.3"
redox-log = "0.1.1"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
thiserror = "1"
+1 -1
View File
@@ -9,5 +9,5 @@ byteorder = "1.2"
log = "0.4"
partitionlib = { git = "https://gitlab.redox-os.org/redox-os/partitionlib.git" }
redox-log = "0.1"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
block-io-wrapper = { path = "../block-io-wrapper" }
+4 -4
View File
@@ -76,7 +76,7 @@ impl HbaPort {
pub fn start(&mut self) {
while self.cmd.readf(HBA_PORT_CMD_CR) {
unsafe { llvm_asm!("pause"); }
core::hint::spin_loop();
}
self.cmd.writef(HBA_PORT_CMD_FRE | HBA_PORT_CMD_ST, true);
@@ -86,7 +86,7 @@ impl HbaPort {
self.cmd.writef(HBA_PORT_CMD_ST, false);
while self.cmd.readf(HBA_PORT_CMD_FR | HBA_PORT_CMD_CR) {
unsafe { llvm_asm!("pause"); }
core::hint::spin_loop();
}
self.cmd.writef(HBA_PORT_CMD_FRE, false);
@@ -306,7 +306,7 @@ impl HbaPort {
}
while self.tfd.readf((ATA_DEV_BUSY | ATA_DEV_DRQ) as u32) {
unsafe { llvm_asm!("pause"); }
core::hint::spin_loop();
}
self.ci.writef(1 << slot, true);
@@ -326,7 +326,7 @@ impl HbaPort {
pub fn ata_stop(&mut self, slot: u32) -> Result<()> {
while self.ata_running(slot) {
unsafe { llvm_asm!("pause"); }
core::hint::spin_loop();
}
self.stop();
-2
View File
@@ -1,5 +1,3 @@
#![feature(llvm_asm)]
extern crate syscall;
extern crate byteorder;
+1 -1
View File
@@ -7,4 +7,4 @@ edition = "2018"
bitflags = "1"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch = "redox-unix" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
-1
View File
@@ -1,7 +1,6 @@
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![allow(unused_parens)]
#![feature(llvm_asm)]
#![feature(concat_idents)]
extern crate event;
+1 -1
View File
@@ -5,4 +5,4 @@ edition = "2018"
[dependencies]
orbclient = "0.3.27"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
+1 -1
View File
@@ -7,4 +7,4 @@ edition = "2018"
bitflags = "1"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch = "redox-unix" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
-2
View File
@@ -1,5 +1,3 @@
#![feature(llvm_asm)]
extern crate event;
extern crate netutils;
extern crate syscall;
+1 -1
View File
@@ -8,5 +8,5 @@ bitflags = "1"
log = "0.4"
redox-log = "0.1"
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
spin = "0.9"
-1
View File
@@ -1,5 +1,4 @@
//#![deny(warnings)]
#![feature(llvm_asm)]
extern crate bitflags;
extern crate spin;
+1 -1
View File
@@ -6,4 +6,4 @@ version = "1.0.0"
bitflags = "1.0"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch = "redox-unix" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
+1 -1
View File
@@ -10,7 +10,7 @@ crossbeam-channel = "0.4"
futures = "0.3"
log = "0.4"
redox-log = "0.1"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
partitionlib = { git = "https://gitlab.redox-os.org/redox-os/partitionlib.git" }
smallvec = "1"
block-io-wrapper = { path = "../block-io-wrapper" }
+1 -1
View File
@@ -20,7 +20,7 @@ log = "0.4"
paw = "1.0"
plain = "0.2"
redox-log = "0.1"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
smallvec = "1"
-2
View File
@@ -1,7 +1,5 @@
//! Interface to `pcid`.
#![feature(llvm_asm)]
mod driver_interface;
mod pci;
pub use driver_interface::*;
-2
View File
@@ -1,5 +1,3 @@
#![feature(llvm_asm)]
use std::fs::{File, metadata, read_dir};
use std::io::prelude::*;
use std::os::unix::io::{FromRawFd, RawFd};
+6 -13
View File
@@ -1,6 +1,8 @@
use std::convert::TryFrom;
use std::sync::{Mutex, Once};
use syscall::io::{Io as _, Pio};
pub use self::bar::PciBar;
pub use self::bus::{PciBus, PciBusIter};
pub use self::class::PciClass;
@@ -71,13 +73,8 @@ impl CfgAccess for Pci {
let offset = u8::try_from(offset).expect("offset too large for PCI 3.0 configuration space");
let address = Self::address(bus, dev, func, offset);
let value: u32;
llvm_asm!("mov dx, 0xCF8
out dx, eax
mov dx, 0xCFC
in eax, dx"
: "={eax}"(value) : "{eax}"(address) : "dx" : "intel", "volatile");
value
Pio::<u32>::new(0xCF8).write(address);
Pio::<u32>::new(0xCFC).read()
}
unsafe fn read(&self, bus: u8, dev: u8, func: u8, offset: u16) -> u32 {
@@ -91,12 +88,8 @@ impl CfgAccess for Pci {
let offset = u8::try_from(offset).expect("offset too large for PCI 3.0 configuration space");
let address = Self::address(bus, dev, func, offset);
llvm_asm!("mov dx, 0xCF8
out dx, eax"
: : "{eax}"(address) : "dx" : "intel", "volatile");
llvm_asm!("mov dx, 0xCFC
out dx, eax"
: : "{eax}"(value) : "dx" : "intel", "volatile");
Pio::<u32>::new(0xCF8).write(address);
Pio::<u32>::new(0xCFC).write(value);
}
unsafe fn write(&self, bus: u8, dev: u8, func: u8, offset: u16, value: u32) {
let _guard = self.lock.lock().unwrap();
+1 -1
View File
@@ -5,4 +5,4 @@ authors = ["Tibor Nagy <xnagytibor@gmail.com>"]
edition = "2018"
[dependencies]
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
+1 -1
View File
@@ -6,4 +6,4 @@ edition = "2018"
[dependencies]
bitflags = "1"
orbclient = "0.3.27"
redox_syscall = "0.2.11"
redox_syscall = "0.2.12"
+2 -2
View File
@@ -1,4 +1,4 @@
#![feature(llvm_asm)]
#![feature(asm_const)]
#[macro_use]
extern crate bitflags;
@@ -20,7 +20,7 @@ mod keymap;
mod state;
mod vm;
fn daemon(daemon: syscall::Daemon) -> ! {
fn daemon(daemon: syscall::Daemon) -> core::convert::Infallible {
unsafe {
iopl(3).expect("ps2d: failed to get I/O permission");
}
+38 -26
View File
@@ -4,6 +4,8 @@
// As well as the Linux implementation here:
// http://elixir.free-electrons.com/linux/v4.1/source/drivers/input/mouse/vmmouse.c
use core::arch::global_asm;
const MAGIC: u32 = 0x564D5868;
const PORT: u16 = 0x5658;
@@ -24,36 +26,46 @@ pub const LEFT_BUTTON: u32 = 0x20;
pub const RIGHT_BUTTON: u32 = 0x10;
pub const MIDDLE_BUTTON: u32 = 0x08;
global_asm!("
.globl cmd_inner
cmd_inner:
mov r8, rdi
// 2nd argument `cmd` as per sysv64.
mov ecx, esi
// 3rd argument `arg` as per sysv64.
mov ebx, edx
mov eax, {MAGIC}
mov dx, {PORT}
in eax, dx
xchg rdi, r8
mov DWORD PTR [rdi + 0x00], eax
mov DWORD PTR [rdi + 0x04], ebx
mov DWORD PTR [rdi + 0x08], ecx
mov DWORD PTR [rdi + 0x0C], edx
mov DWORD PTR [rdi + 0x10], esi
mov DWORD PTR [rdi + 0x14], r8d
",
MAGIC = const MAGIC,
PORT = const PORT,
);
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub unsafe fn cmd(cmd: u32, arg: u32) -> (u32, u32, u32, u32, u32, u32) {
let a: u32;
let b: u32;
let c: u32;
let d: u32;
let si: u32;
let di: u32;
extern "sysv64" {
fn cmd_inner(array_ptr: *mut u32, cmd: u32, arg: u32);
}
llvm_asm!(
"in eax, dx"
:
"={eax}"(a),
"={ebx}"(b),
"={ecx}"(c),
"={edx}"(d),
"={esi}"(si),
"={edi}"(di)
:
"{eax}"(MAGIC),
"{ebx}"(arg),
"{ecx}"(cmd),
"{dx}"(PORT)
:
"memory"
:
"intel", "volatile"
);
let mut array = [0_u32; 6];
(a, b, c, d, si, di)
cmd_inner(array.as_mut_ptr(), cmd, arg);
let [a, b, c, d, e, f] = array;
(a, b, c, d, e, f)
}
pub fn enable(relative: bool) -> bool {
+1 -1
View File
@@ -7,4 +7,4 @@ edition = "2018"
bitflags = "1"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch = "redox-unix" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.2.11"
redox_syscall = "0.2.12"
+1 -1
View File
@@ -285,7 +285,7 @@ impl Rtl8168 {
println!(" - Reset");
self.regs.cmd.writef(1 << 4, true);
while self.regs.cmd.readf(1 << 4) {
llvm_asm!("pause");
core::hint::spin_loop();
}
// Set up rx buffers
+1 -3
View File
@@ -1,5 +1,3 @@
#![feature(llvm_asm)]
extern crate event;
extern crate netutils;
extern crate syscall;
@@ -200,5 +198,5 @@ fn main() {
let _ = syscall::physunmap(address);
}
process::exit(0);
}).expect("rtl8168d: failed to create daemon")
}).expect("rtl8168d: failed to create daemon");
}
+1 -1
View File
@@ -10,6 +10,6 @@ license = "MIT"
[dependencies]
base64 = "0.11" # Only for debugging
plain = "0.2"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
thiserror = "1"
xhcid = { path = "../xhcid" }
+1 -1
View File
@@ -6,4 +6,4 @@ edition = "2018"
[dependencies]
orbclient = "0.3.27"
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
orbclient = "0.3.27"
ransid = "0.4"
rusttype = { version = "0.2", optional = true }
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
[features]
default = []
-1
View File
@@ -1,5 +1,4 @@
#![feature(allocator_api)]
#![feature(llvm_asm)]
extern crate orbclient;
extern crate syscall;
+19 -28
View File
@@ -1,47 +1,38 @@
use core::arch::asm;
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[cold]
pub unsafe fn fast_copy(dst: *mut u8, src: *const u8, len: usize) {
llvm_asm!("cld
rep movsb"
:
: "{rdi}"(dst as usize), "{rsi}"(src as usize), "{rcx}"(len)
: "cc", "memory", "rdi", "rsi", "rcx"
: "intel", "volatile");
// direction flag must always be cleared, as per the System V ABI
asm!("rep movsb",
inout("rdi") dst as usize => _, inout("rsi") src as usize => _, inout("rcx") len => _,
options(nostack, preserves_flags),
);
}
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[cold]
pub unsafe fn fast_copy64(dst: *mut u64, src: *const u64, len: usize) {
llvm_asm!("cld
rep movsq"
:
: "{rdi}"(dst as usize), "{rsi}"(src as usize), "{rcx}"(len)
: "cc", "memory", "rdi", "rsi", "rcx"
: "intel", "volatile");
asm!("rep movsq",
inout("rdi") dst as usize => _, inout("rsi") src as usize => _, inout("rcx") len => _,
options(nostack, preserves_flags),
);
}
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[cold]
pub unsafe fn fast_set32(dst: *mut u32, src: u32, len: usize) {
llvm_asm!("cld
rep stosd"
:
: "{rdi}"(dst as usize), "{eax}"(src), "{rcx}"(len)
: "cc", "memory", "rdi", "rcx"
: "intel", "volatile");
asm!("rep stosd",
inout("rdi") dst as usize => _, in("eax") src, inout("rcx") len => _,
options(nostack, preserves_flags),
);
}
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[cold]
pub unsafe fn fast_set64(dst: *mut u64, src: u64, len: usize) {
llvm_asm!("cld
rep stosq"
:
: "{rdi}"(dst as usize), "{rax}"(src), "{rcx}"(len)
: "cc", "memory", "rdi", "rcx"
: "intel", "volatile");
asm!("rep stosq",
inout("rdi") dst as usize => _, in("rax") src, inout("rcx") len => _,
options(nostack, preserves_flags),
);
}
+1 -1
View File
@@ -21,7 +21,7 @@ lazy_static = "1.4"
log = "0.4"
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox-log = "0.1"
redox_syscall = "0.2.9"
redox_syscall = "0.2.12"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
smallvec = { version = "1", features = ["serde"] }