Giter Site home page Giter Site logo

请教一个问题,ch4中为什么需要修改user test啊?最近遇到的问题可能与这个有关。 about rcore-tutorial-v3 HOT 4 CLOSED

Sober7135 avatar Sober7135 commented on May 29, 2024
请教一个问题,ch4中为什么需要修改user test啊?最近遇到的问题可能与这个有关。

from rcore-tutorial-v3.

Comments (4)

wyfcyx avatar wyfcyx commented on May 29, 2024

数组放在main函数里面的话是开在栈上的,全局声明的话是在.bss或者.data段里面,唯一的区别只有这个。可以看看是不是爆栈(应该不会,整个数组只有800字节,距离一个4K页还有很远)了,或者sp寄存器维护出问题了?

另外,在最新版的tutorial上,将用例的数组修改为main函数内声明,也是能正常跑的。

from rcore-tutorial-v3.

Sober7135 avatar Sober7135 commented on May 29, 2024

感谢回复!感觉可能不是sp的问题,毕竟ch3跑的好好的。。。anyway我再debug一下!

BTW,还有几个问题顺便问一下

  • 这里page_table貌似不需要可变,translate方法只需要引用就行了
    pub fn copy_data(&mut self, page_table: &mut PageTable, data: &[u8]) {
  • 这里改成VirtPageNum((self.0 + PAGE_SIZE - 1) / PAGE_SIZE) 是否就不需要if
    pub fn ceil(&self) -> VirtPageNum {
    if self.0 == 0 {
    VirtPageNum(0)
    } else {
    VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
    }
    }

from rcore-tutorial-v3.

wyfcyx avatar wyfcyx commented on May 29, 2024

1.copy_data确实只需要&PageTable就行了,后面改
2.当self.0usize::MAX的时候,self.0+PAGE_SIZE就溢出了,所以至少这样写还有问题

from rcore-tutorial-v3.

Sober7135 avatar Sober7135 commented on May 29, 2024

感谢!

from rcore-tutorial-v3.

Related Issues (20)

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.