Does the 'write' linux system call require kernel mode?
I get a Permission denied problem with :
...section .rodata
...l1:
...string "some text"
...text
main:
mov $0x4,%eax ;system call 4 - write
mov $0x1,%ebx ;write 1st arg, write to stdout (file descriptor 1)
mov $.l1,%ecx ;write 2nd arg, pass "some text"
mov $0x9,%edx ;write 3rd arg, pass length of 9
int $0x80 ;make a system call
ret
Thanks.
--
Raymond.
|
|
0
|
|
|
|
Reply
|
Raymond
|
4/23/2004 11:10:02 AM |
|
Raymond Martin wrote:
> I get a Permission denied problem with :
>
> ..section .rodata
> ..l1:
> ..string "some text"
>
> ..text
> main:
> mov $0x4,%eax ;system call 4 - write
> mov $0x1,%ebx ;write 1st arg, write to stdout (file descriptor 1)
> mov $.l1,%ecx ;write 2nd arg, pass "some text"
> mov $0x9,%edx ;write 3rd arg, pass length of 9
> int $0x80 ;make a system call
> ret
The code below works for me.
$ cat hello.s
..globl _start
..text
_start:
mov $4,%eax
mov $1,%ebx
mov $buf,%ecx
mov $6,%edx
int $0x80
mov $1,%eax
xor %ebx,%ebx
int $0x80
..data
buf: .string "Hello\n"
$ as hello.s -o hello.o ; ld hello.o
$ ./a.out
Hello
|
|
0
|
|
|
|
Reply
|
Grumble
|
4/23/2004 1:09:41 PM
|
|
> The code below works for me.
>
> $ cat hello.s
> .globl _start
>
> .text
> _start:
> mov $4,%eax
> mov $1,%ebx
> mov $buf,%ecx
> mov $6,%edx
> int $0x80
>
> mov $1,%eax
> xor %ebx,%ebx
> int $0x80
>
> .data
> buf: .string "Hello\n"
>
> $ as hello.s -o hello.o ; ld hello.o
>
> $ ./a.out
> Hello
>
Just getting familiar with assembly, I forgot to link it :P
thanks though.
|
|
0
|
|
|
|
Reply
|
Raymond
|
4/30/2004 7:06:40 AM
|
|
|
2 Replies
334 Views
(page loaded in 0.038 seconds)
Similiar Articles: write system call - comp.lang.asm.x86Does the 'write' linux system call require kernel mode? I get a Permission denied problem with : ...section .rodata ...l1: ...string "some text" .... how to get the output of call system in a variable - comp.lang ...Hi Can anyone tell how to capture the output of "call system" in a variable other than writing into a file and reading? TIA -preeti ... System-API to get current process memory usage for C/C++ pgm ...write system call - comp.lang.asm.x86 System-API to get current process memory usage for C/C++ pgm ..... calls exist to get the current process' system memory usage ... C.Net Assembly interface and Methods - comp.soft-sys.matlab ...I am unable to call the methods (most likely not doing the write thing). I hope someone can help. ... write system call - comp.lang.asm.x86... xor %ebx,%ebx > int $0x80 ... intercepting system calls in kernel 2.6.x - comp.unix.programmer ...write system call - comp.lang.asm.x86 Does the 'write' linux system call require kernel mode? I get a Permission denied problem with : ...section .rodata ...l1: ...string ... system() call on linux causes errno set to SIGCHLD - comp.unix ...Hello NG, I have a CGI application running under apache 2.0.46 on a RedHat Enterprise Linux 3 WS. This application calls another application via system call. Function : Output argument "out" (and maybe others) not assigned ...write system call - comp.lang.asm.x86... hello.o ; ld hello.o $ ./a.out ... and I am using the Newton ... Output argument "r" (and maybe others) not assigned during call ... Get list of computers in workgroup using C? - comp.os.ms-windows ...Hoping for help! I have a leagacy C program (not .net), which is currently sending "net view" via a system() call, writing to a file, then reading... Write to stderr? - comp.lang.rexxwrite system call - comp.lang.asm.x86... problem with : ...section .rodata ...l1: ...string "some text" ...text main: mov $0x4,%eax ;system call 4 - write mov $0x1,%ebx ... ASA Phone Proxy and conference calls - comp.dcom.sys.cisco ...TCP MSS issue - comp.unix.programmer... means "sends the data when the write() system call makes ... TCP stack, writing an invasive TCP packet proxy ... write (system call) - Wikipedia, the free encyclopediaThe write system call is one of the most basic routines provided by the kernel. It writes data, in bytes as specified by the caller, from a buffer declared by the ... write (C System Call) - Code WikiUnless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License 7/24/2012 4:52:37 PM
|