Skip to content

Commit 31522ec

Browse files
committed
refactor: update starry-vdso dependency and remove vDSO module
1 parent ab20d99 commit 31522ec

File tree

5 files changed

+49
-167
lines changed

5 files changed

+49
-167
lines changed

Cargo.lock

Lines changed: 4 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ spin = "0.10"
7575
starry-process = "0.2"
7676
starry-signal = { version = "0.2", git = "https://github.com/Starry-OS/starry-signal.git", tag = "dev-v02" }
7777
starry-vm = "0.2"
78-
starry-vdso = { git = "https://github.com/Starry-OS/starry-vdso.git", rev = "8f1ab42" }
78+
starry-vdso = { git = "https://github.com/Starry-OS/starry-vdso.git", rev = "cf2d4a6" }
7979

8080
starry-core = { path = "./core" }
8181
starry-api = { path = "./api" }

core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ pub mod resources;
1717
pub mod shm;
1818
pub mod task;
1919
pub mod time;
20-
pub mod vdso;
2120
pub mod vfs;

core/src/mm.rs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,50 @@ impl ElfLoader {
251251
.aux_vector(PAGE_SIZE_4K, ldso.map(|elf| elf.base()))
252252
.collect::<Vec<_>>();
253253

254-
crate::vdso::load_vdso_data(&mut auxv, uspace)?;
254+
{
255+
let uspace = core::cell::RefCell::new(&mut *uspace);
256+
starry_vdso::vdso::load_vdso_data(
257+
&mut auxv,
258+
|map_user_start, vdso_paddr_page, vdso_size| {
259+
uspace
260+
.borrow_mut()
261+
.map_linear(
262+
map_user_start.into(),
263+
vdso_paddr_page,
264+
vdso_size,
265+
MappingFlags::READ | MappingFlags::EXECUTE | MappingFlags::USER,
266+
)
267+
.map_err(|_| AxError::InvalidExecutable)
268+
},
269+
|vvar_user_addr, vvar_paddr| {
270+
uspace
271+
.borrow_mut()
272+
.map_linear(
273+
vvar_user_addr.into(),
274+
vvar_paddr.into(),
275+
starry_vdso::config::VVAR_PAGES * PAGE_SIZE_4K,
276+
MappingFlags::READ | MappingFlags::USER,
277+
)
278+
.map_err(|_| AxError::InvalidExecutable)
279+
},
280+
|seg_user_start, seg_paddr, seg_align_size, ph| {
281+
let mut flags = MappingFlags::USER;
282+
if ph.flags.is_read() {
283+
flags |= MappingFlags::READ;
284+
}
285+
if ph.flags.is_write() {
286+
flags |= MappingFlags::WRITE;
287+
}
288+
if ph.flags.is_execute() {
289+
flags |= MappingFlags::EXECUTE;
290+
}
291+
uspace
292+
.borrow_mut()
293+
.map_linear(seg_user_start.into(), seg_paddr, seg_align_size, flags)
294+
.map_err(|_| AxError::InvalidExecutable)
295+
},
296+
)?;
297+
}
255298

256299
Ok(Ok((entry, auxv)))
257300
}

core/src/vdso.rs

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)