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

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>
            欧美ab在线视频| 亚洲国产精品电影| 国产一区二区三区奇米久涩| 欧美性色视频在线| 国产精品视频免费观看www| 国产精品久久久久999| 国产精品久久久久久福利一牛影视| 一区二区三区免费在线观看| 91久久久国产精品| 一本久久a久久精品亚洲| 中文av一区特黄| 久久aⅴ国产欧美74aaa| 麻豆精品视频在线| 欧美大片网址| 正在播放亚洲| 久久久91精品| 欧美日韩精品一区二区天天拍小说 | 欧美激情成人在线| 欧美成人免费大片| 国产精品入口66mio| 国产欧美日韩免费| …久久精品99久久香蕉国产 | 亚洲欧美三级伦理| 欧美在线一二三四区| 久久成人18免费网站| 欧美风情在线观看| 中文在线一区| 美女任你摸久久| 国产欧美视频一区二区| 亚洲国产精品一区二区第一页| 国产麻豆日韩| 在线看国产日韩| 亚洲欧美国内爽妇网| 欧美成人午夜影院| 亚洲在线一区二区三区| 欧美黄色日本| 激情综合色丁香一区二区| 亚洲深夜av| 国产区欧美区日韩区| 亚久久调教视频| 亚洲二区在线| 欧美影院久久久| 国产精品成人观看视频免费| 亚洲精品久久久久久久久久久久久| 国产乱子伦一区二区三区国色天香| 免费不卡欧美自拍视频| 国产精品中文字幕在线观看| 一区二区三区日韩| 亚洲高清三级视频| 久久久久在线| 国外成人在线视频| 午夜激情综合网| 日韩一级片网址| 欧美经典一区二区| 亚洲欧洲在线免费| 欧美激情第3页| 久久婷婷麻豆| 亚洲国产精品专区久久| 欧美va亚洲va国产综合| 久久婷婷麻豆| 亚洲国产精品专区久久| 欧美激情一区二区| 欧美不卡视频一区| 91久久夜色精品国产网站| 欧美国产日韩精品| 欧美成人中文字幕在线| 亚洲伦理精品| 欧美色欧美亚洲另类七区| 亚洲国产乱码最新视频| 欧美成人一区二区| 另类天堂视频在线观看| 精品动漫一区二区| 麻豆久久精品| 久久综合久色欧美综合狠狠| 亚洲风情在线资源站| 亚洲电影免费观看高清完整版在线| 亚洲精品国偷自产在线99热| 欧美二区乱c少妇| 亚洲视频在线二区| 亚洲午夜小视频| 国产综合久久久久影院| 久久综合中文字幕| 欧美国产日韩精品| 亚洲一区日韩| 久久精品国产亚洲精品| 亚洲国产精品久久久久婷婷884| 一区二区三区 在线观看视| 亚洲精选视频在线| 国产欧美日韩亚州综合| 欧美+亚洲+精品+三区| 欧美激情亚洲视频| 亚洲午夜激情免费视频| 欧美一区二区三区视频| 亚洲欧洲综合另类在线| 99国产精品久久久久久久久久| 久久疯狂做爰流白浆xx| 亚洲国产精品一区二区www| 日韩视频免费观看高清完整版| 亚洲一区二区三区在线视频| 久久久久久久欧美精品| 久久亚洲免费| 午夜精品久久久久久久99水蜜桃| 亚洲第一搞黄网站| 欧美日韩精品一区二区在线播放| 国内久久视频| 亚洲精品乱码久久久久| 国产精品一区二区久激情瑜伽| 一区二区三区精品视频| 欧美亚洲一级| 亚洲一区免费看| 男同欧美伦乱| 久久精品视频免费播放| 欧美日韩精品| 欧美freesex8一10精品| 国产欧美日韩综合一区在线观看 | 欧美精品在线观看播放| 一区二区三区视频在线| 久久大香伊蕉在人线观看热2| 国产精品一区二区三区乱码| 蜜臀av性久久久久蜜臀aⅴ| 国产精品videossex久久发布| 99精品热6080yy久久| 久久国产免费看| 午夜在线一区二区| 欧美黄污视频| 亚洲大片在线观看| 雨宫琴音一区二区在线| 久久aⅴ乱码一区二区三区| 欧美一站二站| 国产精品日日摸夜夜添夜夜av| 亚洲永久在线观看| 欧美日韩成人一区二区三区| 欧美激情导航| 最新中文字幕亚洲| 久久久久久久精| 久久精品在线免费观看| 国产伪娘ts一区| 午夜一区二区三区不卡视频| 午夜视频在线观看一区二区三区| 欧美一区不卡| 欧美一区二区三区四区高清| 国产精品美女| 亚洲欧美综合精品久久成人| 欧美在线日韩在线| 国内精品国产成人| 欧美一区二区播放| 久久免费视频网| 136国产福利精品导航网址| 久久午夜精品一区二区| 欧美高清在线精品一区| 日韩视频在线一区二区| 欧美日韩免费观看一区=区三区 | 羞羞视频在线观看欧美| 国产精品美女久久久久久久| 一区二区精品在线观看| 午夜日韩激情| 国产一区视频在线看| 欧美一区二视频在线免费观看| 亚洲欧洲视频| 欧美精品二区三区四区免费看视频| 亚洲欧美日韩精品在线| 久久国产高清| 亚洲免费av观看| 欧美午夜精品久久久久免费视| 欧美在线播放| 国产乱子伦一区二区三区国色天香| 欧美韩日一区| 一区二区欧美在线观看| 国产精品午夜国产小视频| 久久久爽爽爽美女图片| 亚洲精品影视在线观看| 欧美一区二区在线免费观看| 在线欧美一区| 国产精品视频一| 免费成人黄色av| 亚洲免费影视| 亚洲第一黄色网| 久久精品道一区二区三区| 日韩亚洲精品视频| 国产主播一区二区| 国产精品videossex久久发布| 亚洲国产精品悠悠久久琪琪 | 久久国产精品久久w女人spa| 欧美~级网站不卡| 欧美一区二区视频免费观看| 亚洲日本成人在线观看| 国产午夜精品久久久久久免费视| 亚洲视频免费在线观看| 美国十次了思思久久精品导航| 国产精品久久久久久久午夜片| 欧美成人免费全部观看天天性色| 国产精品嫩草99a| 另类综合日韩欧美亚洲| 在线中文字幕不卡| 亚洲激情啪啪| 欧美3dxxxxhd| 久久久久国产精品一区| 亚洲欧美日韩国产一区| 一本一本久久| 99v久久综合狠狠综合久久|