forked from chenzhiy2001/code-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrCore-mod.diff
More file actions
182 lines (167 loc) · 5.14 KB
/
rCore-mod.diff
File metadata and controls
182 lines (167 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
diff --git a/easy-fs-fuse/src/main.rs b/easy-fs-fuse/src/main.rs
index 17b24654..f3d32f76 100644
--- a/easy-fs-fuse/src/main.rs
+++ b/easy-fs-fuse/src/main.rs
@@ -59,11 +59,11 @@ fn easy_fs_pack() -> std::io::Result<()> {
.write(true)
.create(true)
.open(format!("{}{}", target_path, "fs.img"))?;
- f.set_len(16 * 2048 * 512).unwrap();
+ f.set_len(64 * 2048 * 512).unwrap();
f
})));
// 16MiB, at most 4095 files
- let efs = EasyFileSystem::create(block_file, 16 * 2048, 1);
+ let efs = EasyFileSystem::create(block_file, 64 * 2048, 1);
let root_inode = Arc::new(EasyFileSystem::root_inode(&efs));
let apps: Vec<_> = read_dir(src_path)
.unwrap()
diff --git a/os/Cargo.toml b/os/Cargo.toml
index 4ebae8a4..bf3fec98 100644
--- a/os/Cargo.toml
+++ b/os/Cargo.toml
@@ -28,3 +28,8 @@ board_k210 = []
[profile.release]
debug = true
+opt-level=0
+# debuginfo-level = 1
+
+# Debuginfo level for the compiler.
+# debuginfo-level-rustc = 2
\ No newline at end of file
diff --git a/os/src/config.rs b/os/src/config.rs
index 8f8b709a..656556c5 100644
--- a/os/src/config.rs
+++ b/os/src/config.rs
@@ -1,9 +1,9 @@
#[allow(unused)]
pub const USER_STACK_SIZE: usize = 4096 * 2;
-pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
+pub const KERNEL_STACK_SIZE: usize = 4096 * 20;
pub const KERNEL_HEAP_SIZE: usize = 0x100_0000;
-pub const MEMORY_END: usize = 0x88000000;
+pub const MEMORY_END: usize = 0x88000000;//czy may need change
pub const PAGE_SIZE: usize = 0x1000;
pub const PAGE_SIZE_BITS: usize = 0xc;
diff --git a/os/src/task/manager.rs b/os/src/task/manager.rs
index 168ba32e..e1ce8e9f 100644
--- a/os/src/task/manager.rs
+++ b/os/src/task/manager.rs
@@ -1,18 +1,25 @@
+use core::borrow::Borrow;
+
use super::{ProcessControlBlock, TaskControlBlock};
use crate::sync::UPIntrFreeCell;
use alloc::collections::{BTreeMap, VecDeque};
use alloc::sync::Arc;
use lazy_static::*;
-
+#[repr(C)]
pub struct TaskManager {
- ready_queue: VecDeque<Arc<TaskControlBlock>>,
+ pub upper_border:usize,
+ pub ready_queue: VecDeque<Arc<TaskControlBlock>>,
+ pub lower_border:usize,
}
/// A simple FIFO scheduler.
impl TaskManager {
pub fn new() -> Self {
Self {
+ upper_border:0xAAAAAAAA,
ready_queue: VecDeque::new(),
+ lower_border:0xBBBBBBBB
+
}
}
pub fn add(&mut self, task: Arc<TaskControlBlock>) {
@@ -21,17 +28,27 @@ impl TaskManager {
pub fn fetch(&mut self) -> Option<Arc<TaskControlBlock>> {
self.ready_queue.pop_front()
}
+ pub fn get_ready_queue_pointer(&mut self) -> &VecDeque<Arc<TaskControlBlock>> {
+ &self.ready_queue
+ }
}
+
lazy_static! {
pub static ref TASK_MANAGER: UPIntrFreeCell<TaskManager> =
unsafe { UPIntrFreeCell::new(TaskManager::new()) };
+
pub static ref PID2PCB: UPIntrFreeCell<BTreeMap<usize, Arc<ProcessControlBlock>>> =
unsafe { UPIntrFreeCell::new(BTreeMap::new()) };
}
+static mut TM_RQ:usize=0;
pub fn add_task(task: Arc<TaskControlBlock>) {
TASK_MANAGER.exclusive_access().add(task);
+ //println!("TASK_MANAGER in {:p}\n",&TASK_MANAGER);
+ unsafe{
+ TM_RQ=&TASK_MANAGER.exclusive_access().ready_queue as *const _ as usize;
+ }
}
pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
diff --git a/user/.cargo/config b/user/.cargo/config
index e5ded8a1..867bffc8 100644
--- a/user/.cargo/config
+++ b/user/.cargo/config
@@ -3,5 +3,5 @@ target = "riscv64gc-unknown-none-elf"
[target.riscv64gc-unknown-none-elf]
rustflags = [
- "-Clink-args=-Tsrc/linker.ld",
+ "-Clink-args=-Tsrc/linker.ld","-Zunstable-options",
]
diff --git a/user/Cargo.toml b/user/Cargo.toml
index 542a624a..705844a1 100644
--- a/user/Cargo.toml
+++ b/user/Cargo.toml
@@ -13,3 +13,9 @@ riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
[profile.release]
debug = true
+# opt-level=0
+# split-debuginfo="unpacked"
+debuginfo-level = 1
+
+# Debuginfo level for the compiler.
+debuginfo-level-rustc = 2
\ No newline at end of file
diff --git a/user/src/bin/initproc.rs b/user/src/bin/initproc.rs
index d25aee14..827f62bc 100644
--- a/user/src/bin/initproc.rs
+++ b/user/src/bin/initproc.rs
@@ -3,10 +3,19 @@
extern crate user_lib;
+use user_lib::{println, getpid};
+
use user_lib::{exec, fork, wait, yield_};
#[no_mangle]
fn main() -> i32 {
+
+ println!("aaaaaaaaaaaaaa");
+ let a = getpid();
+ println!("{}",a);
+
+
+
if fork() == 0 {
exec("user_shell\0", &[core::ptr::null::<u8>()]);
} else {
diff --git a/user/src/lib.rs b/user/src/lib.rs
index 6f57edd4..e2f15790 100644
--- a/user/src/lib.rs
+++ b/user/src/lib.rs
@@ -17,7 +17,7 @@ use alloc::vec::Vec;
use buddy_system_allocator::LockedHeap;
use syscall::*;
-const USER_HEAP_SIZE: usize = 32768;
+const USER_HEAP_SIZE: usize = 32768*4;
static mut HEAP_SPACE: [u8; USER_HEAP_SIZE] = [0; USER_HEAP_SIZE];
diff --git a/user/src/linker.ld b/user/src/linker.ld
index 02f7b6bf..1df4e67e 100644
--- a/user/src/linker.ld
+++ b/user/src/linker.ld
@@ -27,6 +27,5 @@ SECTIONS
}
/DISCARD/ : {
*(.eh_frame)
- *(.debug*)
}
}