Skip to content

Commit dd90d2a

Browse files
committed
book: Putting fence.i after loading apps in ch3(including coop)
1 parent 41665f6 commit dd90d2a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/chapter3/1multi-loader.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@
8282
let app_start = unsafe {
8383
core::slice::from_raw_parts(num_app_ptr.add(1), num_app + 1)
8484
};
85-
// clear i-cache first
86-
unsafe { asm!("fence.i" :::: "volatile"); }
8785
// load apps
8886
for i in 0..num_app {
8987
let base_i = get_base_i(i);
@@ -103,6 +101,9 @@
103101
};
104102
dst.copy_from_slice(src);
105103
}
104+
unsafe {
105+
asm!("fence.i");
106+
}
106107
}
107108
108109
可以看出,第 :math:`i` 个应用被加载到以物理地址 ``base_i`` 开头的一段物理内存上,而 ``base_i`` 的计算方式如下:

0 commit comments

Comments
 (0)