How to write a value to a physical memory address in bash script?

Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers How to write a value to a physical memory address in bash script?
# 1  
Old 02-03-2020
How to write a value to a physical memory address in bash script?

How would I write a value to a physical memory address?
I was able to read a physical memory address (for example, 0x400) using this line:
    dd if=/dev/mem count=4 bs=1 skip=$(( 0x400 ))

But I get an error:
dd: 'standard input': cannot skip to specified offset

when I try to write using this method
  function T_WRITE2 {
    printf $1 | dd of=/dev/mem count=4 bs=1 skip=$(( 0x400 ))

Any suggestion?

Last edited by Yoda; 02-03-2020 at 02:23 PM..
# 2  
Old 02-07-2020
Hello rabrant,

Sorry for the delayed response but I've been trying to think about this to find a good reason to do it. I would always recommend against it. It's not something I have done, and it's nothing something I would every suggest. Do you have a specific need for using a specific memory address? The OS will stop you if your process does not 'own' the location. Trying to write to /dev/mem would be extremely dangerous even if it was permitted.

Each process is allocated memory by the OS as it is required and the start location & length vary each time a process is called. If your process is swapped, then when recalled it will be extremely unlikely to be in the same physical location. Are you trying to refer to a memory location of your process or perhaps adjust some element of the hardware perhaps?

It's the sort of thing that I would say "No" many times and if you insist, I would have a very long think of any possible reason you might want to and then say "No" again. Can yoiu enlighten us to your need? There is almost certainly a better way.

Kind regards,
This User Gave Thanks to rbatte1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to write script to change email address

we have 4000 html pages that need an email address changed. eg) to we only want the file modified date to be changed when there has been a change to the file. Should I be using grep? I fairly new to UNIX and was told to using something like... (2 Replies)
Discussion started by: mchelle_99
2 Replies

2. UNIX for Dummies Questions & Answers

What would the physical address be for virtual address?

Hi guys, I got one problem which I definetily no idea. What would the physical address be for virtual address? 1) 2ABC 2) 3F4B Here is the page table:see attached Thank you sos sososososso much!! (0 Replies)
Discussion started by: lemon_06
0 Replies

3. Solaris

restrcit physical memory with zone.max-locked-memory

Is it possible to restrict physical memory in solaris zone with zone.max-locked-memory just like we can do with rcapd ? I do not want to used rcapd (1 Reply)
Discussion started by: fugitive
1 Replies

4. Programming

help with C++ code that relate the object with physical address

I need some help to write a C++ code that read and write the register of a sequencer. I have to make a code that relate the objects with the physical address but I am a bit confuse. Could someone suggest me how to proceed? in which parts do I split the code? thanks (1 Reply)
Discussion started by: silviafisica
1 Replies

5. AIX

Hardware address to physical location

Hello How do I deternine the physical location of an ethernet port, based on the hardware address? I have 4 ports on a 9133-55A ent0 05-08 ent1 05-09 ent2 07-08 ent3 07-09 Two of these are internal, and two are on a card. I need to single out ent0 and ent2, but I cannot find any... (4 Replies)
Discussion started by: mhenryj
4 Replies

6. Solaris

Add Static Routes to new physical address

Hi, I need help to add new route:, GW to e1000g1 and, GW to e1000g2 tnx (4 Replies)
Discussion started by: mehrdad68
4 Replies

7. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

8. Solaris

physical memory

what is the command to find the physical memory in soalris OS and how to find whether paging is happening or not ? (2 Replies)
Discussion started by: jayaramanit
2 Replies

9. AIX

Physical and Logical IP address

Hi all I need command to give logical and physical IP Address for my machine. thank you (1 Reply)
Discussion started by: magasem
1 Replies

10. UNIX for Dummies Questions & Answers

physical memory

It is just a general there a limit on the memory? I am looking into a process to store image files on the unix server which will be accessed by the application, and I just wonder if there is any limit regarding the physical or virtual memory. I am very new to unix, so thanks for... (1 Reply)
Discussion started by: cchien
1 Replies
Login or Register to Ask a Question

Featured Tech Videos