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>
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.
This patch enables more expressive ways to slice and iterate over
the `Id`s in an `IdSet` with `IdSet::iter_in`, which takes an arbitrary
`IdSetSlicer`.
`IdSet::iter_in` efficiently slices out unintended inner parts and
then, within the remaining parts, skips inactive bits by using
`BitSlice::iter_ones` from the `bitvec` crate.
It also delivers several implementations of `IdSetSlicer` so OSTD
consumers can represent `Id` ranges ergonomically.
In the Asterinas kernel, `CpuSet::iter_in` enables a cleaner way to
define an interator that cycles over the CPUs.
This patch creates a `PerCpuLoadStats` with slightly enhanced, enough
to serve load stats and the load-balancing algorithm. This struct can
be further enhanced for more elaborated load-balancing algorithms in
the future.
The load stats report has been fixed, as `SchedulerStats::nr_queued_and_running`
no longer includes idle threads in the queued total nor in the running
threads.
Furthemore, the load-balancing algorithm has been improved because it
no longer accounts with the idle threads when they're enqueued.