Skip to content

Commit

Permalink
support x86_64 for eventfd syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-bruce committed Apr 13, 2024
1 parent f293b69 commit ffaf706
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions ulib/axstarry/src/syscall_fs/fs_syscall_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ numeric_enum_macro::numeric_enum! {
pub enum FsSyscallId {
// fs
GETCWD = 17,
EVENT_FD = 19,
EVENTFD = 19,
EPOLL_CREATE = 20,
EPOLL_CTL = 21,
EPOLL_WAIT = 22,
Expand Down Expand Up @@ -69,7 +69,8 @@ numeric_enum_macro::numeric_enum! {
// fs
OPEN = 2,
STAT = 4,
EVENT_FD = 284,
EVENTFD = 284,
EVENTFD2 = 290,
GETCWD = 79,
UNLINK = 87,
EPOLL_CREATE = 213,
Expand Down
3 changes: 0 additions & 3 deletions ulib/axstarry/src/syscall_fs/imp/eventfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ use crate::syscall_fs::ctype::eventfd::EventFd;
use crate::{SyscallError, SyscallResult};

pub fn syscall_eventfd(args: [usize; 6]) -> SyscallResult {
#[cfg(target_arch = "x86_64")]
unimplemented!("syscall eventfd is not tested in x86_64 yet");

let initval = args[0] as u64;
let flags = args[1] as u32;

Expand Down
7 changes: 6 additions & 1 deletion ulib/axstarry/src/syscall_fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use imp::*;
/// 文件系统相关系统调用
pub fn fs_syscall(syscall_id: fs_syscall_id::FsSyscallId, args: [usize; 6]) -> SyscallResult {
match syscall_id {
EVENT_FD => syscall_eventfd(args),
EVENTFD => syscall_eventfd(args),
OPENAT => syscall_openat(args),
CLOSE => syscall_close(args),
READ => syscall_read(args),
Expand Down Expand Up @@ -59,6 +59,11 @@ pub fn fs_syscall(syscall_id: fs_syscall_id::FsSyscallId, args: [usize; 6]) -> S
PPOLL => syscall_ppoll(args),
PSELECT6 => syscall_pselect6(args),

#[cfg(target_arch = "x86_64")]
// eventfd syscall in x86_64 does not support flags, use 0 instead
EVENTFD => syscall_eventfd([args[0], 0, 0, 0, 0, 0]),
#[cfg(target_arch = "x86_64")]
EVENTFD2 => syscall_eventfd(args),
#[cfg(target_arch = "x86_64")]
DUP2 => syscall_dup2(args),
#[cfg(target_arch = "x86_64")]
Expand Down

0 comments on commit ffaf706

Please sign in to comment.