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

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>
            欧美四级剧情无删版影片| 免费看精品久久片| 国产精品乱码| 欧美午夜视频| 国产免费成人| 国产在线观看91精品一区| 国产一区二区三区四区在线观看| 国产精品系列在线| 在线看欧美视频| av不卡免费看| 久久九九精品99国产精品| 久久夜色精品国产欧美乱| 欧美国产精品| 亚洲图片自拍偷拍| 久久爱91午夜羞羞| 欧美国产日产韩国视频| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ入口 | 久久久久国产精品厨房| 免费日韩av片| 亚洲视频第一页| 久久久久国产精品一区二区| 欧美高清视频在线播放| 国产精品丝袜白浆摸在线| 在线观看日产精品| 亚洲综合精品自拍| 欧美成人免费全部观看天天性色| 99视频精品在线| 毛片一区二区三区| 国产精品亚洲片夜色在线| 亚洲精品乱码视频| 久久久国产一区二区三区| 日韩一级裸体免费视频| 久久男女视频| 国产一区二区三区免费不卡| 一本到高清视频免费精品| 久久露脸国产精品| 中文欧美字幕免费| 免费日韩一区二区| 国产一区日韩一区| 午夜亚洲精品| 日韩一级不卡| 欧美精品福利视频| 亚洲欧洲精品成人久久奇米网| 先锋影音国产精品| 亚洲美女免费精品视频在线观看| 久久看片网站| 韩国一区二区三区美女美女秀| 亚洲欧美日韩另类精品一区二区三区| 欧美激情影院| 美女福利精品视频| 亚洲成人资源| 欧美日韩激情小视频| 另类国产ts人妖高潮视频| 国产三级欧美三级| 午夜欧美不卡精品aaaaa| 99精品欧美一区| 欧美日韩国产精品一区二区亚洲| 亚洲成人在线| 欧美大片一区二区| 狂野欧美性猛交xxxx巴西| 黄色亚洲在线| 久久一区二区三区四区| 欧美在线视频观看| 狠狠色伊人亚洲综合网站色| 久久久久久高潮国产精品视| 西瓜成人精品人成网站| 国产小视频国产精品| 久久成人在线| 欧美在线视频一区| 亚洲电影免费在线| 亚洲国产欧美日韩精品| 欧美在线中文字幕| 在线日本高清免费不卡| 欧美激情视频免费观看| 欧美激情a∨在线视频播放| 日韩一级欧洲| 亚洲综合日韩| 1000部国产精品成人观看| 91久久精品国产91久久性色| 欧美日韩一区二区在线视频 | 欧美大片一区二区| 99日韩精品| 亚洲综合社区| 亚洲电影在线播放| 99热在线精品观看| 国产欧美日韩三区| 欧美第十八页| 国产精品免费观看在线| 另类av一区二区| 欧美区视频在线观看| 欧美在线高清视频| 欧美国产日韩一二三区| 欧美一级二区| 欧美精品国产一区| 久久久久久久波多野高潮日日| 欧美69wwwcom| 久久精品国产99| 欧美韩日精品| 久久精品视频免费播放| 欧美二区在线观看| 久久成人18免费观看| 欧美国产精品一区| 久久久久久久久久久一区| 欧美—级高清免费播放| 久久久国产一区二区| 欧美三日本三级少妇三2023| 久久久国产精品一区二区三区| 欧美人成在线| 欧美黑人一区二区三区| 国产日韩欧美制服另类| 日韩系列欧美系列| 99热免费精品| 国产女人aaa级久久久级| 欧美激情视频免费观看| 国产婷婷一区二区| 亚洲乱码精品一二三四区日韩在线 | 国产精品色午夜在线观看| 欧美国产欧美亚洲国产日韩mv天天看完整 | 欧美69视频| 国产视频一区欧美| 一区二区欧美国产| 99re6热只有精品免费观看 | 亚洲网址在线| 亚洲少妇最新在线视频| 欧美成人精品激情在线观看| 久久―日本道色综合久久| 国产精品日本欧美一区二区三区| 91久久久在线| 亚洲黄色小视频| 老司机免费视频一区二区| 久久激情久久| 国产欧美精品va在线观看| 一本大道久久a久久综合婷婷 | 久久综合网hezyo| 国产一区二区福利| 亚洲欧美一区在线| 久久久777| 国产一区二区三区在线观看网站| 亚洲自拍偷拍色片视频| 午夜国产精品影院在线观看| 欧美视频官网| 一区二区三区www| 午夜视频一区在线观看| 国产目拍亚洲精品99久久精品 | 一本色道久久综合精品竹菊| 噜噜噜躁狠狠躁狠狠精品视频 | 亚洲精品日韩久久| 欧美激情精品久久久六区热门| 亚洲电影毛片| 日韩网站在线看片你懂的| 免费观看国产成人| 国产精品久久久久7777婷婷| 亚洲第一页中文字幕| 亚洲精品午夜| 欧美日韩亚洲综合| 亚洲一区在线观看视频| 久久国产高清| 亚洲第一页在线| 欧美日韩国产精品成人| 亚洲欧美日韩另类精品一区二区三区 | 久热精品视频在线观看| 亚洲高清在线| 亚洲欧美网站| 玉米视频成人免费看| 欧美激情国产日韩| 亚洲欧美春色| 亚洲第一区中文99精品| 亚洲午夜电影在线观看| 国内精品久久久| 欧美精品一区二区三区视频| 亚洲视频你懂的| 欧美激情国产日韩| 亚洲一区区二区| 尤物网精品视频| 国产精品第一区| 久久久久久久久蜜桃| 亚洲人成亚洲人成在线观看| 欧美一区二区三区婷婷月色| 亚洲大胆女人| 国产伦精品一区二区三区高清| 麻豆国产精品一区二区三区| 这里只有精品视频在线| 欧美va亚洲va日韩∨a综合色| 中文一区二区| 在线观看欧美激情| 国产欧美日韩视频一区二区| 欧美连裤袜在线视频| 久久aⅴ国产欧美74aaa| 99日韩精品| 亚洲成在人线av| 久久久女女女女999久久| 亚洲午夜一区二区| 日韩一区二区电影网| 国产在线观看91精品一区| 国产精品va在线| 欧美日韩大片一区二区三区| 久久精品中文字幕免费mv| 亚洲一区二区三区久久 | 快she精品国产999| 篠田优中文在线播放第一区|