473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Accessing Physical Memory

Direct question , please direct answer

Want to access physical memory as 0x80 in my code
like

Expand|Select|Wrap|Line Numbers
  1. namespace ff
  2. {
  3.     class Program
  4.     {
  5.         unsafe static void Main(string[] args)
  6.         {
  7.             int* f = (int*)0x80;
  8.             Console.Write("{0}", *f);
  9.         }
  10.     }
  11. }
  12.  

Please answer with a solution , not only explanation
using winxp , visualstudio2005
thanks in advance
Dec 17 '08 #1
18 5750
Plater
7,872 Expert 4TB
Direct Answer: I agree, you want to do that.
Dec 17 '08 #2
@Plater
What a nonsense answer ???!!!! :S
Dec 17 '08 #3
Plater
7,872 Expert 4TB
@Sharaola
Just like your question, which there wasn't one.

Did this not work:
Expand|Select|Wrap|Line Numbers
  1. unsafe static void Main(string[] args)
  2. {
  3. int* f = (int*)0x80;
  4. Console.Write("{0}", *f);
  5. }
  6.  
How do you know it didn't work?
Did you run in debug and look at the memory contents?
Dec 17 '08 #4
@Plater
Of course man i did , and it didn't work

Briefly , Windows doesn't give you the permission to access the physical address " only virtual ones " , so how can write a code to take this privilage and pass those limits

Please answer briefly with the solution
Dec 17 '08 #5
Plater
7,872 Expert 4TB
Write a c++ dll that does it for you, try using memorymappedIO if need be?
Then DLLImport the dll?
Dec 17 '08 #6
@Plater
How ?? , please more explantion
Dec 17 '08 #7
Curtis Rutland
3,256 Expert 2GB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. This includes handing out fully coded solutions. Please attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

@Sharaola
This isn't ExpertsExchange or RentACoder. We won't do your work for you; we help you do your own work. So asking us not to answer with an explanation goes against this site's policies.

I suggest you take that attitude elsewhere.

MODERATOR
Dec 18 '08 #8
Frinavale
9,735 Expert Mod 8TB
Why do you want to access physical memory anyways?
You don't know what's in it...and worse, you don't know what's using it so if you modify it you could damage something.

Why would you want to do this?

We cannot help you if you don't explain what you are trying to do, what you have tried, and what the problem is that you are having.

We are willing to help you understand your problem so that you can find a solution, however we will never outright give you a solution...that's just not how we work here....and even if I we wanted to give you an answer, we couldn't because you are trying to...hmm there's no way to put this nicely....because you're trying to do something kind of stupid. Like I said, accessing physical memory Not a good idea because you do not know what it is, what it's used for, or what's using it.


Anyways, I have renamed your thread so that it better reflects your question.

In the future please use a more descriptive title for your thread. This will help you to receive help more quickly and without the sarcasm that you've seen here.

-Moderator Frinny
Dec 18 '08 #9
@Frinavale
"you're trying to do something kind of stupid".
Behave yourself because i know what to do specifcally

"I have renamed your thread"
you should inform me before doing such an action , as a kind of politness

Finally thanks you for your toughness
Dec 18 '08 #10
Curtis Rutland
3,256 Expert 2GB
@Sharaola
If you know what to do specifically, why do you need our help?


@Sharaola
As a matter of fact, we shouldn't. Many OPs abandon threads, and if we waited for OP approval, we'd have a big mess. It's part of our job as Moderators to exercise our privileges when and how we see fit.


The fact that we are all Moderators on this forum should indicate something to you...we know what we are doing; we are staff.

If you have a problem with the way we are handling this situation, feel free to contact an administrator.
Dec 18 '08 #11
"you're trying to do something kind of stupid".
Behave yourself

Y didn't you comment about this ??
Dec 19 '08 #12
Curtis Rutland
3,256 Expert 2GB
If you want to discuss this further, please do so via PM. This is a public forum for question/answer, not a place to discuss the rules of the forum.
Dec 19 '08 #13
@insertAlias
You should tell this to whose called frinavale first
Dec 19 '08 #14
Banfa
9,065 Expert Mod 8TB
It is not clear why you would want to access physical memory and normally a program would not require this, although device drivers may require access to the physical addresses of the devices they drive.

The windows operating system generally prevents direct access to any hardware, all accesses routed via the HAL (Hardware Abstraction Layer Architecture of Windows NT - Wikipedia, the free encyclopedia) which is one of the ways that Windows manages to run correctly on so many different types of hardware.

All programs run in their own virtual memory space which has bits of physical memory they own mapped into it but you have no control of which bits of physical memory are assigned to your program, again that is under the control of Windows.

