Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   addresses (http://www.velocityreviews.com/forums/t590508-addresses.html)

Morris Dovey 02-09-2008 02:59 AM

Re: addresses
 
Bill Cunningham wrote:
>
> Are there any functions in c like memcpy perhaps that can return the
> memory address from the address bus for an array of say char name[5] ? This
> would be 40 bits somewhere. Where in memory?


A pointer is as close as you'll get. For machines with a linear
address space, the pointer will probably be the memory address -
but for other architectures (and perhaps some virtual machines)
the pointer may very not be a unique address.

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto

Bill Cunningham 02-09-2008 03:37 AM

addresses
 
Are there any functions in c like memcpy perhaps that can return the
memory address from the address bus for an array of say char name[5] ? This
would be 40 bits somewhere. Where in memory?

Bill



Ian Collins 02-09-2008 03:50 AM

Re: addresses
 
Bill Cunningham wrote:
> Are there any functions in c like memcpy perhaps that can return the
> memory address from the address bus for an array of say char name[5] ? This
> would be 40 bits somewhere. Where in memory?
>

C has no such concept. The best you can do is take the address of a
variable and use that address within the context of the application.
That address may or may not map directly to a physical address.

One any virtual memory operating system, obtaining a physical address
from a virtual address is beyond the scope of standard C.

--
Ian Collins.

Kaz Kylheku 02-09-2008 04:00 AM

Re: addresses
 
On Feb 8, 7:37*pm, "Bill Cunningham" <nos...@nspam.com> wrote:
> * * Are there any functions in c like memcpy perhaps that can return the
> memory address from the address bus for *an array of say char name[5] ? This
> would be 40 bits somewhere. Where in memory?


When you become qualified to work with this type of information, you
will distinguish yourself by knowing where to begin looking for it.


Bill Cunningham 02-09-2008 04:32 AM

Re: addresses
 
> C has no such concept. The best you can do is take the address of a
> variable and use that address within the context of the application.
> That address may or may not map directly to a physical address.
>
> One any virtual memory operating system, obtaining a physical address
> from a virtual address is beyond the scope of standard C.


Perhaps what I'm thinking of is a kernel function and the kernel mapping
virtual addresses to physical.
What I'm looking for is probably a probably a return of a virtual
address in hex.

Bill



Bill Cunningham 02-09-2008 04:32 AM

Re: addresses
 
> A pointer is as close as you'll get. For machines with a linear
> address space, the pointer will probably be the memory address -
> but for other architectures (and perhaps some virtual machines)
> the pointer may very not be a unique address.
>

How would you use a pointer?

Bill



Ian Collins 02-09-2008 04:42 AM

Re: addresses
 
Bill Cunningham wrote:
>> C has no such concept. The best you can do is take the address of a
>> variable and use that address within the context of the application.
>> That address may or may not map directly to a physical address.
>>
>> One any virtual memory operating system, obtaining a physical address
>> from a virtual address is beyond the scope of standard C.

>
> Perhaps what I'm thinking of is a kernel function and the kernel mapping
> virtual addresses to physical.


That would be very platform specific.

> What I'm looking for is probably a probably a return of a virtual
> address in hex.
>

I'm not sure you are sure what you are looking for! Why do you want to
know a physical address? Only a device driver would care. If you want
to print something in hex, use the printf %x specifier.

--
Ian Collins.

santosh 02-09-2008 04:42 AM

Re: addresses
 
Bill Cunningham wrote:

>> A pointer is as close as you'll get. For machines with a linear
>> address space, the pointer will probably be the memory address -
>> but for other architectures (and perhaps some virtual machines)
>> the pointer may very not be a unique address.
>>

> How would you use a pointer?


int i, *p = &i;
*p = 5;

Why don't you go through a tutorial?


santosh 02-09-2008 04:45 AM

Re: addresses
 
Bill Cunningham wrote:

>> C has no such concept. The best you can do is take the address of a
>> variable and use that address within the context of the application.
>> That address may or may not map directly to a physical address.
>>
>> One any virtual memory operating system, obtaining a physical address
>> from a virtual address is beyond the scope of standard C.

>
> Perhaps what I'm thinking of is a kernel function and the kernel
> mapping
> virtual addresses to physical.
> What I'm looking for is probably a probably a return of a virtual
> address in hex.


C has no concept of "kernel function", "kernel mapping", "virtual
address" etc.

There may or may not be a kernel present. The machine may or may not use
virtual memory. These details are implementation dependant. See the
documentation for your processor and operating system. Since you are
using Windows the online MSDN documentation will help you.


Kaz Kylheku 02-09-2008 05:13 AM

Re: addresses
 
On Feb 8, 7:37*pm, "Bill Cunningham" <nos...@nspam.com> wrote:
> * * Are there any functions in c like memcpy perhaps that can return the
> memory address from the address bus for *an array of say char name[5] ? This
> would be 40 bits somewhere. Where in memory?


This "Bill Cunningham" Usenet identity is a troll. You can tell from
this thread alone, but a quick peek at the posting history pretty much
confirms it.


All times are GMT. The time now is 12:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.