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

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 閱讀(2932) 評論(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>
            亚洲国产天堂久久综合网| 开心色5月久久精品| 欧美激情小视频| 久久久最新网址| 国产午夜精品福利| 久久久激情视频| 久久精品亚洲国产奇米99| 激情小说另类小说亚洲欧美| 乱码第一页成人| 另类成人小视频在线| 亚洲欧洲在线观看| 亚洲免费观看高清完整版在线观看| 欧美大片免费观看| 在线视频你懂得一区二区三区| 在线综合亚洲| 国产欧美日韩视频| 欧美凹凸一区二区三区视频| 欧美成人精品| 亚洲女同精品视频| 欧美一区二区三区免费观看| 亚洲欧洲在线视频| 亚洲图片欧美日产| 亚洲国产精彩中文乱码av在线播放| 亚洲国产精品久久精品怡红院 | 亚洲一区二区成人| 亚洲欧美日韩精品久久久久| 黄色精品免费| 日韩视频在线永久播放| 国产伦精品一区二区三区视频黑人| 久久久久这里只有精品| 欧美精品一区二区在线观看| 久久精品九九| 欧美精品一区二区三区在线播放| 亚洲欧美日韩天堂一区二区| 免费亚洲一区| 欧美一区二区三区精品电影| 蜜臀久久99精品久久久画质超高清| 亚洲永久精品国产| 欧美chengren| 久久久久久精| 国产精品福利影院| 亚洲国产精品美女| 国产一区99| 一区二区三区 在线观看视| 在线观看一区| 校园春色综合网| 亚洲少妇最新在线视频| 免费成人毛片| 久久一区二区三区av| 国产精品乱码妇女bbbb| 亚洲精品国产精品国自产在线| 国产在线拍揄自揄视频不卡99| 亚洲美女黄网| 亚洲人成网站在线播| 久久九九久久九九| 欧美一区不卡| 国产欧美精品| 亚洲一区二区三区乱码aⅴ蜜桃女| 99re6这里只有精品| 老色鬼精品视频在线观看播放| 欧美中文在线视频| 国产精品视频yy9299一区| 一级日韩一区在线观看| 亚洲一级片在线观看| 欧美午夜电影一区| 99亚洲一区二区| 一区二区三区高清在线| 欧美精品激情在线观看| 亚洲国产91精品在线观看| 亚洲国产精品久久久久| 久久夜色撩人精品| 亚洲第一福利视频| 日韩一二三区视频| 欧美日韩国产成人在线| 洋洋av久久久久久久一区| 一区二区三区四区五区精品| 欧美精品91| 亚洲一区二区三区免费视频| 性欧美xxxx视频在线观看| 国产噜噜噜噜噜久久久久久久久 | 久久久国产精品一区二区中文| 国产精品网站在线播放| 久久成人免费网| 久久综合五月| 亚洲精品国产精品乱码不99| 欧美激情a∨在线视频播放| 日韩午夜av在线| 亚洲欧美日韩精品久久奇米色影视 | 亚洲国产第一| 国产精品99久久99久久久二8| 国产精品日本| 久久久www成人免费精品| 欧美刺激性大交免费视频| 日韩一级大片| 国产欧美日韩在线视频| 久久这里只有精品视频首页| 亚洲全部视频| 欧美在线|欧美| 亚洲精品久久久久久久久久久久 | 乱中年女人伦av一区二区| 亚洲娇小video精品| 欧美一区二区三区四区在线观看| 精品不卡一区| 欧美色区777第一页| 欧美一区三区二区在线观看| 亚洲激情成人| 久久天天躁狠狠躁夜夜爽蜜月| 亚洲欧洲另类| 国产一区二区日韩精品欧美精品| 久热精品在线视频| 亚洲午夜精品久久久久久app| 蜜臀av性久久久久蜜臀aⅴ| 在线午夜精品| 亚洲国产合集| 国产情人节一区| 欧美日产一区二区三区在线观看 | 亚洲永久免费av| 亚洲电影第1页| 久久久av毛片精品| 亚洲午夜精品在线| 亚洲精品国产精品国产自| 国产精品一区二区久久| 欧美精品大片| 久久综合色8888| 香蕉久久久久久久av网站| 亚洲精品一级| 亚洲丶国产丶欧美一区二区三区 | 亚洲午夜91| 91久久夜色精品国产九色| 国产亚洲在线| 国产毛片一区| 欧美新色视频| 欧美日本亚洲| 欧美激情综合五月色丁香| 久久免费高清| 久久激情五月激情| 欧美一区二区精品久久911| 在线一区二区三区做爰视频网站| 亚洲精品国产精品乱码不99按摩| 欧美大秀在线观看| 欧美大片一区二区| 蜜桃av久久久亚洲精品| 久久亚洲精品一区| 久久久久久九九九九| 久久久久久伊人| 久久久久国产一区二区| 欧美中文在线观看| 久久久无码精品亚洲日韩按摩| 久久激情综合网| 久久精品国语| 美女黄毛**国产精品啪啪 | 亚洲日本一区二区三区| 亚洲高清视频的网址| 一区精品在线播放| 亚洲福利视频专区| 最新中文字幕一区二区三区| 亚洲精品一区二区三区四区高清| 亚洲精品乱码久久久久久久久| 日韩视频不卡中文| 在线亚洲高清视频| 欧美自拍偷拍| 六月天综合网| 亚洲精品国产精品国产自| 99riav久久精品riav| 亚洲欧美日韩精品久久亚洲区 | 一本大道久久a久久综合婷婷| 亚洲免费观看| 欧美一区二区三区喷汁尤物| 久久久久久久999| 欧美精品色网| 国产精品视频网站| 精品成人乱色一区二区| 亚洲精品资源美女情侣酒店| 中文网丁香综合网| 久久精品国产91精品亚洲| 欧美 亚欧 日韩视频在线| 亚洲精品亚洲人成人网| 午夜精品影院在线观看| 欧美电影在线观看完整版| 国产精品v欧美精品v日韩精品| 国产日韩精品入口| 亚洲国产老妈| 亚洲免费中文| 欧美刺激性大交免费视频| 宅男在线国产精品| 久久久综合网| 国产精品欧美一区喷水| 亚洲高清视频一区| 欧美伊人久久大香线蕉综合69| 欧美成年网站| 亚洲一区二区三区中文字幕| 久热精品视频| 国产一区二区精品久久99| 中国日韩欧美久久久久久久久| 久久这里有精品视频| 亚洲天堂第二页| 欧美韩国一区| 一区二区三区自拍| 亚洲自拍电影| 亚洲国内自拍|