[Openmcl-devel] is (pref *display* ...) supposed to work?
gb at clozure.com
Wed Dec 17 04:10:01 PST 2003
On Wed, 17 Dec 2003, Timothy MOORE wrote:
> I can send a more extensive bug report later, if needed. Briefly, I ran
> Xlib and the OpenGL header files through ffigen so I can do OpenGL
> programming via GLX, not Cocoa. I transliterated a sample program from
> "OpenGL Programming for the X Window System". I seem to be having
> trouble using pref with a macptr stored in a special variable. Is this
> supposed to work:
> 1 > *display*
> #<A Mac Pointer #x802600>
> 1 > (ccl:pref *display* :_<XP>riv<D>isplay.default_screen)
> Unhandled exception 11 at 0x011b91f0, context->regs at #xf0135648
> The address seems to be valid, etc.
PREF (and the underlying primitives) shouldn't care how the value
of its first argument is obtained (it's evaluated) and typechecks
(a little too often, in fact) to ensure that it's a MACPTR.
If you macroexpand the PREF form, it should return something like:
(ccl::%get-signed-long *display* (/ N 8))
where N is the bit offset of the "default_screen" field in an
_XPrivDisplay structure. There are a few dozen fields that
precede "default_screen" in an _XPrivDisplay, so N could/should
be in the high hundreds/low thousands and N/8 should be in the
high dozens/low hundreds somewhere.
If that looks reasonable and you reproduce the error, do an (R)
in the kernel debugger and note the value of the DAR register.
That's the memory address whose access caused the fault; it should
be N/8 bytes past the value of *display*. (If it isn't, we're
faulting for some other reason and will have to investigate
If we're faulting trying to access an int that's several dozen/
a few hundred bytes past the value of *display*, I'd be tempted
to question either the value of *display* or the legitimacy of
the _XPrivDisplay structure definition.
Can you do:
(ccl::%get-unsigned-byte *display* 0)
without faulting ?
If the DAR's "near" the value of *display*, is it on the same
(mmu) page ? This would be true if:
(= (ash (%ptr-to-int *display* -12) (ash DAR -12)))
e.g. if the upper 20 bits of those addresses were the same.
More information about the Openmcl-devel