Git Product home page Git Product logo

ucore-tutorial-guide-2023s's Introduction

uCore-Tutorial-Guide-2023S

Documentation of uCore-Tutorial-Guide-2023S

Deployed version can be found here.

ucore-tutorial-guide-2023s's People

Contributors

atomecho-git-bot avatar chyyuu avatar csaucl4 avatar deathwish5 avatar dramforever avatar duskmoon314 avatar exusial avatar gallium70 avatar gp-bullet avatar hw0505 avatar jude-lu avatar kaitod avatar rcy17 avatar scpointer avatar timothy-liuxf avatar xushanpu123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ucore-tutorial-guide-2023s's Issues

ch5:在usershell运行ch5_mergetest出现错误

问题

ucore ch5练习中,在usershell运行ch5_mergetest,会产生如下错误:
image

ch5_mergetest代码如下:

image

可以看到ch5_mergetest并未得到待测试程序的名称,因而打印出的目标测试程序名称均为null。

通过测试发现数组TESTS和FAILES中的数据均为0,因此ch5_mergetest获得的程序名均为空指针,导致错误。

复现

修改Makefile,将ch5_mergetest添加到ch5的测试程序集(ch5原始Makefile好像并未包括该程序),并在usershell中执行ch5_mergetest;
或者在任一用户程序中创建全局变量char * str = "waku";,并在main函数中尝试打印。

原因推测

链接器在链接ucore用户态程序时,会把TESTS和FAILS放到名为.data.rel.local的section中,初始化为0,且该段在链接器链接过程中中符号没有重定位。导致最终TESTS、FAILS等数组内容为空。(猜测可能是由于TESTS、FAILS等全局变量引用了常量字符串,被编译器优化为在 运行时 进行重定位,而ucore不提供运行时重定位功能,导致问题发生。
image

解决办法

在用户程序的链接选项中添加-static参数,可以避免这一问题。

image

其他

通过测试发现:

  • 如果是全局变量包含常量字符串地址,该全局变量一定会出现该问题;
  • 如果是局部数组型变量包含常量字符串的地址,当数组长度到一定程度时,也会出现该问题。。

推测可能是由于编译器的某种优化策略导致。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.