Re: INT 80H

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



just to side-track a little.
is it ok to program in this way?
suppose i have a routine call write2() that has the
same arguments as write(). i call write2() in a c program,
and i write a separate implementation of write2 in a .s file.
is it ok to pop the eip address, pop the 3 arguments from the
stack and store them accordingly to ebx, ecx, edx, and then call
sys_write? i managed to run it on my pc. but when i tried running
it on another pc of similar configurations (pentium 166 running redhat),
it ran well, but with a segfault.

please advise.

<quote who="SACHIN PRASAD">
> 
> 
> Iknow that this is little OT , but i guess this is the best place where i 
> 'll get the exact answer.
> 
> mov	eax,5		; the syscall number for open()
> 				; we already have the filename in ebx
> 
> mov	ecx,0		; O_RDONLY, defined in fcntl.h
> 
> int	80h		; call the kernel
> 
> Now my problem is how the system call 80h knows that only eax has the 
> required argument and the second argument is in ecx . Why not the first 
> argument in ecx register ?
> 
> thanks in advance
> sachin prasad
> 
> 
> 
> 
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE* 
> http://join.msn.com/?page=features/virus
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 

-- 
eMail: eugeneteo@eugeneteo.net, eugeneteo@null.cc.uic.edu
gpg pub_key: http://www.comp.nus.edu.sg/~teohanhu/eugeneteo.asc
main(i){putchar(182623909>>(i-1)*5&31|!!(i<7)<<6)&&main(++i);}

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux