[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Fwd: How to access physical memory
From:       宋辰伟 <scwsy00 () gmail ! com>
Date:       2018-12-24 7:44:33
Message-ID: CABsV5RwhEa2QBfTYmSLePvAVJK=PzvBduRuTjPkJdMVa=6RnfQ () mail ! gmail ! com
[Download RAW message or body]

Forwarded Conversation
Subject: How to access physical memory
------------------------

From: 宋辰伟 <scwsy00@gmail.com>
Date: 2018年12月24日周一 上午11: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: 宋辰伟 <scwsy00@gmail.com>
Date: 2018年12月24日周一 上午11:28
To: <freebsd-questions@freebsd.org>


```
pdp = (pdp_entry_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME);

/* Now find the pdp page */
pdp = &pdp[pdpindex & ((1ul << NPDPEPGSHIFT) - 1)];
*pdp = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M;
```

There is the code in _pmap_allocpte.

宋辰伟 <scwsy00@gmail.com> 于2018年12月24日周一 上午11:23写道:
_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic