青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

milkyway的窩

最初想法的誕生地

 

VirtualAlloc/Copy and MmMapIospace

Tuesday, March 20, 2007 12:35 PM by Kurt Kennett

VirtualCopy can be a bit confusing to use.

http://msdn2.microsoft.com/en-us/library/aa908789.aspx

Let's look at the parameters.  I've commented with -- after each of them.

lpvDest

[in] Pointer to the destination memory, which must be reserved.

-- This means that the destination range of VIRTUAL memory must already be reserved by a call to VirtualAlloc().  You must have allocated a range of virtual memory that you are going to map to some physical range.

lpvSrc

[in] Pointer to committed memory.

-- This is the range of *either* VIRTUAL *or* PHYSICAL memory that you want to map the range specified by the 'lpvDest' parameter to.  

If you specify a VIRTUAL address and omit the PAGE_PHYSICAL flag from the fdwProtect parameter, then you are simply saying "Copy the mapping at the lpvSrc address to the lpvDest address".  This just means that there will be two ranges of virtual memory that point to the same physical range.

If you specify a PHYSICAL address (shifted right 8 bits) and include the PAGE_PHYSICAL flag in the fdwProtect parameter, then you are saying "Map the range at the lpvDest address to this specific physical address".  This sets your new range of virtual memory to point to a piece of physical memory.

cbSize

[in] Size, in bytes, of the region. The allocated pages include all pages containing one or more bytes in the range from lpAddress to lpAddress+cbSize. This means that a 2-byte range straddling a page boundary causes both pages to be included in the allocated region.

-- pretty straight forward here.

fdwProtect

[in] Type of access protection. If the pages are being committed, any one of a number of flags can be specified, along with the PAGE_GUARD and PAGE_NOCACHE, protection modifier flags. The following table shows the flags that can be specified.

-- 'Reserving' a page means you're allocating a range of virtual memory but not pointing it at anything yet.  'Commiting' a page means you are actually taking up physical storage somewhere - be it in RAM or in physical addres space.  For the purposes of our discussion here, you would normally map registers and i/o space with PAGE_NOCACHE.  If you used a physical address (shifted right 8 bits) in the lpvSrc parameter, then you would also specify the PAGE_PHYSICAL flag.


quetion:

If I want to access some physical memory in my driver,  can I do like these way?

Method (1) define static map relationship in OEMAddressTable and reserve difined virtual address in config.bib first, then use VirtualAlloc() and VirtualCopy() without the page_physical parameter.

or (2)  directly use MmMapIoSpace() or VirtualAlloc+Copy() with the page_physical parameter

answer:
Yes, either of those would work I believe.  #2 is the preferred/recommended method


Monday, March 26, 2007 12:07 PM by Kurt Kennett

Wow!  Lots of interest in VirtualCopy!  Ok, I'll try to be super-clear here.

VirtualCopy *copies* or *sets* a range of virtual addresses.  

   - You use it to *copy* an existing Virtual->Physical mapping (no matter where it is).  

OR

   - You use it to *set* a mapping to a range of physical addresses.

In *either* case, the virtual memory you want to create the new map in must already be allocated (via VirtualAlloc()).

OEMAddressTable is a static (unchanging, available at startup without doing any work or setup) table of virtual -> physical mappings.  The kernel is the only thing that has default access to the resources mapped by this table.  If you are operating outside the OAL (i.e. in any kind of driver or application), you must use VirtualCopy() to copy or create memory page mappings.  As mentioned above, you can copy any existing mapping as long as you have access to it.  This includes a static mapping done by the OEMAddressTable.  Some people will map all resources in the OEMAddressTable (so the kernel has access to everything), then just copy those mappings in drivers when they need to.  This is not a best practice because it makes driver code less portable -- it is better to read the physical address of a component from the registry, then use the value found there to map to it. If you do this your driver code does not have to change if it is moved to a different platform or extended to use multiple components in different physical locations.

A mapping does not have to exist in OEMAddressTable in order for you to access the physical resources mapped.  You can create a new mapping unknown to the OEMAddressTable by using VirtualCopy with the PAGE_PHYSICAL flag.

MmMapIoSpace is a CEDDK function -- it simply does the appropriate calls to VirtualAlloc/VirtualCopy.  You could write your own MmMapIoSpace if you wanted to.  Some people have in the past - calling the function "VirtualMemCopyPhysical" or something like that.  Some platforms need to modify the MmMapIoSpace to set Virtual mapping attributes when pages are mapped (hence the original purpose for this blog entry).

Using flags like PAGE_EXECUTE_READWRITE with VirtualCopy are a 'request'.  If the platform/CPU does not have a differentiation between executable pages and non-executable pages, the EXECUTE property will not be able to be set.  For example, the X86 CPUs can explicitly state that memory is executable, but can't be read or written to.  The ARM processors have no notion of this - you can read it or read and write it.



In Windows CE 5.0 and earlier, virtual allocations below 2MB come out of the address space of the process calling it, while allocations above 2MB come out of the shared address space.

Sue


posted on 2007-04-17 13:38 milkyway 閱讀(2917) 評論(0)  編輯 收藏 引用 所屬分類: wince(別人的文章技巧總結)

導航

統計

公告

隨筆皆原創,文章乃轉載. 歡迎留言!

常用鏈接

留言簿(37)

隨筆分類(104)

隨筆檔案(101)

文章分類(51)

文章檔案(53)

wince牛人

搜索

積分與排名

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产精品自拍三区| 美玉足脚交一区二区三区图片| 亚洲国产mv| 亚洲摸下面视频| 国产精品久久久久久模特| 日韩天堂av| 亚洲欧洲在线播放| 欧美日韩中文字幕| 久久99在线观看| 久久精品视频免费播放| 亚洲精品久久久久久下一站| 亚洲精品视频在线看| 欧美视频在线播放| 久久精品官网| 欧美福利视频在线| 亚洲免费视频网站| 欧美一级专区免费大片| 亚洲人成人99网站| 亚洲视频中文字幕| 亚洲二区在线| 一区二区三区四区国产| 精品动漫av| 亚洲激情一区二区| 国产亚洲精品aa午夜观看| 欧美大片一区二区| 国产精品免费网站| 亚洲电影自拍| 国产日韩一区二区| 亚洲精品一区二区三区四区高清 | 欧美aⅴ一区二区三区视频| 欧美精品在线一区二区三区| 欧美怡红院视频| 欧美成人免费网| 久久久久久久波多野高潮日日| 欧美高清自拍一区| 久久一区二区视频| 国产精品老牛| 亚洲第一视频网站| 国内精品久久久久影院色| 一本综合久久| 亚洲精品在线视频观看| 日韩一级在线观看| 欧美一区二区在线看| 亚洲乱亚洲高清| 久久精品日韩一区二区三区| 亚洲欧美日韩国产精品| 欧美大片一区二区三区| 久久中文久久字幕| 国产日韩欧美不卡| 亚洲一区二区免费| 亚洲在线免费观看| 欧美精品福利在线| 亚洲国产婷婷香蕉久久久久久| 国内精品久久久久影院 日本资源| 在线一区二区三区做爰视频网站| 日韩网站在线观看| 欧美福利视频网站| 亚洲福利一区| 亚洲人体1000| 免费影视亚洲| 亚洲国产精品va在线看黑人| 一区二区三区国产盗摄| 亚洲福利在线视频| 欧美一级黄色录像| 欧美一区二区三区在线视频| 欧美性一二三区| 99re国产精品| 亚洲免费一在线| 国产精品久久久久毛片软件| 一区二区日韩| 亚洲男同1069视频| 国产精品黄色在线观看| 亚洲在线黄色| 久久精品国产精品亚洲综合| 国产一区二区福利| 久久人人爽国产| 亚洲第一毛片| 日韩一二三在线视频播| 欧美日韩综合一区| 亚洲欧美日韩国产成人精品影院 | 国内精品国产成人| 久久精品日产第一区二区三区| 久久一区中文字幕| 亚洲国产乱码最新视频 | 一区二区久久| 欧美一级欧美一级在线播放| 韩日视频一区| 欧美v亚洲v综合ⅴ国产v| 亚洲日本中文| 欧美一区二区三区播放老司机| 狠狠综合久久av一区二区小说 | 久久久亚洲精品一区二区三区 | 午夜电影亚洲| 欧美国产精品劲爆| 亚洲综合日本| 永久免费精品影视网站| 欧美日本在线一区| 欧美亚洲一级| 亚洲精品一二三| 久久久久国产精品人| 亚洲精品偷拍| 国产香蕉97碰碰久久人人| 欧美成人免费在线观看| 亚洲伊人网站| 亚洲国产精品一区二区www| 欧美一级淫片aaaaaaa视频| 亚洲精美视频| 国产在线成人| 国产精品成人一区二区三区夜夜夜| 久久国产精品99精品国产| 亚洲蜜桃精久久久久久久 | 亚洲人成欧美中文字幕| 国产亚洲永久域名| 欧美日韩精品免费观看| 久久亚洲国产精品日日av夜夜| 日韩一区二区精品| 欧美成人综合网站| 欧美在线三级| 亚洲一区二区三区久久| 亚洲精品影视在线观看| 黄色另类av| 国产欧美亚洲视频| 国产精品久久久久久久浪潮网站| 免费观看30秒视频久久| 久久都是精品| 欧美一区二区高清在线观看| 亚洲视频图片小说| 亚洲精品在线免费| 最近看过的日韩成人| 免费在线欧美黄色| 狼人社综合社区| 久久男人av资源网站| 欧美影院久久久| 午夜精品视频网站| 午夜日韩福利| 亚洲欧美日本另类| 亚洲一区二区影院| 亚洲综合精品自拍| 亚洲影院在线| 亚洲欧美一区二区视频| 亚洲图片欧洲图片日韩av| av成人黄色| 制服诱惑一区二区| 亚洲一区二区视频| 亚洲欧美成人网| 午夜综合激情| 久久激情久久| 久久综合电影| 欧美福利视频在线| 亚洲黄色小视频| 亚洲精品欧美日韩| 中国亚洲黄色| 午夜精品在线观看| 久久久久国色av免费观看性色| 久久免费精品视频| 欧美成人中文字幕在线| 欧美日韩无遮挡| 国产精品三上| 在线成人www免费观看视频| 亚洲高清一区二| 妖精成人www高清在线观看| 亚洲一区免费在线观看| 国产午夜一区二区三区| 久久精品国产一区二区电影| 午夜精品久久久久久久男人的天堂 | 欧美顶级大胆免费视频| 欧美日韩精品免费观看视一区二区 | 国产精品igao视频网网址不卡日韩| 欧美香蕉大胸在线视频观看| 国产精品免费一区二区三区在线观看| 国产美女精品人人做人人爽| 亚洲综合欧美日韩| 久久成人免费网| 欧美高清hd18日本| 一区二区三区成人| 久久精品国产亚洲高清剧情介绍| 久久婷婷国产综合国色天香| 欧美黄在线观看| 国产日韩欧美不卡在线| 91久久久在线| 亚洲欧美在线免费| 欧美69视频| 亚洲午夜精品久久| 免费不卡在线观看| 国产免费观看久久黄| 亚洲精品欧美日韩专区| 欧美制服丝袜第一页| 亚洲狠狠婷婷| 久久成人精品| 欧美视频一区二区三区四区| 又紧又大又爽精品一区二区| 亚洲视频网在线直播| 女女同性精品视频| 亚洲欧美在线aaa| 欧美日本国产精品| 亚洲二区精品| 久久久久久久久久看片| 一区二区欧美视频| 欧美日本在线播放| 亚洲精品日产精品乱码不卡|