patching - VxWorks
This is a discussion on patching - VxWorks ; Hi,
I am planning to have patching functionalty for my router (processor
MPC 604) running vxWorks 5.1.
What I want is that suppose I modify a file a.c and load it using
a.o(using ld command) I should be able to ...
-
patching
Hi,
I am planning to have patching functionalty for my router (processor
MPC 604) running vxWorks 5.1.
What I want is that suppose I modify a file a.c and load it using
a.o(using ld command) I should be able to get the new functionality.
For ex: Say my old function was
void creatvlan() {
....
.....
}
Now I modify this function to
void creatvlan_new() {
printf("Function name...\n");
....
...
}
Now any function which was calling creatVlan() should call/jump to
creatvlan_new().
I tried few things, but was not successful. So need help here:
1. I compiled the code with "mlongcall" option. So I could
successfully load a.o using ld command.
2. But after using -mlongcall option, all "bl" instructions were
modified to "blrl" instructions.
3. The strategy that I planned was, I would modify the first
instruction of original function call with branch instruction to new
function. So whenever someone calls the old function, it will actually
jump to address of new function and therefore execute the new
function.
4. But with "blrl" instruction, I couldn't do this as it probably uses
LR register to jump.
I couldn't figure out how/what to modify so that all calls to old
function takes it to new function.
Please help me on this.
Thanks,
Dutta
-
Re: patching
On 12 sep, 13:31, bapan wrote:
> Hi,
>
> I am planning to have patching functionalty for my router (processor
> MPC 604) running vxWorks 5.1.
> What I want is that suppose I modify a file a.c and load it using
> a.o(using ld command) I should be able to get the new functionality.
> For ex: Say my old function was
> void creatvlan() {
> ...
> ....
>
> }
>
> Now I modify this function to
> void creatvlan_new() {
> printf("Function name...\n");
>
> ...
> ..
>
> }
>
> Now any function which was calling creatVlan() should call/jump to
> creatvlan_new().
>
> I tried few things, but was not successful. So need help here:
> 1. I compiled the code with "mlongcall" option. So I could
> successfully load a.o using ld command.
> 2. But after using -mlongcall option, all "bl" instructions were
> modified to "blrl" instructions.
> 3. The strategy that I planned was, I would modify the first
> instruction of original function call with branch instruction to new
> function. So whenever someone calls the old function, it will actually
> jump to address of new function and therefore execute the new
> function.
> 4. But with "blrl" instruction, I couldn't do this as it probably uses
> LR register to jump.
>
> I couldn't figure out how/what to modify so that all calls to old
> function takes it to new function.
> Please help me on this.
>
> Thanks,
> Dutta
Hi,
You can easily search all symbol tables for specific symbols:
http://www-sgc.colorado.edu/~dixonc/...ef/symLib.html
Just look for creatvlan() symbol and wrap it with your
creatvlan_new(), it's a suggestion, I may be misunderstanding the.
--
Tarek