Re: MIPS/Linux assembly issue

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

 



adnan iqbal <adnan.iqbal@xxxxxxxxxxxx> writes:

> Hi all,

Hi,
>
> I am trying to compile/link/execute following very simple program in
> debian/MIPS (Tried on Qemu and Octeon). I am getting errors while executing
> the program. gdb also shows a strange behavior showing program entrypoint
> somehere in data segement. Any help getting this sorted out shall be
> appreciated.
>
> Regards
> Adnan
>
> Commands used to compile/link
> ----------------------------------------------------
> $ as hello.s -o hello.o
> $ld hello.o -o hello
> $ ./hello
>
>
> The code
> ---------------
>       .data
> str:
>         .asciiz "hello world\n"
>         .text
>         .globl __start

Please consider adding ".ent __start" here

>
> __start:
>         jal f2
>         la $4,str
>         li $2,4

It's wrong here. On o32, write syscall is 4004. Also the args are:
$4: file descriptor (here 0)
$5: string
$6: string length

>         syscall
>
>         ## terminate program via _exit () system call
>         li $2, 10

exit is 4001. 4010 is unlink. Look at /usr/include/asm/unistd.h on your
mips system.

>         syscall

Add .end __start here if you've added the .ent


Arnaud


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux