How to map physical memory safely in Linux? The 2019 Stack Overflow Developer Survey Results Are InDirect Memory Access in LinuxCreating physical memory from user space to use for DMA transfersmmap returns ENOMEM with shm_open file objectWriting to hard disk from contiguous physical memoryHow to get writes via an mmap mapped memory pointer to flush immediately?Memcpy performance on /dev/mem outside kernel rammmap very slow when using O_SYNCMmap DMA memory uncached: “map pfn ram range req uncached-minus got write-back”Using mmap on Zynq 7000Issue Getting Physical Address in Kernel Module - Can't MMAP to that address
What information about me do stores get via my credit card?
Ubuntu Server install with full GUI
What is this sharp, curved notch on my knife for?
How do I free up internal storage if I don't have any apps downloaded?
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
Can we generate random numbers using irrational numbers like π and e?
Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?
How to display lines in a file like ls displays files in a directory?
writing variables above the numbers in tikz picture
Why can't devices on different VLANs, but on the same subnet, communicate?
Inverse Relationship Between Precision and Recall
Can a flute soloist sit?
A word that means fill it to the required quantity
Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?
How do PCB vias affect signal quality?
How to translate "being like"?
Why “相同意思的词” is called “同义词” instead of "同意词"?
Deal with toxic manager when you can't quit
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
How much of the clove should I use when using big garlic heads?
Relationship between Gromov-Witten and Taubes' Gromov invariant
What do these terms in Caesar's Gallic wars mean?
Is it safe to harvest rainwater that fell on solar panels?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
How to map physical memory safely in Linux?
The 2019 Stack Overflow Developer Survey Results Are InDirect Memory Access in LinuxCreating physical memory from user space to use for DMA transfersmmap returns ENOMEM with shm_open file objectWriting to hard disk from contiguous physical memoryHow to get writes via an mmap mapped memory pointer to flush immediately?Memcpy performance on /dev/mem outside kernel rammmap very slow when using O_SYNCMmap DMA memory uncached: “map pfn ram range req uncached-minus got write-back”Using mmap on Zynq 7000Issue Getting Physical Address in Kernel Module - Can't MMAP to that address
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I was following a tutorial about DMA, the goal is to move data fromm ddr to another part of ddr. In the example, it just mapped a 512MB physical memory using mmap and dev/mem, starting from some physical address like 0x20000000 and write data to it.
My question is that since we use virtual memory in linux, it is possible that other programs may already use some pages in this part of physical memory, how can we still writing these memory without damaging other programs accidentally?
Thanks.
Here's the part where physical memory is mapp:
#define DDR_BASE_ADDRESS 0x20000000
off_t dev_base_1 = DDR_BASE_ADDRESS;
memfd_1 = open("/dev/mem", O_RDWR | O_SYNC);
if (memfd_1 == -1)
printf("Can't open /dev/mem.n");
exit(0);
printf("/dev/mem opened.n");
mapped_base_1 = mmap(0, DDR_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, memfd_1, dev_base_1 & ~DDR_MAP_MASK);
linux-kernel mmap
add a comment |
I was following a tutorial about DMA, the goal is to move data fromm ddr to another part of ddr. In the example, it just mapped a 512MB physical memory using mmap and dev/mem, starting from some physical address like 0x20000000 and write data to it.
My question is that since we use virtual memory in linux, it is possible that other programs may already use some pages in this part of physical memory, how can we still writing these memory without damaging other programs accidentally?
Thanks.
Here's the part where physical memory is mapp:
#define DDR_BASE_ADDRESS 0x20000000
off_t dev_base_1 = DDR_BASE_ADDRESS;
memfd_1 = open("/dev/mem", O_RDWR | O_SYNC);
if (memfd_1 == -1)
printf("Can't open /dev/mem.n");
exit(0);
printf("/dev/mem opened.n");
mapped_base_1 = mmap(0, DDR_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, memfd_1, dev_base_1 & ~DDR_MAP_MASK);
linux-kernel mmap
add a comment |
I was following a tutorial about DMA, the goal is to move data fromm ddr to another part of ddr. In the example, it just mapped a 512MB physical memory using mmap and dev/mem, starting from some physical address like 0x20000000 and write data to it.
My question is that since we use virtual memory in linux, it is possible that other programs may already use some pages in this part of physical memory, how can we still writing these memory without damaging other programs accidentally?
Thanks.
Here's the part where physical memory is mapp:
#define DDR_BASE_ADDRESS 0x20000000
off_t dev_base_1 = DDR_BASE_ADDRESS;
memfd_1 = open("/dev/mem", O_RDWR | O_SYNC);
if (memfd_1 == -1)
printf("Can't open /dev/mem.n");
exit(0);
printf("/dev/mem opened.n");
mapped_base_1 = mmap(0, DDR_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, memfd_1, dev_base_1 & ~DDR_MAP_MASK);
linux-kernel mmap
I was following a tutorial about DMA, the goal is to move data fromm ddr to another part of ddr. In the example, it just mapped a 512MB physical memory using mmap and dev/mem, starting from some physical address like 0x20000000 and write data to it.
My question is that since we use virtual memory in linux, it is possible that other programs may already use some pages in this part of physical memory, how can we still writing these memory without damaging other programs accidentally?
Thanks.
Here's the part where physical memory is mapp:
#define DDR_BASE_ADDRESS 0x20000000
off_t dev_base_1 = DDR_BASE_ADDRESS;
memfd_1 = open("/dev/mem", O_RDWR | O_SYNC);
if (memfd_1 == -1)
printf("Can't open /dev/mem.n");
exit(0);
printf("/dev/mem opened.n");
mapped_base_1 = mmap(0, DDR_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, memfd_1, dev_base_1 & ~DDR_MAP_MASK);
linux-kernel mmap
linux-kernel mmap
asked Mar 22 at 4:33
j.youngj.young
164
164
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292967%2fhow-to-map-physical-memory-safely-in-linux%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292967%2fhow-to-map-physical-memory-safely-in-linux%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown