sim: callback: expose argv & environ

Pass the existing strings data to the callbacks so that common
libgloss syscalls can be implemented (which we'll do shortly).
This commit is contained in:
Mike Frysinger
2021-11-15 23:04:10 -05:00
parent 54f7a83a62
commit 8cfc9a1895
14 changed files with 79 additions and 10 deletions

View File

@@ -28,6 +28,7 @@
/* This must come before any other includes. */
#include "defs.h"
#include "sim/callback.h"
#include "sim-main.h"
#include "sim-options.h"
@@ -155,6 +156,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
char * const *argv, char * const *env)
{
SIM_CPU *cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
sim_cia addr;
/* Set the PC. */
@@ -180,5 +182,8 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
STATE_PROG_ENVP (sd) = dupargv (env);
}
cb->argv = STATE_PROG_ARGV (sd);
cb->envp = STATE_PROG_ENVP (sd);
return SIM_RC_OK;
}