virtual address or physical address?

S

sushant

hello,

my question is related with the address of a variable in C. suppose if
i am printing the address of a variable, so that address will be
virtual address or physical address. and why it'll be so?

is that has something to do with 16 bit environment and 32 bit
environment?

thanks in advance
sushant
 
J

Joona I Palaste

sushant said:
my question is related with the address of a variable in C. suppose if
i am printing the address of a variable, so that address will be
virtual address or physical address. and why it'll be so?
is that has something to do with 16 bit environment and 32 bit
environment?

It is completely implementation-defined and outside the scope of the C
language standard. As far as the language goes, an address is an address
is an address.
 
L

Lawrence Kirby

hello,

my question is related with the address of a variable in C. suppose if
i am printing the address of a variable, so that address will be
virtual address or physical address. and why it'll be so?

It will be the address as the C program sees it. In a virtual memory
environmen that is likely to relate to a virtual address.
is that has something to do with 16 bit environment and 32 bit
environment?

Not really, no.

Lawrence
 
S

SM Ryan

(e-mail address removed) (sushant) wrote:
# hello,
#
# my question is related with the address of a variable in C. suppose if
# i am printing the address of a variable, so that address will be
# virtual address or physical address. and why it'll be so?

From the point of view of your program it doesn't matter if the addresses are
virtual or real; the hardware will handle all of that for you. If your system
does VM correctly the only visible sign could be real time delays between
some memory references due to page faults (or time slicing with other tasks).
 
B

Ben Pfaff

my question is related with the address of a variable in C. suppose if
i am printing the address of a variable, so that address will be
virtual address or physical address.

No, not necessarily.
 
E

E. Robert Tisdale

sushant said:
My question is related with the address of a variable in C.

If \I am print the address of a variable,
will that address be a virtual address or physical address?

Physical addresses are only visible in "supervisor" mode.
User application programs almost certainly print virtual addresses.
And why will it be so?

Does it have something to do
with 16 bit environment and 32 bit environment?

This is probably a reference
to "real" and "virtual" modes on x86 machines.

The original [16 bit] 8086 didn't implement virtual memory
so user application programs referenced (real) physical addresses.
The [32 bit] 80386 implemented virtual memory
but could be run in "real" mode to support [16 bit] legacy applications.
New [32 bit] applications were designed to run in virtual mode.
 
R

Randy Howard

Physical addresses are only visible in "supervisor" mode.
User application programs almost certainly print virtual addresses.

How do I get gcc -Wall -ansi -pedantic to generate code that will
use "supervisor mode" on my Ti MSP430? I checked the C spec
briefly and could not find a reference to "supervisor mode", could
you provide a reference?
 
E

E. Robert Tisdale

Randy said:
How do I get
gcc -Wall -ansi -pedantic
to generate code that will use "supervisor mode" on my Ti MSP430?
I checked the C spec briefly
and could not find a reference to "supervisor mode",
could you provide a reference?

I checked the MSP430x2xx Family User's Guide:

http://focus.ti.com/mcu/docs/techdocs.tsp?navSection=user_guides&templateId=5246&familyId=342

I don't think that
your machine has memory management or memory protection.

Apparently, it uses passwords to protect certain [flash] memory segments
(from accidental erasure).
It is always in "supervisor mode".
You can't and you don't need to do anything
to put your machine in "supervisor mode".

But, then, you already knew that didn't you?

Try the comp.dsp newsgroup if you need more details.
 
S

SM Ryan

# In article <[email protected]>,
# (e-mail address removed) says...
# > sushant wrote:
# >
# > > My question is related with the address of a variable in C.
# > >
# > > If \I am print the address of a variable,
# > > will that address be a virtual address or physical address?
# >
# > Physical addresses are only visible in "supervisor" mode.
# > User application programs almost certainly print virtual addresses.
#
# How do I get gcc -Wall -ansi -pedantic to generate code that will

I use
cc x.c
 
C

CBFalconer

Randy said:
(e-mail address removed) says...

How do I get gcc -Wall -ansi -pedantic to generate code that will
use "supervisor mode" on my Ti MSP430? I checked the C spec
briefly and could not find a reference to "supervisor mode", could
you provide a reference?

Trolls don't seem to recognize when they are the butt of gibes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top