在内存映射i / o中使用placement new [英] Use of placement new in memory mapped i/o

查看:61
本文介绍了在内存映射i / o中使用placement new的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一些书籍中遇到了新的内存映射

i / o的应用程序。我无法完全理解它,可能

be因为我对内存映射i / o缺乏了解。在我的理解中,它是一个将I / O设备视为内存的系统

位置并使用相同数量的地址线。如何将

物品放置在特定位置会对此产生影响?有些

身体请澄清一下吗?

I have come across the application of placement new in memory mapped
i/o in a number of books.I am not able to understand it completely, may
be becaues of my lack of knowledge with memory mapped i/o.In my
understanding it is a system where I/O devices are treated as memory
locations and are addressed using same number of address lines.How an
object placed at a specific location makes a difference to this?Some
body pls clarify?

推荐答案

Samshayam,


内存映射I / O不一定只是在设备上,可以用于文件

好​​。在这种情况下,您可以在内存位置创建您的结构

,它将自动保存在文件中(如果此地址位于

文件的映射位置)。显然,实现

并不容易,需要经历很多问题,比如

分段,内存管理等。


简单而强大的技术,在数据库等中使用很多..


问候,

Ramneek Handa
www.lazybugz.net

Sa ******* @ gmail.com 写道:
Samshayam,

Memory Mapped I/O need not be just on device and can be for files as
well. In that case you can create your structure in memory location
which will automatically be saved in the file (if this address is at
the location where file is being mapped). Obviously the implementation
is not as easy and requires to go through a lot of issues like
framentation, memory management etc..

Simple yet powerful technique and is used a lot in databases etc..

Regards,
Ramneek Handa
www.lazybugz.net

Sa*******@gmail.com wrote:

我遇到过安置申请新的内存映射

i / o在很多书中。我无法完全理解它,可能因为我对内存映射缺乏了解而导致b / b o。在我的

理解中,它是一个系统,其中I / O设备被视为内存

位置并使用相同数量的地址线进行寻址。如何
放置在特定位置的物体会对此产生影响吗?有些

身体请参阅larify?
I have come across the application of placement new in memory mapped
i/o in a number of books.I am not able to understand it completely, may
be becaues of my lack of knowledge with memory mapped i/o.In my
understanding it is a system where I/O devices are treated as memory
locations and are addressed using same number of address lines.How an
object placed at a specific location makes a difference to this?Some
body pls clarify?


Rami,

非常感谢。

C ++ FAQ,以下作为展示位置申请说新的。

"例如,当您的硬件具有内存映射的I / O计时器设备时,

并且您希望将Clock对象放在该内存位置。

这让我再次感到困惑


问候

Sam

rami写道:
Rami,
Thanks alot.
C++ FAQ , says the following as application of placement new.
"For example, when your hardware has a memory-mapped I/O timer device,
and you want to place a Clock object at that memory location."
This is making a me again confused

regards
Sam
rami wrote:

Samshayam,


内存映射I / O不一定只在设备上,可以用于文件

好​​。在这种情况下,您可以在内存位置创建您的结构

,它将自动保存在文件中(如果此地址位于

文件的映射位置)。显然,实现

并不容易,需要经历很多问题,比如

分段,内存管理等。


简单而强大的技术,在数据库等中使用很多..


问候,

Ramneek Handa
www.lazybugz.net

Sa ******* @ gmail.com 写道:
Samshayam,

Memory Mapped I/O need not be just on device and can be for files as
well. In that case you can create your structure in memory location
which will automatically be saved in the file (if this address is at
the location where file is being mapped). Obviously the implementation
is not as easy and requires to go through a lot of issues like
framentation, memory management etc..

Simple yet powerful technique and is used a lot in databases etc..

Regards,
Ramneek Handa
www.lazybugz.net

Sa*******@gmail.com wrote:

我遇到过安置申请新的内存映射

i / o在很多书中。我无法完全理解它,可能因为我对内存映射缺乏了解而导致b / b o。在我的

理解中,它是一个系统,其中I / O设备被视为内存

位置并使用相同数量的地址线进行寻址。如何
放置在特定位置的物体会对此产生影响吗?有些

身体p澄清?
I have come across the application of placement new in memory mapped
i/o in a number of books.I am not able to understand it completely, may
be becaues of my lack of knowledge with memory mapped i/o.In my
understanding it is a system where I/O devices are treated as memory
locations and are addressed using same number of address lines.How an
object placed at a specific location makes a difference to this?Some
body pls clarify?


Sa ***** **@gmail.com 写道:

Rami,

非常感谢。

C ++常见问题解答,以下作为贴片新应用说明。

"例如,当你的硬件有一个内存映射的I / O定时器设备时,

你想要将一个Clock对象放在那个内存位置。

这让我再次感到困惑
Rami,
Thanks alot.
C++ FAQ , says the following as application of placement new.
"For example, when your hardware has a memory-mapped I/O timer device,
and you want to place a Clock object at that memory location."
This is making a me again confused



请不要发帖,您的回复应该在您回复的消息之后或与之交错。


这是嵌入式应用程序的常见情况,您可以使用/>
硬件设备在内存映射中注册,并希望在寄存器上映射C ++

结构。您使用placement new在硬件设备占用的内存位置创建对象




-

Ian Collins 。

Please don''t top post, your reply should be after, or interleaved with
the message you are replying to.

This is a common situation with embedded applications, where you have
hardware device registers in your memory map and want to map a C++
struct over the registers. You use placement new to create the object
at the memory location occupied by the hardware device.

--
Ian Collins.


这篇关于在内存映射i / o中使用placement new的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