Files
RedBear-OS/local/patches/base/P6-lived-block-size-512.patch
T
vasilito b9de373b31 Merge bootprocess branch overlay into 0.2.0
Restore all bootprocess branch files that were overwritten by later 0.2.0
commits. This overlay brings back the complete boot infrastructure:

- Configs: redbear-full, redbear-mini, redbear-device-services, driver .d files
- Kernel: IRQ affinity, x2APIC, C-states, NUMA (SLIT/SRAT), MCS locks, cpuidle
- Base patches: P0-P55 + new P6 (lived block_size=512) + P57 (fbbootlogd graceful init)
- Driver infra: driver-manager, udev-shim, thermald, cpufreqd, iommu, redox-driver-sys/core
- GPU: redox-drm with improved connector handling
- System: redbear-info, redbear-hwutils phase-timer-check
- Build system: fetch.rs improvements, build-iso.sh, run_full.sh
- Kernel source: new ACPI (SLIT, SRAT), cpuidle, cstate, MCS lock modules

83 files changed, +3966/-1248 lines
2026-05-27 06:47:23 +03:00

66 lines
2.4 KiB
Diff

diff --git a/drivers/storage/lived/src/main.rs b/drivers/storage/lived/src/main.rs
index 2ca1ff27..cd92fa85 100644
--- a/drivers/storage/lived/src/main.rs
+++ b/drivers/storage/lived/src/main.rs
@@ -55,8 +55,10 @@ impl LiveDisk {
}
impl Disk for LiveDisk {
+ // Must be 512 (redoxfs BLOCK_SIZE), not PAGE_SIZE: DiskWrapper::read rejects
+ // buffers not aligned to block_size, and redoxfs reads in 512-byte chunks.
fn block_size(&self) -> u32 {
- PAGE_SIZE as u32
+ 512
}
fn size(&self) -> u64 {
@@ -64,11 +66,12 @@ impl Disk for LiveDisk {
}
async fn read(&mut self, mut block: u64, buffer: &mut [u8]) -> syscall::Result<usize> {
- let mut offset = (block as usize) * PAGE_SIZE;
+ let bs = self.block_size() as usize;
+ let mut offset = (block as usize) * bs;
if offset + buffer.len() > self.original.len() {
return Err(syscall::Error::new(EINVAL));
}
- for chunk in buffer.chunks_mut(PAGE_SIZE) {
+ for chunk in buffer.chunks_mut(bs) {
match self.overlay.get(&block) {
Some(overlay) => {
chunk.copy_from_slice(&overlay[..chunk.len()]);
@@ -78,26 +81,27 @@ impl Disk for LiveDisk {
}
}
block += 1;
- offset += PAGE_SIZE;
+ offset += bs;
}
Ok(buffer.len())
}
async fn write(&mut self, mut block: u64, buffer: &[u8]) -> syscall::Result<usize> {
- let mut offset = (block as usize) * PAGE_SIZE;
+ let bs = self.block_size() as usize;
+ let mut offset = (block as usize) * bs;
if offset + buffer.len() > self.original.len() {
return Err(syscall::Error::new(EINVAL));
}
- for chunk in buffer.chunks(PAGE_SIZE) {
+ for chunk in buffer.chunks(bs) {
self.overlay.entry(block).or_insert_with(|| {
- let offset = (block as usize) * PAGE_SIZE;
- self.original[offset..offset + PAGE_SIZE]
+ let offset = (block as usize) * bs;
+ self.original[offset..offset + bs]
.to_vec()
.into_boxed_slice()
})[..chunk.len()]
.copy_from_slice(chunk);
block += 1;
- offset += PAGE_SIZE;
+ offset += bs;
}
Ok(buffer.len())
}