Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | BartC <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: how does one access a specific address location in C? |
| Date | 2016-06-16 19:57 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <njusr1$9e3$1@dont-email.me> (permalink) |
| References | (2 earlier) <482fe8e7-a95e-4579-8baf-90565a1530e9@googlegroups.com> <1a8af5ff-56b1-42a5-972f-20e44e573c63@googlegroups.com> <87shwdunmh.fsf@bsb.me.uk> <849b7311-65f7-4df2-8750-c94c2407823f@googlegroups.com> <mstorkamp-FBA0CC.13344316062016@88-209-239-213.giganet.hu> |
On 16/06/2016 19:34, Mark Storkamp wrote:
> In article <849b7311-65f7-4df2-8750-c94c2407823f@googlegroups.com>,
> G G <gdotone@gmail.com> wrote:
>
>> there just has to be a way of looking at a memory location
>> given the location, doesn't it?
>
> Short answer: no.
>
> In the nascent days of home computers security wasn't much of an issue,
> and only one program typically ran at a time, so all of the available
> memory was given to the program that was running. Unless you're
> programming for an embedded controller, those days are pretty much over.
> Even the operating system doesn't have access to all memory. I'm not
> sure of the latest practice, but I remember when Intel introduced a
> supervisor mode that would get initialized by the BIOS and run above the
> OS. The supervisor has access to an area of memory that's hidden from
> the rest of the system.
>
Instead you have access to the virtual memory locations in your program.
Although not all addresses may be set up to point to actual memory, so
you need to know what's what.
On my Windows machine, I can access location 0x400000, but not 03ffffff.
But I can also allocate memory and make those raw locations known:
#define N 1024
int memory[N];
int main(void) {
printf("Memory limits: %p to %p\n",&memory[0],&memory[N-1]);
}
This might show:
Memory limits: 00405420 to 0040641C
(actually to 40641F inclusive)
and those actual addresses can be peeked and poked during the same
invocation of the program.
--
Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 06:32 -0700
Re: how does one access a specific address location in C? gazelle@shell.xmission.com (Kenny McCormack) - 2016-06-16 14:00 +0000
Re: how does one access a specific address location in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-16 15:07 +0100
Re: how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 07:18 -0700
Re: how does one access a specific address location in C? Robert Wessel <robertwessel2@yahoo.com> - 2016-06-16 11:38 -0500
Re: how does one access a specific address location in C? Mark Storkamp <mstorkamp@yahoo.com> - 2016-06-16 09:16 -0500
Re: how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 07:50 -0700
Re: how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 08:04 -0700
Re: how does one access a specific address location in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-16 17:03 +0100
Re: how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 10:01 -0700
Re: how does one access a specific address location in C? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-16 14:29 -0400
Re: how does one access a specific address location in C? Mark Storkamp <mstorkamp@yahoo.com> - 2016-06-16 13:34 -0500
Re: how does one access a specific address location in C? BartC <bc@freeuk.com> - 2016-06-16 19:57 +0100
Re: how does one access a specific address location in C? raltbos@xs4all.nl (Richard Bos) - 2016-06-18 20:50 +0000
Re: how does one access a specific address location in C? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-18 17:23 -0400
Re: how does one access a specific address location in C? raltbos@xs4all.nl (Richard Bos) - 2016-06-18 21:30 +0000
Re: how does one access a specific address location in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-16 21:09 +0100
Re: how does one access a specific address location in C? Mark Storkamp <mstorkamp@yahoo.com> - 2016-06-16 11:10 -0500
Re: how does one access a specific address location in C? James Kuyper <jameskuyper@verizon.net> - 2016-06-16 13:41 -0400
Re: how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 11:14 -0700
Re: how does one access a specific address location in C? Keith Thompson <kst-u@mib.org> - 2016-06-16 11:26 -0700
Re: how does one access a specific address location in C? James Kuyper <jameskuyper@verizon.net> - 2016-06-16 16:38 -0400
Re: how does one access a specific address location in C? "James R. Kuyper" <jameskuyper@verizon.net> - 2016-06-18 11:32 -0400
Re: how does one access a specific address location in C? James Kuyper <jameskuyper@verizon.net> - 2016-06-16 12:45 -0400
Re: how does one access a specific address location in C? G G <gdotone@gmail.com> - 2016-06-16 10:19 -0700
Re: how does one access a specific address location in C? Keith Thompson <kst-u@mib.org> - 2016-06-16 11:20 -0700
Re: how does one access a specific address location in C? supercat@casperkitty.com - 2016-06-16 11:38 -0700
Re: how does one access a specific address location in C? raltbos@xs4all.nl (Richard Bos) - 2016-06-18 13:19 +0000
Re: how does one access a specific address location in C? supercat@casperkitty.com - 2016-06-18 07:11 -0700
Re: how does one access a specific address location in C? Robert Wessel <robertwessel2@yahoo.com> - 2016-06-18 14:41 -0500
Re: how does one access a specific address location in C? supercat@casperkitty.com - 2016-06-18 16:02 -0700
Re: how does one access a specific address location in C? Les Cargill <lcargill99@comcast.com> - 2016-06-18 18:53 -0500
Re: how does one access a specific address location in C? supercat@casperkitty.com - 2016-06-18 17:31 -0700
Re: how does one access a specific address location in C? Les Cargill <lcargill99@comcast.com> - 2016-06-19 06:47 -0500
Re: how does one access a specific address location in C? Robert Wessel <robertwessel2@yahoo.com> - 2016-06-19 00:37 -0500
Re: how does one access a specific address location in C? BartC <bc@freeuk.com> - 2016-06-19 11:07 +0100
Re: how does one access a specific address location in C? Robert Wessel <robertwessel2@yahoo.com> - 2016-06-19 16:21 -0500
Re: how does one access a specific address location in C? Robert Wessel <robertwessel2@yahoo.com> - 2016-06-19 00:34 -0500
csiph-web