[futurebasic] Re: More Nav Services

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: Joe <locality@...>
Date: Wed, 7 Oct 1998 19:27:57 -0400
>FindSymbol returns the address of a link record. The first 4 bytes of the 
>link record point to the executable. The second 4 bytes are a "table of 
>contents pointer." This is roughly equivalent to the A5 world under the 
>classic 68k architecture.

Okay, I've looked at this some more... I couldn't find any information on 
link records anywhere, but I looked at what it points to and there are 
two valid addresses, it's looking like this: (SymAddr = 5A6BAE8)

DM 5A6BAE8

5A6BAE8: 0743 1034  05A6 B9C0  etc...

Now I've disassembled from 7431034 and 5A6B9C0 with IL and ILP, but 
neither address contains 68K or PPC code that makes any sense. The 68K 
disassemblies are full of weird looking stuff and lots of ORI.B's. The 
PPC disassembly is just a bunch of dc.l's. Then I thought that they might 
be handles so I disassembled what they pointed to, but it was the same story.

Here's the assembly I've worked up so far:

  RoutPtr& = gNavLoadUPP&

  '---> Debugger
  ` _debugger                   ;Watch me in MacsBug
  '---> Swap A5
  ` MOVE.L A5,-(SP)             ;Remember A5
  ` MOVE.L ^ProcPtr&,A0         ;Load procedure address into A0
  ` ADD.L #4,A0                 ;Add four to it.
  ` MOVE.L (A0),A5              ;Get correct A5 from link record.
  '---> Call Routine
  ` MOVE.L ^RoutPtr&,A1         ;Load address of routine into A1
  ` CLR.W -(SP)                 ;Clear a word for a result code on stack
  ` JSR (A1)                    ;Call UPP. MIXED MODE MAGIC
  ` MOVE.W (SP)+,D0             ;Pop result code off stack and into D0
  ` EXT.L D0                    ;Sign extend D0 for FB
  '---> Restore A5
  ` MOVE.L (SP)+,A5             ;Restore A5

I added the code to save and restore the A5, I'm still not sure wether 
the mixed mode manager does this for me or not. I know I have to call the 
UPP, because that has the Mixed Mode Magic Trap AAFE or some such 
nonsense to drop out of the 68K emulator. I've seen that in action... am 
I passing the wrong thing stuff to the UPP creating routines? (Code Follows)

CLEAR LOCAL
LOCAL FN SymLookup (ConnID&,SymName$)
  '---> Variables
  DIM SymAddr&,SymClass&
  '---> Get the calling address (entry point) of the symbol
  FN FindSymbol (ConnID&,SymName$,SymAddr&,SymClass&)
END FN = SymAddr&

CLEAR LOCAL
LOCAL FN SymUPP (ConnID&,SymName$,SymProcInfo&)
  '---> Variables
  DIM SymAddr&,SymUPP&
  '---> Lookup Symbol
  SymAddr& = FN SymLookup (ConnID&,SymName$)
  '---> Build UPP
  SymUPP& = FN NewDescTrap (SymAddr&,SymProcInfo&,FN GetISA)
END FN = SymUPP&

I apologize for the long post, but I'm stuck here and I didn't want to be vague.


Joe K.