Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ kernel-rv
kernel-la
sdcard-rv.img
second-easyfs.img
second-fat32.img
second-fat32.img
bootloader/loongarch64-direct/target/*
sdcard-la.img
2 changes: 1 addition & 1 deletion os/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ xmas-elf = "0.7.0"
virtio-drivers = "0.12.0"
fs = { path = "../fs" }
hashbrown = "0.12.3"
smoltcp = { git = "https://github.com/KyleMao2023/smoltcp", branch = "udp-fix", default-features = false, features = [
smoltcp = { git = "https://github.com/KyleMao2023/smoltcp", branch = "os", default-features = false, features = [
"alloc",
"medium-ethernet",
"proto-ipv4",
Expand Down
2 changes: 1 addition & 1 deletion os/src/syscall/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ fn append_cmsg(buf: &mut Vec<u8>, level: i32, ty: i32, payload: &[u8]) {
}

fn parse_rights_payload(payload: &[u8]) -> Result<Vec<Arc<FileDescription>>, ERRNO> {
if !payload.len().is_multiple_of(size_of::<i32>()) {
if !payload.len() % size_of::<i32>() == 0 {
return Err(ERRNO::EINVAL);
}

Expand Down
2 changes: 1 addition & 1 deletion os/src/syscall/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ pub fn sys_shmat(shmid: usize, shmaddr: usize, shmflg: i32) -> isize {
let _ = chosen_end;
chosen
} else {
if !shmaddr.is_multiple_of(crate::config::PAGE_SIZE) {
if !shmaddr % crate::config::PAGE_SIZE == 0 {
ipc::detach_segment(shmid);
return Err(ERRNO::EINVAL);
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[toolchain]
profile = "minimal"
# use the nightly version of the last stable toolchain, see <https://forge.rust-lang.org/>
channel = "nightly-2025-10-14"
channel = "nightly-2025-01-17"
components = ["rust-src", "llvm-tools-preview", "rustfmt", "clippy"]
targets = ["riscv64gc-unknown-none-elf"]
2 changes: 1 addition & 1 deletion user/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
profile = "minimal"
# use the nightly version of the last stable toolchain, see <https://forge.rust-lang.org/>
channel = "nightly-2025-10-14"
channel = "nightly-2025-01-17"
components = ["rust-src", "llvm-tools-preview", "rustfmt", "clippy"]
2 changes: 1 addition & 1 deletion user/src/bin/tcp_echo_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct WorkerCtx {
}

fn fmt_peer(peer: &SockAddrIn) -> ([u8; 4], u16) {
let ip = peer.sin_addr.to_be_bytes();
let ip = peer.ipv4();
let port = u16::from_be(peer.sin_port);
(ip, port)
}
Expand Down
5 changes: 3 additions & 2 deletions user/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ impl SockAddrIn {
Self {
sin_family: AF_INET as u16,
sin_port: port.to_be(),
sin_addr: u32::from_be_bytes(ip),
// Store the integer so the raw struct bytes match network order.
sin_addr: u32::from_ne_bytes(ip),
sin_zero: [0; 8],
}
}

/// Return IPv4 octets in host byte order.
pub fn ipv4(&self) -> [u8; 4] {
self.sin_addr.to_be_bytes()
self.sin_addr.to_ne_bytes()
}

/// Return port in host byte order.
Expand Down
Loading