Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 支持动态链接 #910

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
740c6ff
fix(mm):优化extract中对before和after VMA映射情况的判断 (#802) (#803)
Jomocool May 3, 2024
62da39b
feat(mm):添加MAP_FIXED处理 (#804)
Jomocool May 3, 2024
35ae1f6
feat(mm):添加MAP_FIXED处理 (#805)
Jomocool May 3, 2024
9bf53ec
feat(elf): [WIP] Dynamic link support (#806)
Chiichen May 3, 2024
80ca935
20240524 3:40
MemoryShore May 23, 2024
d1d0aca
20240527 0010
MemoryShore May 26, 2024
33e9f0b
修复mmap未延迟分配内存的问题
MemoryShore May 27, 2024
8eb687c
Merge branch 'patch-add-file-mapping' into patch-fix-mmap
MemoryShore May 28, 2024
9261cb7
Revert "Merge branch 'patch-add-file-mapping' into patch-fix-mmap"
MemoryShore May 28, 2024
aff3316
20240528 1800
MemoryShore May 28, 2024
653180e
Revert "Revert "Merge branch 'patch-add-file-mapping' into patch-fix-…
MemoryShore May 28, 2024
c4149d8
Merge branch 'patch-fix-mmap-revert' into patch-add-file-mapping
MemoryShore May 28, 2024
91222a3
Merge branch 'master' into patch-add-file-mapping
MemoryShore May 28, 2024
4e9f577
update-20240529-0347
MemoryShore May 28, 2024
95c37e4
update 20240604 0233
MemoryShore Jun 3, 2024
f1ad5b3
update 20240606 1800
MemoryShore Jun 6, 2024
d7211d0
update 20240607 0200
MemoryShore Jun 6, 2024
62ec0e0
update 20240617 1747
MemoryShore Jun 17, 2024
3ac055a
重写页面保护标志的构造逻辑
MemoryShore Jun 18, 2024
7fd7c6e
update20240620 1726
MemoryShore Jun 20, 2024
d2a37ed
Merge remote-tracking branch 'origin' into patch-add-file-mapping
MemoryShore Jun 23, 2024
00183e0
添加Riscv64的protection_map
MemoryShore Jun 23, 2024
5ef4037
简单实现fat文件系统的文件映射,添加msync系统调用
MemoryShore Jun 24, 2024
98c9be5
trait FileSystem增加统一接口
MemoryShore Jun 25, 2024
d5b5718
MountFS实现文件映射相关接口
MemoryShore Jun 25, 2024
eee564d
格式化代码
MemoryShore Jun 25, 2024
b5aca56
Merge branch 'master' into patch-add-file-mapping
MemoryShore Jun 29, 2024
34c585e
pagecache存储方式由HashMap改为XArray
MemoryShore Jul 2, 2024
90644bf
Merge branch 'master' into patch-add-file-mapping
MemoryShore Jul 16, 2024
2558777
使用读写锁包装Page结构体
MemoryShore Jul 24, 2024
c9e790b
PageCache由存放物理地址改为直接存放页面
MemoryShore Jul 24, 2024
8f338fb
优化protection_map的初始化方式
MemoryShore Jul 24, 2024
a6ff58c
添加shrink_list方法释放页面
MemoryShore Jul 26, 2024
535b702
Merge branch 'master' into patch-add-file-mapping
MemoryShore Jul 26, 2024
9ba2fa3
添加页面回收机制
MemoryShore Jul 28, 2024
38f4df0
Merge branch 'master' into patch-add-file-mapping
MemoryShore Jul 28, 2024
d7e76ec
添加页面回收内核线程
MemoryShore Jul 30, 2024
2f6b28d
缺页中断使用的锁修改为irq_save; 添加脏页回写机制
MemoryShore Aug 6, 2024
732a6d7
优化代码结构,添加部分注释
MemoryShore Aug 10, 2024
cc19c94
Merge branch 'master' into patch-add-file-mapping
MemoryShore Aug 19, 2024
b5aea85
优化PageCache的创建
MemoryShore Aug 22, 2024
bd48a3d
Merge branch 'master' into feat-dynamic-link
MemoryShore Aug 28, 2024
1a627e4
将入口点改为链接器;修正链接器加载地址
MemoryShore Aug 28, 2024
d6a5341
Merge branch 'master' into patch-add-file-mapping
MemoryShore Aug 28, 2024
baae979
Merge branch 'patch-add-file-mapping' into feat-dynamic-link
MemoryShore Aug 28, 2024
d8cde6e
修复合并错误
MemoryShore Aug 28, 2024
10d64ec
Merge branch 'patch-add-file-mapping' into feat-dynamic-link
MemoryShore Aug 28, 2024
e13cf39
修复do_cow_page死锁问题
MemoryShore Aug 28, 2024
94f1324
将PageFaultMessage中的地址对齐
MemoryShore Aug 28, 2024
ed782e6
Merge branch 'patch-add-file-mapping' into feat-dynamic-link
MemoryShore Aug 28, 2024
16c4232
auxv添加随机数指针;修复AtType序号错误
MemoryShore Aug 28, 2024
421d3ae
简单实现用户栈的16字节对齐
MemoryShore Aug 28, 2024
2207c1c
通过check fmt
MemoryShore Aug 29, 2024
6c4958b
完善用户栈的字节对齐机制
MemoryShore Aug 30, 2024
fae0f7a
通过riscv64编译
MemoryShore Aug 30, 2024
bacf498
修改测试程序路径
MemoryShore Aug 30, 2024
9aaa1b0
添加动态库libgcc_s.so.1
MemoryShore Aug 30, 2024
c966d61
feat: 初步支持动态链接程序运行 (#908)
MemoryShore Sep 2, 2024
9ee2f64
Revert "feat: 初步支持动态链接程序运行 (#908)" (#966)
Chiichen Oct 10, 2024
5b912a4
Merge pull request #965 from MemoryShore/feat-dynamic-link
Chiichen Oct 10, 2024
07d95d2
Merge branch 'master' into feat-dynamic-link
Chiichen Oct 10, 2024
19b5fd6
Merge remote-tracking branch 'remote/master' into feat-dynamic-link
Chiichen Oct 13, 2024
08146c9
chore: format & sync master
Chiichen Oct 13, 2024
dee3798
chore: remove dead code
Chiichen Oct 13, 2024
2edd19b
chore: sync Cargo.toml
Chiichen Oct 13, 2024
aad25d7
修复启动时panic错误
MemoryShore Oct 14, 2024
95f0a3c
Merge pull request #979 from MemoryShore/feat-dynamic-link
Chiichen Oct 15, 2024
25e31a4
chore: cp /lib to /lib64
Chiichen Oct 19, 2024
a756e6d
refactor(user/app): switch from musl to glibc
Chiichen Oct 19, 2024
5786e87
chore: remove test_glibc
Chiichen Oct 20, 2024
71ec314
chore(user/app): musl to glibc
Chiichen Oct 20, 2024
25bc042
feat: use prebuilt glibc
Chiichen Oct 20, 2024
8ac8cf6
feat: build glibc from source using latest stable glibc source archiv…
Chiichen Oct 29, 2024
be0407d
chore: remove redundant log in elf.rs
Chiichen Oct 31, 2024
3e674df
chore: use rand() to init random_num
Chiichen Oct 31, 2024
9c1ca44
把rand_bytes提取为公共的方法
fslongjin Nov 11, 2024
182a355
chore: downgrade glibc version from 2.40 to 2.35
Chiichen Nov 11, 2024
c157070
Merge branch 'feat-dynamic-link' of https://github.com/DragonOS-Commu…
fslongjin Nov 11, 2024
380b4c0
Merge remote-tracking branch 'origin/master' into feat-dynamic-link
Chiichen Dec 5, 2024
e1581cf
fix: compile error
Chiichen Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ wait_queue_macros = { path = "crates/wait_queue_macros" }
paste = "=1.0.14"
slabmalloc = { path = "crates/rust-slabmalloc" }
log = "0.4.21"
xarray = "0.1.0"
lru = "0.12.3"

# target为x86_64时,使用下面的依赖
Expand Down Expand Up @@ -89,4 +90,4 @@ debug = true # Controls whether the compiler passes `-g`

# The release profile, used for `cargo build --release`
[profile.release]
debug = false
debug = true
10 changes: 2 additions & 8 deletions kernel/src/arch/riscv64/process/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,8 @@ impl Syscall {
};
let (user_sp, argv_ptr) = unsafe {
param
.init_info()
.push_at(
// address_space
// .write()
// .user_stack_mut()
// .expect("No user stack found"),
&mut ustack_message,
)
.init_info_mut()
.push_at(&mut ustack_message)
.expect("Failed to push proc_init_info to user stack")
};
address_space.write().user_stack = Some(ustack_message);
Expand Down
14 changes: 6 additions & 8 deletions kernel/src/arch/x86_64/process/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ impl Syscall {
param.init_info_mut().args = argv;
param.init_info_mut().envs = envp;

// 生成16字节随机数
// TODO 暂时设为0
param.init_info_mut().rand_num = [0u8; 16];
Chiichen marked this conversation as resolved.
Show resolved Hide resolved

// 把proc_init_info写到用户栈上
let mut ustack_message = unsafe {
address_space
Expand All @@ -82,14 +86,8 @@ impl Syscall {
};
let (user_sp, argv_ptr) = unsafe {
param
.init_info()
.push_at(
// address_space
// .write()
// .user_stack_mut()
// .expect("No user stack found"),
&mut ustack_message,
)
.init_info_mut()
.push_at(&mut ustack_message)
.expect("Failed to push proc_init_info to user stack")
};
address_space.write().user_stack = Some(ustack_message);
Expand Down
12 changes: 11 additions & 1 deletion kernel/src/driver/video/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use crate::{
rwlock::{RwLock, RwLockReadGuard},
spinlock::SpinLock,
},
mm::{mmio_buddy::mmio_pool, page::EntryFlags},
mm::{
allocator::page_frame::PageFrameCount, kernel_mapper::KernelMapper, page::EntryFlags, mmio_buddy::mmio_pool
MemoryManagementArch,
},
time::timer::{Timer, TimerFunction},
};
use alloc::{boxed::Box, sync::Arc};
Expand Down Expand Up @@ -99,8 +102,15 @@ impl VideoRefreshManager {
}
// 地址映射
let paddr = bp.screen_info.lfb_base;
let count = PageFrameCount::new(
page_align_up(frame_buffer_info_guard.buf_size()) / MMArch::PAGE_SIZE,
);
let page_flags: EntryFlags<MMArch> = EntryFlags::new().set_execute(true).set_write(true);

let mut kernel_mapper = KernelMapper::lock();
let mut kernel_mapper = kernel_mapper.as_mut();
assert!(kernel_mapper.is_some());
let mut vaddr = buf_vaddr;
unsafe {
mmio_guard
.map_phys_with_flags(paddr, page_align_up(buf_size), page_flags)
Expand Down
1 change: 1 addition & 0 deletions kernel/src/filesystem/vfs/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use alloc::{
use kdepends::xarray::XArray;
use log::error;
use system_error::SystemError;
use xarray::XArray;

use super::{Dirent, FileType, IndexNode, InodeId, Metadata, SpecialNodeData};
use crate::filesystem::eventfd::EventFdInode;
Expand Down
Loading
Loading