Re: Write to unused memory-mapped IO address (0xfffffffc)



> Some real architectures perform I/O by doing something that, to
> the programmer, looks like reading/writing using particular memory
> addresses. Usually (AFAIK) these are addresses at either the high or
> low end of memory -- such as 0xfffffffc. The hardware is supposed
> to magically convert accesses to these addresses into operations
> to communicate with devices or device controllers. (I feel sure
> if this description is off-base someone will correct me, and/or
> supply some details. There may also be a good description in your
> (text?)book -- try "memory-mapped I/O" in the index.)
>
> SPIM appears to be simulating this, with 0xfffffffc being one of
> the addresses reserved for communicating with I/O devices. I'm
> speculating here, but it sounds like maybe 0xfffffffc is reserved
> for this purpose but not actually used, and therefore SPIM is not
> going to let you perform an operation (writing to this address)
> that wouldn't do anything.


Think you are right. I have now intialized the stack-pointer before I use
it:

ori $sp, $0, 0xfffc # Init stack
$sp = 0000FFFC

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??



.



Relevant Pages

  • Re: Virtual Machines and structs
    ... -> When the compiler generates code to store a value in an object, ... heap memory addresses since the stack would store a 32-bit heap address ... the virtual machine would need to use addressing relative to ...
    (comp.lang.c)
  • Re: Auction house
    ... And you don't have enough inventory space to store it. ... I use 4 bars in total to craft something. ... If you keep the smaller stacks to the immediate left of a full stack, ... and atm it doesn't matter because you can freely combine the stacks afterwards. ...
    (alt.games.warcraft)
  • Re: whats wrong with this program,or with gfortran?
    ... the local variables, of the procedure. ... A common implementation in the past was to write onto the stack a mini- ... routine that loads a register with the context (address of a frame ... needed to store the code, but the concept is usually similar. ...
    (comp.lang.fortran)
  • Re: Write to unused memory-mapped IO address (0xfffffffc)
    ... My understanding is that part of what SPIM simulates is a very, ... >I would the like to store the return address as the first item on the stack: ... particularly the reference to "stack segment") like maybe SPIM is ... or it's outside the memory area that can be referenced at all. ...
    (comp.programming)
  • Re: Exception after resume from suspend to ram
    ... I am sure that bootload does not use memory during wakeup. ... Store CPSR, sp and SPSR in memory ... ; FIQ (r8-r12, r14, SPSR on stack; store SP) ...
    (microsoft.public.windowsce.platbuilder)