mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-25 05:40:31 +03:00
simplifies loom init and checkpoint restore
This commit is contained in:
parent
51d8b6889a
commit
47c7339db2
@ -26,10 +26,10 @@
|
||||
c3_i
|
||||
u3m_bail(c3_m how_m) __attribute__((noreturn));
|
||||
|
||||
/* u3m_init(): start the environment, with/without checkpointing.
|
||||
/* u3m_init(): start the environment.
|
||||
*/
|
||||
void
|
||||
u3m_init(c3_o chk_o);
|
||||
u3m_init();
|
||||
|
||||
/* u3m_pave(): instantiate or activate image.
|
||||
*/
|
||||
|
@ -165,9 +165,9 @@ u3e_fault(void* adr_v, c3_i ser_i)
|
||||
/* _ce_image_open(): open or create image.
|
||||
*/
|
||||
static c3_o
|
||||
_ce_image_open(u3e_image* img_u, c3_o nuu_o)
|
||||
_ce_image_open(u3e_image* img_u)
|
||||
{
|
||||
c3_i mod_i = _(nuu_o) ? (O_RDWR | O_CREAT) : O_RDWR;
|
||||
c3_i mod_i = O_RDWR | O_CREAT;
|
||||
c3_c ful_c[8193];
|
||||
|
||||
snprintf(ful_c, 8192, "%s", u3P.dir_c);
|
||||
@ -197,11 +197,7 @@ _ce_image_open(u3e_image* img_u, c3_o nuu_o)
|
||||
c3_d pgs_d = (siz_d + (c3_d)((1 << (u3a_page + 2)) - 1)) >>
|
||||
(c3_d)(u3a_page + 2);
|
||||
|
||||
if ( c3y == nuu_o ) {
|
||||
if ( siz_d ) {
|
||||
c3_assert(0);
|
||||
return c3n;
|
||||
}
|
||||
if ( !siz_d ) {
|
||||
return c3y;
|
||||
}
|
||||
else {
|
||||
@ -817,7 +813,7 @@ u3e_save(void)
|
||||
_ce_patch_free(pat_u);
|
||||
}
|
||||
|
||||
/* u3e_live(): start the persistence system.
|
||||
/* u3e_live(): start the checkpointing system.
|
||||
*/
|
||||
c3_o
|
||||
u3e_live(c3_o nuu_o, c3_c* dir_c)
|
||||
@ -832,29 +828,17 @@ u3e_live(c3_o nuu_o, c3_c* dir_c)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Open and apply any patches.
|
||||
*/
|
||||
if ( _(nuu_o) ) {
|
||||
if ( (c3n == _ce_image_open(&u3P.nor_u, c3y)) ||
|
||||
(c3n == _ce_image_open(&u3P.sou_u, c3y)) )
|
||||
{
|
||||
printf("boot: image failed\r\n");
|
||||
exit(1);
|
||||
}
|
||||
// Open image files.
|
||||
//
|
||||
if ( (c3n == _ce_image_open(&u3P.nor_u)) ||
|
||||
(c3n == _ce_image_open(&u3P.sou_u)) )
|
||||
{
|
||||
printf("boot: image failed\r\n");
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
u3_ce_patch* pat_u;
|
||||
|
||||
/* Open image files.
|
||||
*/
|
||||
{
|
||||
if ( (c3n == _ce_image_open(&u3P.nor_u, c3n)) ||
|
||||
(c3n == _ce_image_open(&u3P.sou_u, c3n)) )
|
||||
{
|
||||
fprintf(stderr, "boot: no image\r\n");
|
||||
return u3e_live(c3y, dir_c);
|
||||
}
|
||||
}
|
||||
/* Load any patch files; apply them to images.
|
||||
*/
|
||||
if ( 0 != (pat_u = _ce_patch_open()) ) {
|
||||
|
@ -1495,10 +1495,10 @@ _cm_signals(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* u3m_init(): start the environment, with/without checkpointing.
|
||||
/* u3m_init(): start the environment.
|
||||
*/
|
||||
void
|
||||
u3m_init(c3_o chk_o)
|
||||
u3m_init(void)
|
||||
{
|
||||
_cm_limits();
|
||||
_cm_signals();
|
||||
@ -1515,7 +1515,7 @@ u3m_init(c3_o chk_o)
|
||||
|
||||
map_v = mmap((void *)u3_Loom,
|
||||
len_w,
|
||||
_(chk_o) ? PROT_READ : (PROT_READ | PROT_WRITE),
|
||||
(PROT_READ | PROT_WRITE),
|
||||
(MAP_ANON | MAP_FIXED | MAP_PRIVATE),
|
||||
-1, 0);
|
||||
|
||||
@ -1694,7 +1694,7 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
|
||||
{
|
||||
/* Activate the loom.
|
||||
*/
|
||||
u3m_init(nuu_o);
|
||||
u3m_init();
|
||||
|
||||
/* Activate the storage system.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
u3m_init(c3y);
|
||||
u3m_init();
|
||||
u3m_pave(c3y, c3n);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ main(int argc, char* argv[])
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
u3m_init(c3y);
|
||||
u3m_init();
|
||||
u3m_pave(c3y, c3n);
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ main(int argc, char *argv[])
|
||||
printf("hello, world: len %dMB\n", (1 << U3_OS_LoomBits) >> 18);
|
||||
// _test_words();
|
||||
|
||||
u3m_init(c3n);
|
||||
u3m_init();
|
||||
u3m_pave(c3y, c3n);
|
||||
// u3j_boot();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user