What does this cast do?

R

robert

Hi all, allow the code to explain:

*((volatile unsigned char *) 0xe00e0f3c) = 0x00800000;

If curious, this code is in local_bus_init() , in the u-boot
bootloader for linux for a ppc proccessor.

Robert
 
C

Chris Dollin

robert said:
Hi all, allow the code to explain:

*((volatile unsigned char *) 0xe00e0f3c) = 0x00800000;

If curious, this code is in local_bus_init() , in the u-boot
bootloader for linux for a ppc proccessor.

This is a non-Standard piece of code using implementation-defined
cast magic to convert an integer (fx:OT which /probably/ expresses an
address in some piece of Linux ppc kernel address space) to a
pointer-to-volatile-unsigned-char, and then stores an integer
value almost certainly too big to be represented by an unsigned
char -- I'd expect it to be truncated to zero -- into that location.

It's magic. For what it really does, you'd have to ask in a more
specific newsgroup. Or perhaps in a PPC manual.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top