Skip to main content

question about CVMJniInvokenative

2 replies [Last post]
lookyi
Offline
Joined: 2007-02-11
Points: 0

hello,everyone!
i was porting cdc to my set-top-box, it's a project of this term. These days i'm trying to realization of CVMJniInvokenative function, SUN achieve the function using AT&T assembly, now i need to rewrite it using my STB assembly, and the problem is how can i call the native function in my assembly.
/* provided by SUN */
CVMjniInvokeNative(void * env, void * nativeCode, CVMUint32 * args,
        CVMUint32 * terseSig, CVMInt32 argsSize, void * classObject,
          CVMJNIReturnValue * returnValue)

  {
................
 args_done:
    call *12(%ebp)   # f
................
   }

what i can use is "fcall LABLE", fcall a label and a absolute address(i.g. fcall 0xc1222222) are both OK, but how can i call "void * nativeCode".
Waiting for your reply, thanks sincerely.

look yi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mlam
Offline
Joined: 2006-10-13
Points: 0

Look Yi,
I don't know your CPU instruction set, and therefore won't be able to give you a specific solution. The line you are interested in is doing an indirect call. There must be some way to achieve this on your target device. The example of your fcall that you have given is for the direct call case and is not necessarily applicable.

Here's one way you can find out how your CPU does indirect calls:
1. Write a C program that calls a function by dereferencing a pointer.
2. Compile that program to assembly and see what instructions are used for that call.

Good luck.

Mark

lookyi
Offline
Joined: 2007-02-11
Points: 0

Mark, thank you for your reply. I will try as you instructed. Maybe i need to use jump or something like that to replace fcall, thanks again.