Commit Graph

109 Commits

Author SHA1 Message Date
Ruihan Li 04ef99cb82 Migrate existing code to use `VmIo` 2025-12-07 12:01:05 +08:00
Ruihan Li 13afca6441 Add `i8042.exist` to override ACPI flags 2025-12-07 09:52:42 +08:00
jiangjianfeng 83c158e3b5 Make device Inode behave like pointer 2025-12-04 20:55:01 +08:00
jiangjianfeng d8a4b3076f Support looking up block devices 2025-12-04 20:55:01 +08:00
Ruihan Li 0b664a012e Group modules into `device/registry` 2025-12-01 00:05:29 +08:00
Ruihan Li be01eef352 Revise error messages in `char.rs` 2025-12-01 00:05:29 +08:00
Ruihan Li 34a9f84c5a Remove `Char{File,Device}` & `DevtmpfsName` 2025-12-01 00:05:29 +08:00
Ruihan Li dc21266510 Remove `OpenCharFile` 2025-12-01 00:05:29 +08:00
Chen Chengjun e048a76afc Make the semantics of tty-related devices correct 2025-11-28 18:18:28 +08:00
Ruihan Li 17b62917cd Perform some remaining cleanups 2025-11-26 17:35:42 +08:00
Ruihan Li 0fd2066ac3 Fix potential atomic mode breaks 2025-11-26 17:35:42 +08:00
Ruihan Li d99791ba57 Fix the handling when the buffer is full 2025-11-26 17:35:42 +08:00
Ruihan Li efeaf5fa6e Fix potential deadlocks 2025-11-26 17:35:42 +08:00
Ruihan Li 42026b3eb9 Define a specific clock type 2025-11-26 17:35:42 +08:00
Ruihan Li 1c7fc4a6e6 Align the read behavior to Linux's 2025-11-26 17:35:42 +08:00
Ruihan Li 52a7d3eddd Simplify the logic related to I/O events 2025-11-26 17:35:42 +08:00
Ruihan Li 6e866cc4c2 Remove the unused event count 2025-11-26 17:35:42 +08:00
Ruihan Li 33428b46b9 Clarify error codes and messages 2025-11-26 17:35:42 +08:00
Ruihan Li 2892b8a977 Use `size_of` in preludes 2025-11-26 17:35:42 +08:00
Zhe Tang 20c0d3d178 Add proper error handling for unsupported `ioctl` commands in the EFI framebuffer 2025-11-24 18:56:29 +08:00
Zhe Tang 0043cc7504 Implement the color map and the related `ioctl` handlers for the EFI framebuffer 2025-11-24 18:56:29 +08:00
Zhe Tang d027b01f3b Implement the `ioctl` handlers for getting and setting information for the EFI framebuffer. 2025-11-24 18:56:29 +08:00
Zhe Tang 49068f23d8 Incorporate Linux-compatible data structures for the framebuffer's `ioctl` 2025-11-24 18:56:29 +08:00
Zhe Tang 93eaa7c247 Support `lseek`, `read`/`write` with offsets for the EFI framebuffer 2025-11-24 18:56:29 +08:00
Zhe Tang 26dc88dc80 Register `/dev/fb0` as a character device 2025-11-24 18:56:29 +08:00
Zhe Tang c33c37b593 Add the basic framework of /dev/fb0
Co-authored-by: Wei Zhang <ruoyuan.zw@antgroup.com>
2025-11-24 18:56:29 +08:00
Cautreoxit 869e04f6bb Add evdev module 2025-11-24 11:42:36 +08:00
Qingsong Chen 76c7752130 Separate inode and opened file types for BlockFile 2025-11-20 19:40:40 +08:00
Qingsong Chen e407dc7ce9 Refactor mem/misc char devices 2025-11-20 19:40:40 +08:00
Qingsong Chen 9e2f5adf9b Add partition support for block device 2025-11-20 10:43:24 +08:00
Ruihan Li 24502ac3d4 Add `InodeIo` to simplify `FileIo` and `Inode` 2025-11-19 10:33:51 +08:00
Ruihan Li 08dfe533c4 Use `Box<FileIo>` instead of `Arc<FileIo>` 2025-11-19 10:33:51 +08:00
jiangjianfeng 63354d670e Support mknod for /dev/full and /dev/tty0 2025-11-18 17:32:34 +08:00
Ruihan Li 7ebee6d8a1 Fix TTY's HUP events 2025-11-18 14:49:19 +08:00
jiangjianfeng 2f568d5e73 Read pty master should block if no pty slave is opened 2025-11-18 09:48:32 +08:00
Tao Su 83176020f2 Invoke get_report() using private memory 2025-11-17 15:26:45 +08:00
Qingsong Chen bb48b3814f Move DeviceId to separate device-id crate 2025-11-13 11:04:30 +08:00
jiangjianfeng cef527f372 Open /dev/tty should also increase pty slave count 2025-11-07 20:22:16 +08:00
jiangjianfeng 49485058ec Correct the device major ID for pty slave 2025-11-07 20:22:16 +08:00
jiangjianfeng a41db92b4e Support nonblocking mode for tty and pty 2025-11-07 20:22:16 +08:00
jiangjianfeng 601ac76676 Avoid unwrap on devpts when dropping pty master 2025-11-07 20:22:16 +08:00
jiangjianfeng cd981a0a8d Correct the behavior about closing pty 2025-11-07 20:22:16 +08:00
Chen Chengjun d42b006e1a Refactor named pipe to correct its opening and blocking behaviors 2025-11-03 09:57:48 +08:00
Chen Chengjun 5eddf21596 Introduce open API for Inode trait to replace as_* APIs 2025-11-03 09:57:48 +08:00
Chen Chengjun b447a605ed Introduce PerMountFlags and support MS_REMOUNT 2025-11-02 21:24:50 +08:00
Tao Su eb4edd25e8 Add TSM module 2025-10-31 08:53:27 +08:00
Ruihan Li 2d74e69b4b Add KDGKBMODE and KDSKBMODE ioctl support 2025-10-27 16:28:35 +08:00
Wei Zhang 2ba05a1673 Add KDGETMODE and KDSETMODE ioctl support
Add support for virtual console TTY mode management ioctls required by
Xorg and other display servers. The implementation includes:

- KDGETMODE: Query the current virtual console mode
- KDSETMODE: Switch between text and graphics modes

Virtual consoles utilize the framebuffer with two distinct modes:
- Text mode (default): Kernel renders text characters to framebuffer
- Graphics mode: User space applications gain full framebuffer control

Xorg requires KDSETMODE during initialization to switch to graphics
mode, preventing conflicts where both the kernel and Xorg would
simultaneously attempt to write to the framebuffer. This ensures
proper display handling and eliminates rendering artifacts.

Co-authored-by: Ruihan Li <lrh2000@pku.edu.cn>
2025-10-27 16:28:35 +08:00
Ruihan Li 38a217d201 Enhance `TtyDriver` to get the console 2025-10-27 16:28:35 +08:00
Wei Zhang 66d9dd41b9 Correct /dev/tty1 major number to 4
The major number for /dev/tty1 must be 4, as this value is hardcoded
in Linux and Linux syscall-compatible operating systems. Xorg uses
this major number directly, and incorrect values lead to confusion
and operational failures.

This change ensures compatibility with Xorg's expectations and
maintains system consistency.
2025-10-27 16:28:35 +08:00