[EMAIL PROTECTED] said this stuff:

> Finally I came up with the simplest ASM program that reproduces the error.
> Here it is:
> 
> .text
> .global _start
> _start:
>       pushl   $0
>       movl    $1, %eax
>       int     $0x80
> 
> I looked everywhere (Developer's handbook, Google, ...) to find the solution, 
> but all resources I consulted tell me this is the right way to do it.
> This program, however, always exits with 1 regardless of the value I push.

The kernel expects the interrupt to take place from within a function.
Try:

.text
.global _start
_start:
        pushl   $8
        movl    $1, %eax
        call    doint
doint:  int     $0x80

Or, if you really want the program as simple as possible, you can push
0, eax, garbage, anything onto the stack in place of the return address:

.text
.global _start
_start:
        pushl   $8
        pushl   $0
        movl    $1, %eax
        int     $0x80


ari

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to