CPUs
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsComputer HardwareCPUs

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 5th, 2007, 04:57 AM
rohan.francis rohan.francis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 7 rohan.francis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 46 m 57 sec
Reputation Power: 0
Send a message via Yahoo to rohan.francis Send a message via Google Talk to rohan.francis
HEADBANGING: Pointer Access

My doubt is concerning CPU and MMU interaction with OSes.

Code:
int main()
{
        int *p;
        printf("%x",(void* )p);
        sleep(10);
}


Try executing the code on two different PCs, you'll get a constatnt value for each system.

Since 386s use MMUs for logical address -> physical address translation, is it possible for the CPU to directly access actual physical addresses?

Can the OS or software access actual physical addresses bypassing the MMU?

Kindly help!

Rohan

Reply With Quote
  #2  
Old November 17th, 2007, 11:35 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)edman007 User rank is Lieutenant General (80000 - 90000 Reputation Level)  Folding Points: 68775 Folding Title: Intermediate FolderFolding Points: 68775 Folding Title: Intermediate FolderFolding Points: 68775 Folding Title: Intermediate FolderFolding Points: 68775 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 5 h 12 m 24 sec
Reputation Power: 904
Send a message via AIM to edman007
your need to learn a bit more about memory on a computer, generally the kernel manages the physical RAM with the help of the MMU, the kernel tells the MMU what pages are for the user process then it loads the userspace app and the CPU lets the process run for a bit until something like an interrupt or an access to an unknown page occurs (the userspace process just sees the whole 4GB address space and accesses what it wants, if the CPU does not know about it triggers a page fault and tells the kernel)

what your seeing with your C code is virtual addresses, you probably have a similar architecture and kernel on both systems, that and the compiler used can determine the default value of a pointer (its undefined by C so never expect it to be a constant), the hardware address used is mapped with the help of the MMU to the virtual address the process sees

for accessing a hardware address directly you generally need to be running in kernel mode, though there are often ways to get the kernel to access the hardware address you want for you
__________________
Feed ME

Reply With Quote
Reply

Viewing: Dev Shed ForumsComputer HardwareCPUs > HEADBANGING: Pointer Access

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap