Re: Seg Fault
- From: "Richard B. Gilbert" <rgilbert88@xxxxxxxxxxx>
- Date: Sat, 29 Mar 2008 16:27:32 -0400
Dotanitis@xxxxxxxxx wrote:
Hello to all,
I'm SPARC newbie and I have tried to run this simple program:
.global main
main:
save %sp, -64, %sp
mov 9, %l0
sub %l0, 1, %o0
sub %l0, 7, %o1
call .mul
nop
sub %l0, 11, %o1
call .div
nop
mov %o0, %l1
mov 1, %g1
ta 0
After I compiled it using gcc (4.1.2) and tried to run the exec - I've
got segmentation error.
This example was taken from the book "SPARC Arch' Assembly language
programming and c" / Richard P.Paul
Thanks.
I'm just guessing here but I think you are referencing an uninitialized variable as a storage address. The line "> mov %o0, %l1" is where I'm guessing that the problem lies. Perhaps the "l1" was supposed to be "11"??
Whether or not I've guessed right about the line of code causing the failure, there is no question that your program is trying to access memory that doesn't belong to you. That's what "segmentation error" or "segmentation fault" means!
.
- References:
- Seg Fault
- From: Dotanitis@xxxxxxxxx
- Seg Fault
- Prev by Date: Re: Seg Fault
- Next by Date: Re: Sun support quality, was: Re: SUNSOLVE IS DRIVING ME INSANE!!!
- Previous by thread: Re: Seg Fault
- Index(es):
Relevant Pages
|