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

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 閱讀(2931) 評論(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>
            国产精品激情电影| 国产伦精品一区二区三区照片91 | 亚洲激情中文1区| 久久精品国产久精国产思思| 国产欧美在线观看| 久久久噜噜噜久久中文字免| 久久国产精品久久国产精品 | 国产精品毛片| 久久久免费av| 欧美精品三区| 欧美一区二区三区四区夜夜大片| 亚洲欧美日韩在线播放| 一区免费视频| 最近中文字幕mv在线一区二区三区四区 | 麻豆精品一区二区综合av| 久久日韩精品| 一区二区免费在线播放| 亚洲图片欧美日产| 在线观看视频一区二区欧美日韩| 亚洲国产一区二区精品专区| 欧美香蕉大胸在线视频观看| 久久亚洲精品欧美| 欧美日韩国产综合视频在线| 欧美一区二区三区四区在线| 浪潮色综合久久天堂| 一区二区三区产品免费精品久久75 | 午夜精品在线看| 亚洲国产一区二区视频| 一区二区日本视频| 一区二区在线观看av| 99爱精品视频| 一区二区在线观看视频在线观看 | 久久国产精品黑丝| 免费亚洲电影| 久久久精品一区二区三区| 欧美黑人多人双交| 久久精品人人做人人爽| 欧美女主播在线| 久久国产一区| 欧美日韩一区在线视频| 欧美二区在线| 好看不卡的中文字幕| 在线综合+亚洲+欧美中文字幕| 亚洲国产精品成人久久综合一区| 亚洲一区二区三区四区视频| 亚洲精品色图| 久久综合色8888| 久久久久天天天天| 国产欧美一区二区三区久久 | 亚洲国产成人av| 国产日韩亚洲欧美精品| 日韩一区二区久久| 亚洲国产日韩在线| 久久免费偷拍视频| 久久精品视频在线| 国产亚洲精品7777| 亚洲欧美日韩另类| 午夜亚洲视频| 欧美午夜理伦三级在线观看| 亚洲欧洲一区| 99精品欧美一区二区三区 | 99伊人成综合| 亚洲精品一区在线观看| 老牛影视一区二区三区| 欧美aaa级| 亚洲国产高清一区| 免费高清在线视频一区·| 欧美.www| 亚洲精品视频啊美女在线直播| 免费成年人欧美视频| 亚洲二区在线观看| 99riav1国产精品视频| 欧美激情网站在线观看| 日韩视频在线观看免费| 亚洲午夜羞羞片| 国产精品热久久久久夜色精品三区| 99热免费精品| 欧美永久精品| 一区二区三区中文在线观看| 久久婷婷人人澡人人喊人人爽| 欧美国产欧美亚洲国产日韩mv天天看完整 | 国产日韩在线一区| 欧美在线首页| 欧美刺激性大交免费视频| 亚洲欧洲日本在线| 国产精品v欧美精品v日韩精品| 亚洲少妇中出一区| 久久久99国产精品免费| 亚洲第一在线综合网站| 欧美日本不卡视频| 亚洲午夜精品久久| 裸体歌舞表演一区二区 | 欧美天天影院| 欧美亚洲视频在线看网址| 美日韩免费视频| 一区二区三区视频在线看| 国产精品入口| 久久中文欧美| 亚洲视频一起| 欧美华人在线视频| 亚洲一区中文| 亚洲福利在线视频| 国产精品女主播在线观看| 久久久久久综合| 在线亚洲激情| 欧美高清在线一区二区| 亚洲欧美日韩区| 亚洲国产一区二区三区在线播| 欧美亚洲第一页| 媚黑女一区二区| 午夜国产欧美理论在线播放| 亚洲国产欧美久久| 久久久久久亚洲精品不卡4k岛国| 日韩亚洲欧美成人一区| 国产综合久久久久影院| 欧美视频精品在线观看| 久久婷婷久久| 午夜精品视频在线观看一区二区| 亚洲国产精品一区| 久久久久国产精品一区二区| 中文在线一区| 亚洲国产天堂久久国产91| 国产日韩欧美在线| 欧美午夜精品久久久久久浪潮| 另类尿喷潮videofree| 欧美亚洲免费电影| 亚洲特色特黄| 亚洲精品国产系列| 欧美激情第六页| 久久一区二区视频| 久久精品免费电影| 香蕉成人久久| 亚洲欧美日韩国产成人| 一区二区三区久久精品| 亚洲毛片一区| 亚洲人成免费| 亚洲人成亚洲人成在线观看图片 | 在线欧美日韩国产| 国内精品美女av在线播放| 国产精品网站一区| 国产精品国产精品| 国产精品第2页| 欧美视频中文一区二区三区在线观看| 欧美成人精品在线观看| 噜噜噜91成人网| 嫩草伊人久久精品少妇av杨幂| 久久亚洲综合色一区二区三区| 欧美中文字幕不卡| 久久精品国产久精国产爱| 久久成年人视频| 久久久亚洲欧洲日产国码αv| 久久精品99| 麻豆国产精品一区二区三区 | 亚洲欧美日韩综合国产aⅴ| 亚洲一区二区三区影院| 午夜在线精品| 久久久久成人网| 欧美aa在线视频| 欧美日韩国产色视频| 欧美先锋影音| 国产亚洲aⅴaaaaaa毛片| 一色屋精品视频在线观看网站| 伊甸园精品99久久久久久| 亚洲人成网站在线观看播放| 一区二区日韩免费看| 性欧美video另类hd性玩具| 久久国产精品72免费观看| 美女视频黄 久久| 亚洲欧洲日本国产| 亚洲一区二区久久| 久久人人97超碰精品888| 欧美日韩国产精品专区| 国产欧美日韩一区二区三区在线 | 欧美日韩的一区二区| 国产麻豆综合| 亚洲人午夜精品| 香蕉成人伊视频在线观看| 久久影视三级福利片| 亚洲精品一区二区在线| 香蕉久久夜色精品| 欧美福利一区二区| 国产精品一区二区三区成人| 亚洲国产精品小视频| 亚洲欧美国产视频| 欧美激情第1页| 亚洲欧美在线视频观看| 欧美成人精品一区| 国产亚洲成av人在线观看导航| 亚洲国产老妈| 久久国产精品99精品国产| 91久久精品日日躁夜夜躁欧美 | 这里只有精品视频在线| 久久久久看片| 国产伦精品一区二区三区免费迷| 亚洲激情第一区| 欧美一区二区三区的| 亚洲激情欧美| 久久亚洲综合色一区二区三区| 国产精品国产a级| 亚洲欧洲综合|