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

chp3之前用户态 println! 有问题 #59

Open
LimingFang opened this issue Mar 20, 2022 · 1 comment
Open

chp3之前用户态 println! 有问题 #59

LimingFang opened this issue Mar 20, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@LimingFang
Copy link

(我目前在写 chp3。
背景:“锯齿螈”内核(就是先一次性加载所有程序,然后顺序运行),ch3分支。
问题概述:假设每个程序是2MB,一共两个程序。那么它们在链接时会在0x8020_0000上面一点,但是运行前会分别被拷贝到[0x8040_0000,0x8060_0000)和[0x8060_0000,0x8080_0000)。然后修改第二个用户程序,只需要改成println!("{}",1),然后在fs.rs里打印缓冲区起始地址,会发现它并不在[0x8060_0000,0x8080_0000)之间,而是0x8020_0000上一点(即链接的位置)。
WX20220320-223258@2x
image
image

@wyfcyx wyfcyx added the bug Something isn't working label Mar 24, 2022
@SnowWarri0r
Copy link

SnowWarri0r commented Aug 1, 2022

我也碰到了这样的问题
image
甚至诡异的多出了一个syswrite,不知道是从哪里来的
image
syswrite 打log点与上面的相同
上面的这个应该是因为静态链接导致的,字符串被保存在了.rodata段进行调用,而并没有存储在程序内部地址,然后程序内部是有一个指向字符串的引用,将程序复制的时候只是复制了引用,从而调用的是系统内核部分的东西?但是下面的这个syswrite就完全搞不懂哪里来的了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants