mb_set_param(cbi->param_buf, BOARDVARNAME,(char *)get_board_name(machine.board_id) , cbi);
- /* round user stack down to leave a gap to catch kernel
+ /* move user stack/data down to leave a gap to catch kernel
* stack overflow; and to distinguish kernel and user addresses
* at a glance (0xf.. vs 0xe..)
*/
- cbi->user_sp &= 0xF0000000;
- cbi->user_end = cbi->user_sp;
+ cbi->user_sp = USR_STACKTOP;
+ cbi->user_end = USR_DATATOP;
/* kernel bytes without bootstrap code/data that is currently
* still needed but will be freed after bootstrapping.
mb_set_param(cbi->param_buf, ARCHVARNAME, (char *)get_board_arch_name(BOARD_ID_INTEL), cbi);
mb_set_param(cbi->param_buf, BOARDVARNAME,(char *)get_board_name(BOARD_ID_INTEL) , cbi);
- /* round user stack down to leave a gap to catch kernel
+ /* move user stack/data down to leave a gap to catch kernel
* stack overflow; and to distinguish kernel and user addresses
* at a glance (0xf.. vs 0xe..)
*/
- cbi->user_sp &= 0xF0000000;
- cbi->user_end = cbi->user_sp;
+ cbi->user_sp = USR_STACKTOP;
+ cbi->user_end = USR_DATATOP;
/* kernel bytes without bootstrap code/data that is currently
* still needed but will be freed after bootstrapping.
/* for kputc() */
#define END_OF_KMESS 0
+/* User limits. */
+#ifndef USR_DATATOP
+#ifndef _MINIX_MAGIC
+#define USR_DATATOP 0xF0000000
+#else
+#define USR_DATATOP 0xE0000000 /* TODO: is this necessary? */
+#endif
+#endif
+
+#ifndef USR_STACKTOP
+#define USR_STACKTOP USR_DATATOP
+#endif
+
+#ifndef USR_DATATOP_COMPACT
+#define USR_DATATOP_COMPACT USR_DATATOP
+#endif
+
+#ifndef USR_STACKTOP_COMPACT
+#define USR_STACKTOP_COMPACT 0x50000000
+#endif
+
#endif /* CONST_H */
if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */
system_hz = DEFAULT_HZ;
+ /* Get memory parameters. */
+ value = env_get("ac_layout");
+ if(value && atoi(value)) {
+ kinfo.user_sp = (vir_bytes) USR_STACKTOP_COMPACT;
+ kinfo.user_end = (vir_bytes) USR_DATATOP_COMPACT;
+ }
+
DEBUGEXTRA(("cstart\n"));
/* Record miscellaneous information for user-space servers. */
if (!vr) {
/* No address given or address already in use. */
- vr = map_page_region(vmp, VM_PAGE_SIZE, VM_DATATOP, len,
+ vr = map_page_region(vmp, VM_MMAPBASE, VM_MMAPTOP, len,
vrflags, mfflags, mt);
}
if(len % VM_PAGE_SIZE)
len += VM_PAGE_SIZE - (len % VM_PAGE_SIZE);
- if(!(vr = map_page_region(vmp, 0, VM_DATATOP, len,
+ if(!(vr = map_page_region(vmp, VM_MMAPBASE, VM_MMAPTOP, len,
VR_DIRECT | VR_WRITABLE, 0, &mem_type_directphys))) {
return ENOMEM;
}
vr = map_page_region(dvmp, da, 0, size, flags, 0,
&mem_type_shared);
else
- vr = map_page_region(dvmp, 0, VM_DATATOP, size, flags, 0,
- &mem_type_shared);
+ vr = map_page_region(dvmp, VM_MMAPBASE, VM_MMAPTOP, size,
+ flags, 0, &mem_type_shared);
if(!vr) {
printf("VM: re-map of shared area failed\n");
#define NO_MEM ((phys_clicks) MAP_NONE) /* returned by alloc_mem() with mem is up */
/* And what is the highest addressable piece of memory? */
-#define VM_DATATOP kernel_boot_info.user_end
-#define VM_STACKTOP kernel_boot_info.user_sp
-
+#define VM_DATATOP kernel_boot_info.user_end
+
+#define VM_STACKTOP kernel_boot_info.user_sp
+
+/* Live update will work only with magic instrumentation. Live update requires
+ * strict separation of regions within the process to succeed. Therefore,
+ * apply this strict separation only if magic instrumentation is used.
+ * Otherwise, do not place such limitations on processes.
+ */
+#ifdef _MINIX_MAGIC
+#define VM_MMAPTOP (VM_STACKTOP-DEFAULT_STACK_LIMIT)
+#define VM_MMAPBASE (VM_MMAPTOP/2)
+#else
+#define VM_MMAPTOP VM_DATATOP
+#define VM_MMAPBASE VM_PAGE_SIZE
#endif
+#endif