Re: Write to unused memory-mapped IO address (0xfffffffc)
- From: blmblm@xxxxxxxxxxxxx
- Date: 28 Nov 2005 11:12:38 GMT
In article <dmd9sn$4j1$1@xxxxxxxxxxxxxxxxx>, Paminu <asdad@xxxxxxx> wrote:
[ snip ]
>Think you are right. I have now intialized the stack-pointer before I use
>it:
>
>ori $sp, $0, 0xfffc # Init stack
>$sp = 0000FFFC
>
I'm not sure you need to do this. When I've run programs under spim,
it has seemed to be the case that $sp already has a sensible value.
My understanding is that part of what SPIM simulates is a very,
very rudimentary operating system (just enough code to load programs
and process a few simple system calls for I/O). I would think that
assigning a sensible value to the stack pointer, before calling a
just-loaded program, would be part of that.
>
>I would then like to make room for 3 (3*4 = 12 Bytes) arguments and an array
>with 10 integers (a[10] = 40 Bytes). I therefore decrement the stack-pointer
>with 52
>
>addi $29, $29, -52
>$sp = 0000FFC8
>
>I would the like to store the return address as the first item on the stack:
>
>sw $31, 48($29) # main's $ra is first item on stack.
>
>but then I get this error (taken form SPIM):
>
>[0x00400014] 0xafbf0030 sw $31, 48($29) ; 10: sw $31,
>48($29) # main's $ra is first item on stack.
>Exception occurred at PC=0x00400014
> Bad address in data/stack read: 0x0000fff8
>Can't expand stack segment by 16777216 bytes to 16842752 bytes
>Use -lstack # with # > 16842752
>
>Why is it impossible to store $ra from 0x0000fff8??
>
Interesting question. It sounds (from the error message,
particularly the reference to "stack segment") like maybe SPIM is
making some attempt to manage its memory, and 0x0000fff8 is either
outside the memory area it thinks should be used for the stack,
or it's outside the memory area that can be referenced at all.
32-bit addresses make for a pretty big address space, and it
wouldn't surprise me at all to know that SPIM won't let you access
all possible addresses.
A shorter answer is that this problem may go away once you stop
trying to assign your own value to $sp. (How did you pick fffc,
by the way?)
--
| B. L. Massingill
| ObDisclaimer: I don't speak for my employers; they return the favor.
.
- References:
- Prev by Date: Re: VB or VC++?
- Next by Date: Re: VB or VC++?
- Previous by thread: Re: Write to unused memory-mapped IO address (0xfffffffc)
- Next by thread: proceses selection
- Index(es):
Relevant Pages
|