Anyone working on BSP for PPC (Sandpoint)

bridged with qdn.public.bsp
Brian Stecher

Re: Anyone working on BSP for PPC (Sandpoint)

Post by Brian Stecher » Tue Nov 19, 2002 3:59 pm

A K <nospam@nospam.net> wrote:
Is there anywhere in QNX documentation where the specifics of register
allocation for callouts and other BSP specifics are kept?
For the routines that are called normally, the standard ABI calling
conventions are followed (whatever gcc does). For the callouts that are
copied and used inline (interrupt_id & interrupt_eoi), the register
conventions are described at the top of the callout_interrupt_*.[sS] files
in the startup library.


--
Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

Chris Hallinan

Re: Anyone working on BSP for PPC (Sandpoint)

Post by Chris Hallinan » Tue Nov 19, 2002 5:21 pm

Be careful: The callouts use a prolog specific to the procnto kernel,
and while it appears the register usage conforms to the ABI, the calling
convention does not. If you examine the macro's in callout.ah, you will
see the actual label that is exported as global cannot be executed, i.e.
you cannot just call an assembler callout routine directly. They each
have storage allocated just after the exported function label, and
execution directly from this address will cause a program exception. I
know, I found that out the hard way.

On that note, does anyone have a good suggestion for how I can obtain
the address for these routines after the kernel has copied them so I can
use my JTAG debugger and step through the assembly code? I haven't
found a good way to step through this code yet, (that's why I tried to
call the routines directly from my startup code, for debugging purposes
only, and found out that you can't do that!)

-Chris Hallinan

Brian Stecher wrote:
A K <nospam@nospam.net> wrote:

Is there anywhere in QNX documentation where the specifics of register
allocation for callouts and other BSP specifics are kept?


For the routines that are called normally, the standard ABI calling
conventions are followed (whatever gcc does). For the callouts that are
copied and used inline (interrupt_id & interrupt_eoi), the register
conventions are described at the top of the callout_interrupt_*.[sS] files
in the startup library.

Brian Stecher

Re: Anyone working on BSP for PPC (Sandpoint)

Post by Brian Stecher » Tue Nov 19, 2002 5:37 pm

Chris Hallinan <clh@net1plus.com> wrote:
Be careful: The callouts use a prolog specific to the procnto kernel,
and while it appears the register usage conforms to the ABI, the calling
convention does not. If you examine the macro's in callout.ah, you will
see the actual label that is exported as global cannot be executed, i.e.
you cannot just call an assembler callout routine directly. They each
have storage allocated just after the exported function label, and
execution directly from this address will cause a program exception. I
know, I found that out the hard way.
They're designed for use in the kernel environment (e.g. they pretty
well all get passed a syspage pointer), so they can't really be called
directly from startup (since you're in the process of building
the system page). The extra data you saw in callout.ah is used
when the startup library copies the code from their linked location
to the system page and is not present in the version that actually gets
used.
On that note, does anyone have a good suggestion for how I can obtain
the address for these routines after the kernel has copied them so I can
use my JTAG debugger and step through the assembly code? I haven't
found a good way to step through this code yet, (that's why I tried to
call the routines directly from my startup code, for debugging purposes
only, and found out that you can't do that!)
The routine locations are all listed in various system page sections,
(e.g. the cache control routines are in the cacheattr section). Cranking
up the -v's on the startup command line and having the print_syspage()
routine at the end of main() will get all of them printed out.

To step through a routine what we usually do is add a breakpoint opcode
to the start of a routine and when that gets hit, start single stepping.

--
Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

Post Reply

Return to “qdn.public.bsp”