473,804 Members | 3,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing physical memory using C++

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 point me in
the direction of an example that I could modify. I found a reference
to an example program called GENPORT but can't seem to find any similar
example in the latest DDK. I have also found an already written and
complied driver called portTalk but this only allows you to talk to an
addresses between 0x0000 and 0xFFFF. Any help most appreicated.

Thanks,

Grant

Oct 24 '06 #1
6 6347
Grant wrote:
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 point me in
the direction of an example that I could modify. I found a reference
to an example program called GENPORT but can't seem to find any
similar example in the latest DDK. I have also found an already
written and complied driver called portTalk but this only allows you
to talk to an addresses between 0x0000 and 0xFFFF. Any help most
appreicated.
C++ _language_ does not define "DDK" or "windows". Try looking in
the 'microsoft.publ ic.*' newsgroup hierarchy.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 24 '06 #2
Grant posted:
I need to write data to a physical address between 0xD0000 and 0xDFFFF
int main()
{
char unsigned *const min = (char unsigned*)0xD00 00;
char unsigned const *const max = (char unsigned*)0xDFF FF;

char unsigned *p = min;

do *p++ = 5;
while (max != p);

*p = 5;
}

--

Frederick Gotham
Oct 24 '06 #3
Frederick Gotham wrote:
Grant posted:
>I need to write data to a physical address between 0xD0000 and
0xDFFFF

int main()
{
char unsigned *const min = (char unsigned*)0xD00 00;
char unsigned const *const max = (char unsigned*)0xDFF FF;

char unsigned *p = min;

do *p++ = 5;
while (max != p);

*p = 5;
}
The code above does not guarantee to access *physical addresses*,
only *virtual* ones. Besides, there is no guarantee such virtual
addresses exist.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 24 '06 #4
Victor Bazarov wrote:
Frederick Gotham wrote:
Grant posted:
I need to write data to a physical address between 0xD0000 and
0xDFFFF
int main()
{
char unsigned *const min = (char unsigned*)0xD00 00;
char unsigned const *const max = (char unsigned*)0xDFF FF;

char unsigned *p = min;

do *p++ = 5;
while (max != p);

*p = 5;
}

The code above does not guarantee to access *physical addresses*,
only *virtual* ones. Besides, there is no guarantee such virtual
addresses exist.
isn't casting an int to a pointer implemetation defined behaviour? And
isn't dereferencing the resulting pointer undefined behaviour?
--
Nick Keighley

Oct 25 '06 #5
Thanks I'll do that

Victor Bazarov wrote:
Grant wrote:
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 point me in
the direction of an example that I could modify. I found a reference
to an example program called GENPORT but can't seem to find any
similar example in the latest DDK. I have also found an already
written and complied driver called portTalk but this only allows you
to talk to an addresses between 0x0000 and 0xFFFF. Any help most
appreicated.

C++ _language_ does not define "DDK" or "windows". Try looking in
the 'microsoft.publ ic.*' newsgroup hierarchy.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 25 '06 #6
Nick Keighley wrote:
Victor Bazarov wrote:
>Frederick Gotham wrote:
>>Grant posted:
>>>I need to write data to a physical address between 0xD0000 and
0xDFFFF

int main()
{
char unsigned *const min = (char unsigned*)0xD00 00;
char unsigned const *const max = (char unsigned*)0xDFF FF;

char unsigned *p = min;

do *p++ = 5;
while (max != p);

*p = 5;
}

The code above does not guarantee to access *physical addresses*,
only *virtual* ones. Besides, there is no guarantee such virtual
addresses exist.

isn't casting an int to a pointer implemetation defined behaviour? And
isn't dereferencing the resulting pointer undefined behaviour?
Any undefined behaviour can still be defined by the implementation,
the Standard does not prohibit that. FWIW in MS-DOS ("real mode" of
x86 processors), for instance, the mechanism Frederick showed *is*
the way to access a particular location in physical memory. There
are, I am sure, other platforms that implement it that way. The only
reason it's so is that the mapping between virtual space and physical
space is 1-to-1 there.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 25 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
8180
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 before *"). I've tried using __far, _far, FAR, _FAR, and __FAR, all with the same result. So, then I tried this:
9
7066
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
1692
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 I can access memory locations by using pointers in unsafe code. But I only know how to assign a pointer to the address of a declared variable (by using the & operator), not to a specific address. Does anybody have a suggestion?
4
5729
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 application in the Windows XP so the application memory allocation will not use any of the virtual memory? I’m not talking about the .NET framework. I need to configure the Windows itself.
8
3022
by: nkrisraj | last post by:
Hi, I have a following structure: typedef struct { RateData rdr; int RateID; char RateBalance; } RateInfo;
20
2884
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 me..
3
3996
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 some addresses, like 0x9FFF0. However, the resource the board uses is address at 0xE8100000 which I cannot pick up with the tool. I have confirmed that address in windows device manager and in the BAR0 entry in the table that the PCI board...
18
5795
by: Sharaola | last post by:
Direct question , please direct answer Want to access physical memory as 0x80 in my code like namespace ff { class Program {
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10327
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.