Giter Site home page Giter Site logo

Comments (6)

polarvid avatar polarvid commented on May 29, 2024

首先这个函数,如果map映射成功的话,返回值是等于v_addr的,但是如果v_addr本身就为0,那么无论成功或是失败,其返回值都为(0)RT_NULL。

因为逻辑上 va 是不允许传 0 的,否则无法触发 NULL 异常。所以返回值为 0 无论任何情况下都视为错误。

from rt-thread.

liYony avatar liYony commented on May 29, 2024

首先这个函数,如果map映射成功的话,返回值是等于v_addr的,但是如果v_addr本身就为0,那么无论成功或是失败,其返回值都为(0)RT_NULL。

因为逻辑上 va 是不允许传 0 的,否则无法触发 NULL 异常。所以返回值为 0 无论任何情况下都视为错误。

那比如我这个开发板,DDR的起始地址就是0,那是不是得给它专门做一下2M的向上对齐呢?

from rt-thread.

polarvid avatar polarvid commented on May 29, 2024

以本次移植的zynqmp开发板来说,vaddr=0,size=0x7ff00000,这里size=2047M,不是2M对齐,所以创建映射的函数为_kernel_map_4K。该函数会涉及到rt_pages_alloc_ext去分配物理页面。

rt_page_init 不要注册超过 1 G 范围的地址。一般就是拆成多段。等内核第二次页表切换完成后,通过 rt_page_install 装入剩余部分。

from rt-thread.

liYony avatar liYony commented on May 29, 2024

以本次移植的zynqmp开发板来说,vaddr=0,size=0x7ff00000,这里size=2047M,不是2M对齐,所以创建映射的函数为_kernel_map_4K。该函数会涉及到rt_pages_alloc_ext去分配物理页面。

rt_page_init 不要注册超过 1 G 范围的地址。一般就是拆成多段。等内核第二次页表切换完成后,通过 rt_page_install 装入剩余部分。

那看样子要修改一下setup.c里面的一些逻辑了

from rt-thread.

polarvid avatar polarvid commented on May 29, 2024

这个 BSP 不使能用户态(RT_USING_SMART)的时候应该把 KERNEL_VADDR_START 定义为 0。否则无法正常完成 mapping。

from rt-thread.

liYony avatar liYony commented on May 29, 2024

这个 BSP 不使能用户态(RT_USING_SMART)的时候应该把 KERNEL_VADDR_START 定义为 0。否则无法正常完成 mapping。

image

在不开启用户态的时候,这个值来源于ARCH_TEXT_OFFSET,难道我必须强制这个值为0吗?

from rt-thread.

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.