void sef_llvm_stack_refs_save(char *stack_buff);
void sef_llvm_stack_refs_restore(char *stack_buff);
int sef_llvm_state_transfer(sef_init_info_t *info);
+int sef_llvm_add_special_mem_region(void *addr, size_t len, const char* name);
+int sef_llvm_del_special_mem_region_by_addr(void *addr);
int sef_llvm_ltckpt_enabled(void);
int sef_llvm_get_ltckpt_offset(void);
#include "syslib.h"
#include <assert.h>
#include <unistd.h>
+#include <sys/mman.h>
#include <minix/sysutil.h>
/* Stack refs definitions. */
return _magic_state_transfer(info);
}
+/*===========================================================================*
+ * sef_llvm_add_special_mem_region *
+ *===========================================================================*/
+int sef_llvm_add_special_mem_region(void *addr, size_t len, const char* name)
+{
+ extern int __attribute__((weak)) st_add_special_mmapped_region(void *addr,
+ size_t len, char* name);
+ if (!st_add_special_mmapped_region)
+ return 0;
+ return st_add_special_mmapped_region(addr, len, (char*) name);
+}
+
+/*===========================================================================*
+ * sef_llvm_del_special_mem_region_by_addr *
+ *===========================================================================*/
+int sef_llvm_del_special_mem_region_by_addr(void *addr)
+{
+ extern int __attribute__((weak)) st_del_special_mmapped_region_by_addr(
+ void *addr);
+ if (!st_del_special_mmapped_region_by_addr)
+ return 0;
+ return st_del_special_mmapped_region_by_addr(addr);
+}
+
/*===========================================================================*
* sef_llvm_ltckpt_enabled *
*===========================================================================*/
if (r != OK) return MAP_FAILED;
+ r = sef_llvm_add_special_mem_region(m.m_lsys_vm_map_phys.reply,
+ len, NULL);
+ if(r < 0) {
+ printf("vm_map_phys: add_special_mem_region failed: %d\n", r);
+ }
+
return m.m_lsys_vm_map_phys.reply;
}
vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
{
message m;
+ int r;
memset(&m, 0, sizeof(m));
m.m_lsys_vm_unmap_phys.ep = who;
m.m_lsys_vm_unmap_phys.vaddr = vaddr;
- return _taskcall(VM_PROC_NR, VM_UNMAP_PHYS, &m);
+ r = _taskcall(VM_PROC_NR, VM_UNMAP_PHYS, &m);
+
+ if(r != OK) return r;
+
+ r = sef_llvm_del_special_mem_region_by_addr(vaddr);
+ if(r < 0) {
+ printf("vm_map_phys: del_special_mem_region failed: %d\n", r);
+ }
+
+ return OK;
}
/* Mark VM instances. */
num_vm_instances = 1;
vmproc[VM_PROC_NR].vm_flags |= VMF_VM_INSTANCE;
+
+ /* Let SEF know about VM mmapped regions. */
+ s = sef_llvm_add_special_mem_region((void*)VM_OWN_HEAPBASE,
+ VM_OWN_MMAPTOP-VM_OWN_HEAPBASE, "%MMAP_ALL");
+ if(s < 0) {
+ printf("VM: st_add_special_mmapped_region failed %d\n", s);
+ }
}
/*===========================================================================*