Re: __NR_mmap2 in FreeBSD

2012-04-19 Thread Maninya M
Oh and here is the code that worked. Thanks! :) void map_memory(unsigned long addr, unsigned long size, int flags) { int status; char cmd[200]; struct reg regs,temp_regs; unsigned int int_instr = 0x80cd; /* INT 0x80 */ unsigned int push_eax= 0x0050; unsigned int orig_instr; s

Re: __NR_mmap2 in FreeBSD

2012-04-19 Thread Maninya M
Hello :) After a long time trying different combinations of setting register values, I was finally able to allocate memory to the process. It doesn't seem to work for processes that use malloc(), so that's why I was getting a problem. Thank you very much John Baldwin and Julian Elischer, and to al

Re: __NR_mmap2 in FreeBSD

2012-04-02 Thread John Baldwin
On Saturday, March 31, 2012 5:40:50 pm Maninya M wrote: > Thanks. > > I've tried this. Still getting some allocation problems. > > if (temp_regs.r_eax != addr) > warn("Wanted space at address 0x%.8x, mmap2 system call returned > 0x%.8x. This could be a problem.",addr,temp_regs.r_eax); > > Wh

Re: __NR_mmap2 in FreeBSD

2012-03-31 Thread Maninya M
Thanks. I've tried this. Still getting some allocation problems. if (temp_regs.r_eax != addr) warn("Wanted space at address 0x%.8x, mmap2 system call returned 0x%.8x. This could be a problem.",addr,temp_regs.r_eax); What can I do? Please help. void map_memory(unsigned long addr, unsigned

Re: __NR_mmap2 in FreeBSD

2012-03-29 Thread John Baldwin
On Thursday, March 29, 2012 9:15:43 am Maninya M wrote: > Thanks a lot for replying! > Ok I've tried this to push arguments onto stack. > Is it right? > I get an error at this line: > >die_perror("ptrace(PT_WRITE,%d,0x%.8x,INT 0x80) failed while > dasfallocating memory",exec_pid,temp_regs.r_ei

Re: __NR_mmap2 in FreeBSD

2012-03-29 Thread Maninya M
Thanks a lot for replying! Ok I've tried this to push arguments onto stack. Is it right? I get an error at this line: die_perror("ptrace(PT_WRITE,%d,0x%.8x,INT 0x80) failed while dasfallocating memory",exec_pid,temp_regs.r_eip); Please tell me what to do. void map_memory(unsigned long ad

Re: __NR_mmap2 in FreeBSD

2012-03-27 Thread John Baldwin
On Monday, March 26, 2012 1:56:08 pm Maninya M wrote: > I am trying to convert a function written for Linux to FreeBSD. > What is the equivalent of the __NR_mmap2 system call in FreeBSD? > > I keep getting the error because of this exception: > warn("Wanted space at address 0x%.8x, mmap2 system ca

__NR_mmap2 in FreeBSD

2012-03-26 Thread Maninya M
I am trying to convert a function written for Linux to FreeBSD. What is the equivalent of the __NR_mmap2 system call in FreeBSD? I keep getting the error because of this exception: warn("Wanted space at address 0x%.8x, mmap2 system call returned 0x%.8x. This could be a problem.",addr,temp_regs.eax