Hello Akshatha,
If you don't find a better solution, you could have an uint64_t
parameter in your function and pass a casted pointer as argument.
Inside the function it can be treated as a pointer. Something like
this:
// $ gcc -Wextra -g -O0 pointer.c -o pointer// $ ./pointer
#include <stdio.h>#include <stdint.h>
void foo(uint64_t p){   const size_t max_size = 32;     char
*str = strndup((char *)p, max_size);    printf("(%s, %s) p:
0x%llx\n", __FILE__, __func__, p);      printf("string: %s\n", (char
*)p);   printf("string: %s\n", str);    free(str);}
int main(int argc, const char *argv[]){ uint8_t array[64] =
"Greetings!";   void *p = array;        printf("(%s, %s) p: %p\n",
__FILE__, __func__, p); foo((uint64_t)p);       return 0;}
Hope it helps.
Regards,Éder

On Mon, 2019-02-25 at 16:16 +0000, Mangala Kenche Gowda, Akshatha
wrote:
> Hello guys,
> 
> 
> 
> I have added a new pseudo instruction in gem5 codebase and now I need
> to pass pointer value as a parameter for this pseudo instruction.
> 
> 
> 
> Currently I can pass only integer values as the function parameter
> and the passing pointer causes errors.
> Please let me know if anybody has any idea / worked on it.
> 
> 
> 
> Example:
> 
> 
> 
> 
> uint64_t readfile(ThreadContext *tc, Addr vaddr, uint64_t len,
> uint64_t offset)
> {
> ......
> .....
> }
> 
> 
> 
> 
> I would like to do something like:
> 
> 
> 
> 
> 
> uint64_t new_op(ThreadContext *tc, uint64_t* abc, uint64_t* xyz)
> 
> {
> 
> ......
> 
> .....
> }
> 
> 
> 
> 
> 
> Any help is appreciated.
> 
> 
> 
> 
> 
> Thanks and regards,
> Akshatha
> 
> 
> 
> 
> 
> 
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to