factor/vm/image.hpp

51 lines
1.1 KiB
C++
Raw Normal View History

2009-05-04 02:46:13 -04:00
namespace factor
{
static const cell image_magic = 0x0f0e0d0c;
static const cell image_version = 4;
2009-05-02 05:04:19 -04:00
2009-05-04 05:50:24 -04:00
struct image_header {
cell magic;
cell version;
2009-05-02 05:04:19 -04:00
/* all pointers in the image file are relocated from
relocation_base to here when the image is loaded */
2009-05-04 05:50:24 -04:00
cell data_relocation_base;
2009-05-02 05:04:19 -04:00
/* size of heap */
2009-05-04 05:50:24 -04:00
cell data_size;
2009-05-02 05:04:19 -04:00
/* code relocation base */
2009-05-04 05:50:24 -04:00
cell code_relocation_base;
2009-05-02 05:04:19 -04:00
/* size of code heap */
2009-05-04 05:50:24 -04:00
cell code_size;
2009-05-02 05:04:19 -04:00
/* tagged pointer to t singleton */
2009-05-04 05:50:24 -04:00
cell t;
2009-05-02 05:04:19 -04:00
/* tagged pointer to bignum 0 */
2009-05-04 05:50:24 -04:00
cell bignum_zero;
2009-05-02 05:04:19 -04:00
/* tagged pointer to bignum 1 */
2009-05-04 05:50:24 -04:00
cell bignum_pos_one;
2009-05-02 05:04:19 -04:00
/* tagged pointer to bignum -1 */
2009-05-04 05:50:24 -04:00
cell bignum_neg_one;
2009-05-02 05:04:19 -04:00
/* Initial user environment */
2009-05-04 05:50:24 -04:00
cell userenv[USER_ENV];
2009-05-02 11:17:05 -04:00
};
2009-05-02 05:04:19 -04:00
2009-05-04 05:50:24 -04:00
struct vm_parameters {
const vm_char *image_path;
const vm_char *executable_path;
cell ds_size, rs_size;
cell gen_count, young_size, aging_size, tenured_size;
cell code_size;
2009-05-02 05:04:19 -04:00
bool secure_gc;
bool fep;
bool console;
bool stack_traces;
2009-05-04 05:50:24 -04:00
cell max_pic_size;
2009-05-02 11:17:05 -04:00
};
2009-05-02 05:04:19 -04:00
2009-05-04 05:50:24 -04:00
void load_image(vm_parameters *p);
bool save_image(const vm_char *file);
2009-05-02 05:04:19 -04:00
PRIMITIVE(save_image);
PRIMITIVE(save_image_and_exit);
2009-05-04 02:46:13 -04:00
}