File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -124,3 +124,17 @@ b) 申请内存: 移动next位置指针, allocations加一,返回移动前
124
124
c) 释放内存: allocations减一。如果归零,复位next到起始位置。
125
125
d) 需要检查,分配和释放是否越界。
126
126
```
127
+
128
+ ## arceos 标准库集成
129
+
130
+ ### 侵入式实现
131
+ arceos 目前稳定版的实现是这样的,所有用到的第三方库用到标准库的都要加以下这行
132
+
133
+ > use axstd as std
134
+
135
+ ### add arceos to target
136
+ 在 arceos 的激进仓库 <github.com/arceos-os/arceos>
137
+
138
+ next/nightly/激进版的代码在 ` github.com/arceos-os `
139
+
140
+ (据说这个组织最近在等 github 验证,所以组织变成 private 不可见了)
Original file line number Diff line number Diff line change
1
+ # [ per_cpu] ( /2023/09/per_cpu.md )
2
+
3
+ Rust for Linux 最大的遗憾是 C 的 per_cpu 相关宏无法使用,因为需要修改 linker
4
+
5
+ Linux 看门狗喂狗 ping 回调函数中用到了 ` DEFINE_PER_CPU(bool, initialized) = false ` 和 ` per_cpu(initialized,cpu_num) `
6
+ [ How per_cpu this_cpu_ptr() impl] ( https://stackoverflow.com/questions/16978959/how-are-percpu-pointers-implemented-in-the-linux-kernel )
7
+
8
+ ## per_cpu 的替代方案
9
+
10
+ OSTEP 第二种 per_cpu 的实现方法,如果已经知道处理器个数,创建 static 数组,数组索引就是 smp_processor_id() ` linux/smp.h `
11
+
12
+ 用户态获取当前在第几个处理器的办法:
13
+ - ` /proc/<pid>/task/<tid>/status `
14
+ - getcpu()
15
+
16
+ ## arceos per_cpu 实现
17
+
18
+ < https://github.com/rcore-os/arceos/blob/main/crates/percpu/test_percpu.x >
You can’t perform that action at this time.
0 commit comments