In article <62*************************@posting.google.com> ,
lb****@yahoo.com (LBJ) writes:
lets say i have the following definition:
volatile char* p = 0x0a0a0a;
Let's assume that you have the necessary cast as well.
lets say p now points directly to cacheable memory, and lets also
say that this memory is currently cached. when p is accessed, will the
cache be hit, or will the program actually go out to DRAM (due to the
volatile qualifier)?
Neither. Your program will stop with a program check condition, and
a message will be sent to the user message queue (or job message
queue, if it's running in a non-interactive subsystem) noting the
error. If the message queue is in auto-answer mode, the program will
be cancelled and its spool file will contain a description of the
failure; otherwise, it will wait for a reply to the message. Typically
you will have the option of cancelling the program, debugging it, or
ignoring the program check - but in the last case you'll simply get
an immediate machine check which will only let you cancel the
program, IIRC.
Of course I'm assuming that you're using one of the conforming C
implementations for OS/400 V3R7, as is often[1] the case. Other
implementations may behave differently.
In OS/400 V3, and in later versions of OS/400 except for certain
special cases,[2] the implementation always produces a trap repre-
sentation when converting from an integer to a pointer. That's a
specific, real-world example of a conforming C implementation where
you cannot cast an integer to a pointer and successfully dereference
the latter.
As for your question regarding the "volatile" qualifier: the C
standard actually makes very few guarantees about volatile, and its
behavior is almost entirely a Quality of Implementation issue. So
you'll have to ask whoever wrote your compiler.
[1] Under certain other assumptions we need not go into here.
[2] The exceptions are the Licensed Internal Code, which forms the
lowest level of the OS; and the PASE environment, which was created
to support ill-behaved C programs. PASE gives the executing program
a one-TB memory object as its "address space", in which it is free
to muck about as it likes.
--
Michael Wojcik
mi************@microfocus.com
"Well, we're not getting a girl," said Marilla, as if poisoning wells were
a purely feminine accomplishment and not to be dreaded in the case of a boy.
-- L. M. Montgomery, _Anne of Green Gables_