Date: Mon, 24 Dec 2018 15:44:33 +0800 From: =?UTF-8?B?5a6L6L6w5Lyf?= <scwsy00@gmail.com> To: freebsd-hackers@freebsd.org Subject: Fwd: How to access physical memory Message-ID: <CABsV5RwhEa2QBfTYmSLePvAVJK=PzvBduRuTjPkJdMVa=6RnfQ@mail.gmail.com> In-Reply-To: <CABsV5RzE8JiOOBA408XXenuLFBwgLAtB5PDMQT7o_8mEkAxU=A@mail.gmail.com> References: <CABsV5RwodOK18HRE%2BDj7BNNQWw9O45ynixabij2Dg_CWDO9YFA@mail.gmail.com> <CABsV5RzE8JiOOBA408XXenuLFBwgLAtB5PDMQT7o_8mEkAxU=A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Forwarded Conversation Subject: How to access physical memory ------------------------ From: =E5=AE=8B=E8=BE=B0=E4=BC=9F <scwsy00@gmail.com> Date: 2018=E5=B9=B412=E6=9C=8824=E6=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8A=E5=8D= =8811:23 To: <freebsd-questions@freebsd.org> Hi I'm the new here . And I have some questions with pmap. [image: 1545542790461.png] See `*pml4` is the physical address of a page with some flag. And then updated the address to the Direct Map Space. Then We calculate the offset of the real pdp we need . How could it access to `*pdp`? it is a virtual addr in Direct Map Space. Why don't change the physical space directly since we have the physical page already. ---------- From: =E5=AE=8B=E8=BE=B0=E4=BC=9F <scwsy00@gmail.com> Date: 2018=E5=B9=B412=E6=9C=8824=E6=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8A=E5=8D= =8811:28 To: <freebsd-questions@freebsd.org> ``` pdp =3D (pdp_entry_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); /* Now find the pdp page */ pdp =3D &pdp[pdpindex & ((1ul << NPDPEPGSHIFT) - 1)]; *pdp =3D VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M; ``` There is the code in _pmap_allocpte. =E5=AE=8B=E8=BE=B0=E4=BC=9F <scwsy00@gmail.com> =E4=BA=8E2018=E5=B9=B412=E6= =9C=8824=E6=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8A=E5=8D=8811:23=E5=86=99=E9=81= =93=EF=BC=9A
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABsV5RwhEa2QBfTYmSLePvAVJK=PzvBduRuTjPkJdMVa=6RnfQ>