linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to set up struct pt_regs in assembly?
@ 2003-08-22  0:24 dante
  2003-08-22  4:20 ` linuxassembly
  0 siblings, 1 reply; 2+ messages in thread
From: dante @ 2003-08-22  0:24 UTC (permalink / raw)
  To: linux-assembly


Hi everyone,

I'm having some problems writing the assembly code to set up the eax, 
ebx, ecx and edx registers for a int 0x80 call to sys_execve on 2.4 
kernels.  In C, the function is defined as int sys_execve(struct pt_regs 
regs) where struct pt_regs is defined in <asm/ptrace.h>.  I don't know 
what to put into eax-edx to get (struct pt_regs regs) right.

In 2.2 it was easy, you just did (in nasm):


; int sys_execve(const char *filename, char const argv[], char const envp[]
%macro execve 3     
        mov ebx,%1  ; ptr to null terminated string containing program
        mov ecx,%2  ; ptr to null terminated string of arguments
        mov edx,%3  ; ptr to null terminated string of environment
        mov eax,11
        int 0x80
%endmacro

global _start
section .data
        shell   db "/bin/sh",0
        nothing db 0

section .text
_start: execve shell, nothing, nothing



What is the equivalent for 2.4 kernels?

-------------------------------------------------------------------

Anthony G. Basile, Ph.D.
Director of Information Technology,
D'Youville College,
320 Porter Ave.
Buffalo NY, 14201

Work: (716) 881-8197 (voicemail)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-22  4:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-22  0:24 How to set up struct pt_regs in assembly? dante
2003-08-22  4:20 ` linuxassembly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).