Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-02-2005, 10:59 AM   #1
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 7
Posts: 1,015

Rep: Reputation: 35
assembly execve (syscall 11)

Using NASM assembly.
I am a bit confused about how I should use this.
I need to call an assembly routine from another assembly routine and pass one value at the same time. According to the manual:
eax: 11
ebx: pointer to null terminated string of program path & name
ecx: stgs (what is this?)
edx: ptr to zero terminated list of ptrs to <null> terminated environment strings

It looks like I don't need edx, should I set it to 0? Same about ecx?
Manual says: ..executed program inherits resources... does this mean memory or memory and data section?

I could try and see what happens but I think I'll probably save a lot of wasted time with your advices.

Any answer or hint most welcome.
Thank you for your help.
Old 07-03-2005, 04:22 AM   #2
Registered: Jun 2005
Posts: 75

Rep: Reputation: 15
I would've thought, going by the glibc prototype for execve, that ecx should contain a pointer to a null-terminated array of null-terminated strings of arguments, ie *argv[].

If edx (*envp[]) contains NULL, then the executed program will not inherit the environment, which may or may not be desirable.

Old 07-03-2005, 09:23 AM   #3
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 7
Posts: 1,015

Original Poster
Rep: Reputation: 35
Thanks to sind. I will try and report the results for anyone interested.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linux C syscall to get number of columns of current terminal? reishin Programming 4 07-15-2009 01:59 AM
what is difference between syscall of linux and Unix sdamo Linux - General 1 06-12-2005 01:07 AM
Linux syscall 11 (execve) Genjix Programming 1 12-29-2004 11:38 PM
Using execve() not working cxel91a Programming 3 09-03-2003 06:26 AM
fork() and execve() Alf829 Programming 3 08-02-2003 10:18 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration