is there a way to get the start address and code length of a function? I need them in my prog.
thanks, karah
It's needed by my cache algorithm.
... on a '51 ? That must be a curious derivative indeed.
You can get the entry points of functions through function pointers, but that will mean opening a fairly nasty can of worms on a '51.
There is no really pratical way to get the functions end address during run-time.
hi Christoph, Just as you said,You can get the entry points of functions through function pointers. I have tried in this way, but I can only get the item addresss in calltable.
unsigned char * pCode = Func; void Func() { ... }
we got: pCode = C:0xecfa
in map file:
INTERBANK CALL TABLE OF MODULE: ADDRESS FUNCTION NAME ---------------------- ... C:00ECFA Func ... PUBLIC SYMBOLS OF MODULE: VALUE CLASS TYPE PUBLIC SYMBOL NAME --------------------------------------------- ... 00889CAC CODE/B8 --- Func ...
Karah
I have tried in this way, but I can only get the item addresss in calltable.
So you are using code banking ? In that case, the can of worms mentioned just got a whole lot nastier.
You could, of course, rip the functions start address out of the call table. There has to be a call to the appropriate address in there.
The question still is - what are you trying to accomplish ? The '51 architecture does not lend itself too well to doing things like virtual memory. If you are trying to relocate functions to a different address, all non-relative jumps will end up at some meaningless address - instant crash.