# FreeBSD syscalls



## zero (Jun 12, 2010)

Hi,

I can't get an exit code like I want with the syscall exit.


```
__asm__ __volatile__ (
		"pushl $0x45;"
		"movl $0x01,%eax;"
		"int $0x80;"
)
```

It always return 0.
I'm running under FreeBSD i386 of course.


----------



## gall0ws (Jun 12, 2010)

It should be:


```
__asm__ __volatile__ (
        "pushl $0x45;"
        "movl $0x01,%eax;"
        "push %eax;"
        "int $0x80;"
);
```


----------



## zero (Jun 12, 2010)

Right, thanks you.


----------



## zero (Jul 31, 2010)

*getrlimit syscall problem*

Hello, I'm back with another question about getrlimit syscall. I can't get it works.
Here is my code:

```
.intel_syntax

.bss
.comm rlimit_t,16,8

[...]
push rlimit_t
push 0x02
mov eax, 0xc2
push eax
int 0x80
[...]
```

Looking at rlimit_t with gdb:

```
(gdb) disass _start
Dump of assembler code for function _start:
[...]
0x080482b3 <_start+55>:	pushl  0x80493a8
0x080482b9 <_start+61>:	push   $0x2
0x080482bb <_start+63>:	mov    $0xc2,%eax
0x080482c0 <_start+68>:	push   %eax
0x080482c1 <_start+69>:	int    $0x80
0x080482c3 <_start+71>:	nop
[...]
(gdb) break *0x080482c3
Breakpoint 2 at 0x80482c3
[...]
(gdb) c
Continuing.

Breakpoint 2, 0x080482c3 in _start ()
(gdb) x/2g 0x80493a8
0x80493a8 <rlimit_t>:	0x00000000000000bf	0x0000000000000000
```

So, what is wrong ?


----------

