radare2/libr/sysproxy/syscall.S
pancake c5303272d9 * Make r_cons independent from r_line
- r_cons_user_fgets() is a configurable function pointer
  - Simplify build
* Initial import of r_sysproxy
  - Directly copied from r1 (no api or anything working yet)
* R_APIze r_vm and r_print
* Make r_core_seek more consistent
* Move r_cons_progressbar() to r_print
* Rename visual 'x' -> 'w' (oops)
  - 'a' and 'w' are now compatible with cursor mode
* Implement r_sys_usleep() on w32 and fix r_sys_sleep()
2009-04-07 11:28:22 +00:00

68 lines
994 B
ArmAsm

.code32
.global process_syscall, len_shcode
# th0rpe - 08-27-2007
process_syscall:
#ifdef LISTENER_TCP
#include "listeners/lis_socket_tcp.S"
#else
/* for testing you must compile with 'test_srv.c' */
#include "listeners/getsock.S"
#endif
# save connection descriptor
pushl %ebx
# alloc space for syscalls packet
subl $2048, %esp
# write buffer address
write_buffer:
movl %esp, %ecx
movl %esp, (%ecx)
movl $4, %edx
movl %edx, %eax
int $0x80
read_request:
# read request
movl %esp, %ecx
movl $2048, %edx
movl $3, %eax
int $0x80
# check minimal length
cmpl $32,%eax
jl err_process
# exec syscall
popal
exec_syscall:
int $0x80
# restore stack pointer
subl $32, %esp
# save eax result
movl %eax, 28(%esp)
# write response
movl %esp, %ecx
movl $2048, %edx
# restore ebx register with connecion descriptor
movl 2048(%esp), %ebx
movl $4, %eax
int $0x80
jmp read_request
err_process:
movl $0xfc,%eax
int $0x80
len_shcode:
.long len_shcode - process_syscall