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

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(別人的文章技巧總結(jié))

導(dǎo)航

統(tǒng)計

公告

隨筆皆原創(chuàng),文章乃轉(zhuǎn)載. 歡迎留言!

常用鏈接

留言簿(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>
            国产美女诱惑一区二区| 免播放器亚洲| 国产老肥熟一区二区三区| 亚洲一区免费网站| 亚洲午夜在线视频| 国产视频久久网| 久久夜色精品国产亚洲aⅴ | 亚洲一区二区三区乱码aⅴ| 日韩一区二区精品葵司在线| 国产精品福利在线观看| 亚欧成人精品| 久久久久久9| 99成人免费视频| 亚洲综合色网站| 在线日韩av| 一区二区高清视频在线观看| 国产伦精品一区二区三区免费迷| 麻豆成人在线| 欧美日韩亚洲不卡| 久久国产主播精品| 欧美激情在线观看| 久久精品在线播放| 欧美精选一区| 美女图片一区二区| 欧美日韩在线免费| 免费观看国产成人| 国产精品成人免费视频| 欧美成人嫩草网站| 国产精品日韩欧美一区二区三区 | 亚洲激情网站| 亚洲综合精品四区| 99精品欧美一区二区蜜桃免费| 亚洲图片你懂的| 亚洲日韩第九十九页| 亚洲欧美日韩直播| 一区二区三区 在线观看视| 欧美在线三区| 亚洲欧美第一页| 欧美激情久久久| 久久久欧美精品| 国产精品久久久久999| 亚洲大片在线观看| 国产日韩在线视频| 99xxxx成人网| 99国产精品久久久久久久久久| 久久精品夜色噜噜亚洲a∨| 亚洲欧美制服另类日韩| 欧美激情一区在线| 久久久久久久久久久久久9999| 国产精品都在这里| 日韩午夜中文字幕| 日韩亚洲视频| 欧美日产一区二区三区在线观看| 免费国产一区二区| 精品91久久久久| 欧美一区二区三区视频免费| 亚洲欧美日韩一区二区在线| 欧美色精品在线视频| 欧美成人综合在线| 亚洲国产精品久久久久婷婷老年 | 欧美欧美全黄| 亚洲国产高清在线| 亚洲精品婷婷| 欧美激情亚洲另类| 亚洲裸体视频| 亚洲四色影视在线观看| 欧美日韩一区三区四区| 日韩亚洲视频在线| 亚洲综合久久久久| 国产日韩精品视频一区| 午夜精品国产| 美女91精品| 日韩视频不卡| 欧美性猛交一区二区三区精品| 一区二区三区 在线观看视| 亚洲综合日韩| 国产一区二区久久精品| 久久久欧美精品| 亚洲精品国产拍免费91在线| 亚洲午夜精品国产| 国产亚洲精品一区二555| 久久免费偷拍视频| 亚洲国产精品一区二区三区| 一本久久青青| 国产情侣久久| 欧美不卡在线视频| 99亚洲视频| 久久免费99精品久久久久久| 亚洲缚视频在线观看| 欧美一区二区国产| 亚洲小视频在线观看| 国产精品网曝门| 欧美在线免费观看| 亚洲成人在线免费| 亚洲精品1区2区| 欧美mv日韩mv国产网站| 亚洲国产精品久久久久| 一本色道婷婷久久欧美| 国产精品福利影院| 久久精品理论片| 欧美一区二区三区在线视频 | 欧美一区二区观看视频| 久久免费国产| 日韩午夜精品| 国产精品视频yy9299一区| 欧美一级精品大片| 亚洲福利一区| 午夜精品成人在线| 国产欧美不卡| 欧美日韩在线观看一区二区| 欧美在线播放视频| 亚洲精品久久嫩草网站秘色| 亚洲欧美美女| 亚洲国产日韩在线| 国产精品福利av| 欧美日韩高清在线播放| 欧美一级黄色录像| 日韩视频在线永久播放| 久久久九九九九| 一本久道综合久久精品| 国产伦精品一区二区三区免费迷| 欧美激情在线观看| 久久国产精品久久久久久久久久| 亚洲国产精品va在线看黑人| 午夜精品www| 日韩午夜免费视频| 国产精品推荐精品| 欧美精品国产| 亚洲一区二区三区四区五区午夜| 欧美韩国一区| 久久久久国产一区二区| 亚洲一卡久久| 日韩亚洲欧美一区| 国产一区二区三区日韩欧美| 国产精品一区二区在线观看| 欧美绝品在线观看成人午夜影视 | 久久九九热免费视频| 亚洲一区二区欧美| 精品成人国产| 欧美日韩亚洲一区二区三区在线观看| 欧美中文字幕精品| 亚洲免费在线| 亚洲一区二区影院| 日韩午夜激情av| 蜜臀av性久久久久蜜臀aⅴ| 美女任你摸久久| 久久久久免费观看| 久久精品成人| 久久不射中文字幕| 午夜激情一区| 久久免费国产精品| 久久久久久香蕉网| 久久久久国产精品一区| 欧美综合77777色婷婷| 午夜精品在线| 亚洲欧美日韩一区二区三区在线观看 | 欧美激情在线有限公司| 裸体歌舞表演一区二区| 亚洲成人资源网| 亚洲大片av| 亚洲精品乱码久久久久久日本蜜臀 | 一区二区三区产品免费精品久久75| 在线观看欧美视频| 日韩亚洲精品电影| 亚洲性图久久| 性欧美精品高清| 久久精品青青大伊人av| 久久久久女教师免费一区| 欧美在线欧美在线| 久久黄色网页| 欧美~级网站不卡| 亚洲国产精品久久| 亚洲免费观看高清在线观看| 欧美高清自拍一区| 亚洲性感美女99在线| 香蕉精品999视频一区二区| 欧美在线精品一区| 欧美护士18xxxxhd| 国产精品久久777777毛茸茸| 亚洲第一视频| 99xxxx成人网| 午夜欧美电影在线观看| 久久天堂精品| 亚洲人妖在线| 中文在线一区| 欧美中文在线视频| 欧美精品久久一区| 国产精品久久久久久久浪潮网站| 国产一区av在线| 亚洲另类在线一区| 午夜视频在线观看一区| 欧美成人免费观看| 一片黄亚洲嫩模| 久久久久网址| 国产日韩欧美在线视频观看| 亚洲欧洲一二三| 久久国产精品电影| 亚洲精品国产精品国产自| 99精品黄色片免费大全| 牛夜精品久久久久久久99黑人 |