Solved

PowerPC Assembler

Posted on 1997-01-05
1
1,540 Views
Last Modified: 2013-12-26

I am trying to inline PPC assembler with Codewarrior 10 - but not the way it's normally done with CodeWarrior (without a function call if possible) and cannot figure out how to do it  Specifically, in the 68k world, I can use the following with no problems:

#pragma parameter SwitchStack(__A0)
extern void SwitchStack(SR *sr) =
{
    0x2178, 0x0BAE, 0x0010,
    .
    .
    .
    0x2E68, 0x0004
};

The call to SwitchStack is placed in my code and I switch stacks.  Later I restore my stack with another inline assembler routine.  I found the basis for this routine for the 68k on AppleLink years ago. The "classic" way to
inline code messes up the link register.  Is there an equivalent SwitchStack routine for the PowerPC that matches what the switch stack for the 68k does?

Thanks for your help,

Charles Copeland
Useful Software, Inc.

0
Comment
Question by:charles122996
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
gregj earned 200 total points
ID: 1291400
CodeWarrior doesn't support what you are trying to do. The opcode inline style function is not supported by the PowerPC C or C++ compilers. And the PowerPC compilers don't allow you to specify which registers are used for parameters. See "Inside CodeWarrior 10," CL-38.

The PowerPC compilers do support inlined asm functions, but because they are real functions the compiler will determine register usage, and the link register is set before your code is entered. This is implied by the requirement documented on page CL-112 that every PowerPC assembly function must end in a "blr" instruction.

Even if all of these obstacles could be overcome somehow, the PowerPC optimizer would likely confound all of your efforts, and you'd have to make a lot of assumptions about what the compiler and optimizer will do.

Metrowerks has said publicly that they don't intend to support inlined blocks of assembly code in either the 68K or PowerPC compilers.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question