84 |
static void |
static void |
85 |
pupa_load_normal_mode (void) |
pupa_load_normal_mode (void) |
86 |
{ |
{ |
87 |
if (pupa_dl_load ("normal")) |
/* Load the module. */ |
88 |
{ |
pupa_dl_load ("normal"); |
|
void (*normal_func) (const char *config); |
|
|
|
|
|
/* If the function pupa_enter_normal_mode is present, call it. */ |
|
|
normal_func = pupa_dl_resolve_symbol ("pupa_enter_normal_mode"); |
|
|
if (normal_func) |
|
|
{ |
|
|
char *config; |
|
|
char *prefix; |
|
|
|
|
|
prefix = pupa_dl_get_prefix (); |
|
|
if (! prefix) |
|
|
pupa_fatal ("The dl prefix is not set!"); |
|
|
|
|
|
config = pupa_malloc (pupa_strlen (prefix) + sizeof ("/pupa.cfg")); |
|
|
if (! config) |
|
|
pupa_fatal ("out of memory"); |
|
|
|
|
|
pupa_sprintf (config, "%s/pupa.cfg", prefix); |
|
|
(*normal_func) (config); |
|
|
pupa_free (config); |
|
|
} |
|
|
else |
|
|
pupa_printf ("No entrance routine in the normal mode!\n"); |
|
|
} |
|
|
else |
|
|
pupa_printf ("Failed to load the normal mode.\n"); |
|
89 |
|
|
90 |
/* Ignore any error, because we have the rescue mode anyway. */ |
/* Ignore any error, because we have the rescue mode anyway. */ |
91 |
pupa_errno = PUPA_ERR_NONE; |
pupa_errno = PUPA_ERR_NONE; |
112 |
pupa_load_modules (); |
pupa_load_modules (); |
113 |
pupa_add_unused_region (); |
pupa_add_unused_region (); |
114 |
|
|
115 |
/* Go to the real world. */ |
/* Load the normal mode module. */ |
116 |
pupa_load_normal_mode (); |
pupa_load_normal_mode (); |
117 |
|
|
118 |
/* If pupa_enter_normal_mode fails or doesn't exist, enter rescue mode. */ |
/* Enter the rescue mode. */ |
|
pupa_printf ("Entering into rescue mode...\n"); |
|
119 |
pupa_enter_rescue_mode (); |
pupa_enter_rescue_mode (); |
120 |
} |
} |