473,396 Members | 1,975 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.

virtual address or physical address?

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
Nov 14 '05 #1
9 3589
sushant <th********@rediffmail.com> scribbled the following:
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?


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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"To know me IS to love me."
- JIPsoft
Nov 14 '05 #2
On Thu, 17 Feb 2005 22:21:11 -0800, 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?
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
Nov 14 '05 #3
th********@rediffmail.com (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).

--
SM Ryan http://www.rawbw.com/~wyrmwif/
Who's leading this mob?
Nov 14 '05 #4
th********@rediffmail.com (sushant) writes:
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.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Nov 14 '05 #5
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.
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.
Nov 14 '05 #6
In article <cv**********@nntp1.jpl.nasa.gov>,
E.**************@jpl.nasa.gov 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
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?

--
Randy Howard (2reply remove FOOBAR)
"Making it hard to do stupid things often makes it hard
to do smart ones too." -- Andrew Koenig
Nov 14 '05 #7
Randy Howard wrote:
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/techdoc...6&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.
Nov 14 '05 #8
Randy Howard <ra*********@FOOverizonBAR.net> wrote:
# In article <cv**********@nntp1.jpl.nasa.gov>,
# E.**************@jpl.nasa.gov 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

--
SM Ryan http://www.rawbw.com/~wyrmwif/
You face forward, or you face the possibility of shock and damage.
Nov 14 '05 #9
Randy Howard wrote:
E.**************@jpl.nasa.gov 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
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.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #10

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

Similar topics

4
by: | last post by:
Is it possible to include my remote web server path eg: m:/html/root/site1 | m:/html/root/site2 etc ....in virtual includes.... Thus eliminating the need to create duplicate INC files in each...
3
by: Krishna Sagiraju | last post by:
hai, can we convert virtual address to physical address using c/c++ ? thanx Krishna
8
by: And | last post by:
Hi everyone my database is in a folder inside the inetpub folder (c:\inetpub\bd\mydatabase.mdb) and my web application is in a folder inside the wwwroot folder. My question is: Is there a way...
4
by: david | last post by:
I basically use the following code to display the directory and file names in the WWWROOT, but can not show the virtual directory. ---- Dim path As String = Server.MapPath(x) Dim di As...
16
by: B Letts | last post by:
Hi - I'm currently using the FileUpload control to allow people to upload files to my website. This all works fine, as long as I'm going to a physical path on my server. However, I need to...
3
by: Dhruba Bandopadhyay | last post by:
In classic ASP I could write: <!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" --> and it would "include" that ASP file into the current ASP file. My web application folder was not...
14
by: Lorenzo | last post by:
Hello, I have a web application with a virtual directory in it. With 'virtual directory' i mean a folder whose physical path is different from the physical path of the application, but in which...
1
by: =?Utf-8?B?QiBTaW5naA==?= | last post by:
Hi Scenario 1) Host - XP Laptop with internet connection using Sky Broadband Wireless Router Netgear DG834GT 2) MS Virtual Server 2005 - I have deployed an XP MS Virtual Server 2005 to act...
4
by: Paul F | last post by:
Im confused about the difference(s) between virtual directories and physical directories in IIS. Any ideas? *** Sent via Developersdex http://www.developersdex.com ***
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
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
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.