Go to Post Lucky breaks and trying to minimize failures or moments of retardedness are what these games are all about, like any sport. - Bill Gold [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #16   Spotlight this post!  
Unread 06-04-2011, 01:58
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: I Have A Question About Pointers

Quote:
Originally Posted by mikets View Post
In Intel processor architecture, there is the concept of real mode versus protected mode. But there is no such thing in PPC. In PPC, you probably mean kernel mode versus user mode. But that's entirely different thing. For historic reason, Intel processor boots up into real mode where it uses real mode address space seg : offset to form a 20-bit physical address. That will allow you to access only the low 1 Mbyte of memory. PC BIOS runs in this environment and loads the OS loader into memory (Actually much more complicated than that, but this is the simplified view). The OS loader will then set things up and switch the CPU to go into protected mode. The setup includes setting up the virtual memory address tables GDT, LDT and the interrupt table IDT. So once the OS is booted, the CPU is already in protected mode. Everything including both the OS kernel and applications are run in protected mode. However, in protected mode, there are different privileges. Again, for historic reason, Intel processor supports 4 different privileges (rings). But most of the operating systems support only 2 privileges and they are usuually called kernel mode or superviser mode and user mode. Applications are run in user mode and OS kernel, device drivers are usually run in superviser mode.
I am not very familiar with vxWorks but I believe your program is actually compiled as a downloadable kernel module. So I assume it must be running in kernel mode as well which means your program can misbehave and kill the entire system if you are not careful (e.g. run away pointers). BTW, you can do pointer arithmetics in C/C++. There is no need to do that in assembly. But if you are not careful, you can trash memory. For vxWork, you can probably trash kernel mode memory as well and cause a system crash. For Windows application, for example, a run away pointer can only trash application memory. Kernel mode memory is protected from applications. So your application may crash but the OS will be fine. You can just kill the app and move on. However, for Windows kernel mode drivers, they have privilege to access kernel mode memroy. If they have a run away pointer, they could trash kernel mode memory and bring the system down (Blue-Screen aka BugCheck).
Actually it might be in kernel mode. That explains why vXWorks does not have a system call system. You just go do it for yourself, there is no asking for the OS to do it for you.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
 


Thread Tools
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
Forum Jump


All times are GMT -5. The time now is 14:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi