[comp.sys.mac.programmer] GWorld calls

biehl@dynamo.ecn.purdue.edu (Larry L Biehl) (06/03/91)

I have been trying to use the GWorld calls in 32-bit quickdraw for offscreen 
bitmap/pixmaps to access memory on a RastorOps accelerator card. The 
address for this memory is greater than a 24 bit address. The information 
that I have is that I need to use 'SwapMMUMode' to transfer between 24 bit
and 32 bit address mode to access memory in one of the slots. Attempting 
to do this crashes my machine. I have tried it on a IIx and a IIfx. The machine 
locks up when SwapMMUMode is called; it appears that the system 
stack overflows.

I have tried it both with and without the suggestion made in Technical 
Note 228 with no success.  Does anyone know what I am doing wrong?
 
Larry Biehl
Purdue University
  

russotto@eng.umd.edu (Matthew T. Russotto) (06/03/91)

In article <1991Jun3.135057.4734@noose.ecn.purdue.edu> biehl@dynamo.ecn.purdue.edu (Larry L Biehl) writes:

>I have tried it both with and without the suggestion made in Technical 
>Note 228 with no success.  Does anyone know what I am doing wrong?
> 
>Larry Biehl
>Purdue University

I take it TN228 is where it warns you that the program counter might have
garbage in the upper 8 bits.  Have you checked if A7 has garbage in the upper
8 bits?
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
     .sig under construction, like the rest of this campus.

paul@taniwha.UUCP (Paul Campbell) (06/05/91)

In article <1991Jun3.135057.4734@noose.ecn.purdue.edu> biehl@dynamo.ecn.purdue.edu (Larry L Biehl) writes:
>I have been trying to use the GWorld calls in 32-bit quickdraw for offscreen 
>bitmap/pixmaps to access memory on a RastorOps accelerator card. The 
>address for this memory is greater than a 24 bit address. The information 
>that I have is that I need to use 'SwapMMUMode' to transfer between 24 bit
>and 32 bit address mode to access memory in one of the slots. Attempting 
>to do this crashes my machine. I have tried it on a IIx and a IIfx. The machine 
>locks up when SwapMMUMode is called; it appears that the system 
>stack overflows.

Number one thing to do is to make sure that your PC prior to making the
SwapMMUMode trap doesn't have any bits set in it's high byte, if it does then
execute something like:


	lea	L1, a0
	_StripAddress
	jmp	(a0)
L1:	move.l	#1, d0
	_SwapMMUMode
	move.l	d0, -(sp)
	....
	mung with pixmap
	....
	move.l	(sp)+, d0
	_SwapMMUMode

Don't try and use the debugger to single step through SwapMMUMode you
will crash even if you are doing everything correctly (taking traps,
even trace traps, while in the middle of MMU manipulation is a non-no in
most OSs/processors).

Also make sure that ALL the code you will execute in 32-bit mode is 32-bit
clean, don't indirect through handles unless you use StripAddress on them,
don't use toolbox calls that might do the same, if you do the above code
in a subroutine make sure that it's return address also has the upper byte
clear etc etc

	Paul
	
-- 
Paul Campbell    UUCP: ..!mtxinu!taniwha!paul     AppleLink: CAMPBELL.P

My son is now 2 months old, in that time he has doubled his weight,
if he does this every 2 months for the next year he will weigh over 300lbs.