So as has been said direct access to physical memory is not a good idea in Windows as you have no idea of the true owner of that memory or what accessing it may do (especially if you write to it), because of this Windows does rather a good job of preventing it.
Dec 19 '08 #15
Plater
7,872 Expert 4TB
Since I am in a good mood, I will redirect your attention to this function:
MmMapIoSpace()

I use it to directly access the bus lines connected to the processor, feel free to look up examples on how to use it
Dec 19 '08 #16
Frinavale
9,735 Expert Mod 8TB
@Banfa
Thanks for the explanation Banfa.

I honestly didn't think there was any reason for why someone would want to access physical memory. The idea seemed absurd because I have never seen .NET used to implement firmware or device drivers. It never crossed my mind.
Dec 19 '08 #17
NeoPa
32,556 Expert Mod 16PB
@Sharaola
Sharaola,

Your attitude towards the staff here (This attitude towards any member of the site would also warrant an official warning, but it is more serious against staff) is entirely unacceptable. I could include (quote from) almost any of your posts to illustrate the extraordinary level of rudeness you exhibit. Your attitude implies you see yourself as someone special, and that our volunteer helpers should consider themselves at your disposal. I will leave instruction in manners to your parents, but I want to make very clear that your current understanding of what contributes acceptable behaviour is woefully short of the mark. It's interesting to note though, that the concept of politeness is something you've heard of at least. It's just a shame you seem to feel this is only relevant to how others treat you, and there's no indication you feel you should be constrained by the same standards.

This warning means that any further infractions of our rules may lead to a suspension of your account for a period (generally one or two weeks - depending on the severity). Further infractions after this point would almost certainly lead to your account being banned permanently.

Administrator.

...and even if I we wanted to give you an answer, we couldn't because you are trying to...hmm there's no way to put this nicely....because you're trying to do something kind of stupid. Like I said, accessing physical memory Not a good idea because you do not know what it is, what it's used for, or what's using it.
PS. As a matter of interest - has no real bearing on this particular issue (except in your response to it) - had you quoted Frinny accurately, it would have been clear that they were making every effort not to be rude, and to treat you with a level of respect you've certainly not earned. Personally, I'm at a loss trying to think of a less insulting way to put it in the circumstances. How do you explain to someone why something you feel is obviously stupid should not be done, without referring to the stupidity of it?
Dec 19 '08 #18
NeoPa
32,556 Expert Mod 16PB
@Frinavale
I wouldn't worry too much about it. If the question had been phrased more clearly, or even less offensively, the concepts of writing Device Driver software could have come to the fore earlier.

My device driver writing days are a long way behind me now, and Windows is a whole different OS from the one I ever wrote for, but I would guess, knowing that Windows protects direct memory access as it does, that there would need to be some sort of OS call to reserve access to the memory, and this would fail unless the module were written as, and loaded up as, a device driver.

I doubt user-level software could even make the call as the priority level would be too low.

Of course if the OP had bothered to spend effort explaining the situation, instead of wasting it making exhorbitant demands, you'd have had a clearer situation to consider.
Dec 19 '08 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: lupher cypher | last post by:
Hi, I'm trying to access memory directly at 0xb800 (text screen). I tried this: char far* screen = (char far*)0xb8000000; but apparently c++ compiler doesn't know "far" (says "syntax error...
9
by: Olumide | last post by:
Thats the question. I know about virtual memory, and the MMU. I just wonder if array members guaranteed to be contiguous in physical memory (and if so, why). Thanks, Olumide
1
by: Ronald de Feijter | last post by:
In a mechatronic system I can control some motors and servos by setting values between 0 and 255 at specific memory addresses. My problem is how to access these memory addresses within C#. I know...
4
by: Sharon | last post by:
I have an application that fails to allocate all its memory on physical memory. I have a Windows XP with 2 GByte RAM. Can anybody tell me how to configure the allowed physical memory for each...
8
by: nkrisraj | last post by:
Hi, I have a following structure: typedef struct { RateData rdr; int RateID; char RateBalance; } RateInfo;
6
by: Grant | last post by:
I need to write data to a physical address between 0xD0000 and 0xDFFFF I have download the windows DDK but have no experience with this and would like to get up and running very quickly can any one...
20
by: sethukr | last post by:
hi, i need to store a value to a particular memory location without having a variable. So, how can i access a 'memory address' without using variables?? Is it possible in C??? Plz, help...
3
by: john | last post by:
I would like to view physical memory that is mapped to a pci board. I am using a tool called WinIO to try to create a virtual address to that physical memory. It works for both read and write of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.