[prev] 36 [next]

Argc and Argv

The real MIPS machine has no idea about argc and argv

SPIM runs under Linux, and needs to interact with environment

So, the initialisation code (that invokes main) sets up argc/argv:

    lw    $a0 0($sp)   # argc 
    addiu $a1 $sp 4    # argv 
    ...
    jal   main 
    nop 
    li    $v0 10 
    syscall            # syscall 10 (exit) 


Note: we are ignoring envp (environment pointer)