ARM Technical Support Knowledge Articles

PAG AND POF FROM POINTERS

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

I have a function that was initially written for the Tasking Compiler. This function uses specific Tasking extensions that are not available in the ANSI standard:

void TskInit (unsigned int *stk, void (*task) (void), void far *p)  {
  *stk-- = _sof(task);
  *stk-- = _seg(task);

  *stk-- = _pof(p);
  *stk-- = _pag(p);
}

ANSWER

You may convert:

The function below has exactly the same effect and does not need any non ANSI extensions:

void TskInit (unsigned int *stk, void (*task) (void), void far *p)  {
  *stk-- = (unsigned int) task;
  *stk-- = (unsigned int) ((unsigned long) task >> 16);

  *((void far **) stk) = p;
  stk -= 2;
}

Even better would be to define a struct that represents the stack layout of the Task Control Block. However this might be a bigger change in the system.

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-11-15 09:49:41

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential