Commit eec0286f authored by Alessandro Rubini's avatar Alessandro Rubini

lib-bare: bugfix in initializing globals

This was wrong (and segfaulted) since we introduced multi-link operation,
but I only tested bare-i386 today.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 718369b7
......@@ -22,9 +22,6 @@ void ppsi_clear_bss(void)
*ptr = 0;
}
static struct pp_globals ppg_static;
static struct pp_instance ppi_static;
/* ppg fields */
static DSDefault defaultDS;
static DSCurrent currentDS;
......@@ -33,6 +30,29 @@ static DSPort portDS;
static DSTimeProperties timePropertiesDS;
static struct pp_servo servo;
static struct pp_globals ppg_static; /* forward declaration */
static struct pp_instance ppi_static = {
.glbs = &ppg_static,
.portDS = &portDS,
.n_ops = &bare_net_ops,
.t_ops = &bare_time_ops,
.iface_name = "eth0",
.ethernet_mode = PP_DEFAULT_ETHERNET_MODE,
};
/* We now have a structure with all globals, and multiple ppi inside */
static struct pp_globals ppg_static = {
.pp_instances = &ppi_static,
.nlinks = 1,
.servo = &servo,
.defaultDS = &defaultDS,
.currentDS = &currentDS,
.parentDS = &parentDS,
.timePropertiesDS = &timePropertiesDS,
.rt_opts = &__pp_default_rt_opts,
};
int ppsi_main(int argc, char **argv)
{
struct pp_globals *ppg = &ppg_static;
......@@ -42,20 +62,6 @@ int ppsi_main(int argc, char **argv)
pp_printf("PPSi, bare kernel. Commit %s, built on " __DATE__ "\n",
PPSI_VERSION);
ppi->glbs = ppg;
ppg->defaultDS = &defaultDS;
ppg->currentDS = &currentDS;
ppg->parentDS = &parentDS;
ppi->portDS = &portDS;
ppg->timePropertiesDS = &timePropertiesDS;
ppg->servo = &servo;
ppg->arch_data = NULL;
ppi->n_ops = &bare_net_ops;
ppi->t_ops = &bare_time_ops;
ppi->ethernet_mode = PP_DEFAULT_ETHERNET_MODE;
ppi->iface_name = "eth0";
ppg->rt_opts = &__pp_default_rt_opts;
if (sys_adjtimex(&t) >= 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment