exec() cleanup, generalization, improvement
. make exec() callers (i.e. vfs and rs) determine the memory layout by explicitly reserving regions using mmap() calls on behalf of the exec()ing process, i.e. handling all of the exec logic, thereby eliminating all special exec() knowledge from VM. . the new procedure is: clear the exec()ing process first, then call third-party mmap()s to reserve memory, then copy the executable file section contents in, all using callbacks tailored to the caller's way of starting an executable . i.e. no more explicit EXEC_NEWMEM-style calls in PM or VM as with rigid 2-section arguments . this naturally allows generalizing exec() by simply loading all ELF sections . drop/merge of lots of duplicate exec() code into libexec . not copying the code sections to vfs and into the executable again is a measurable performance improvement (about 3.3% faster for 'make' in src/servers/)
This commit is contained in:
@@ -49,4 +49,9 @@
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
#define PAGE_MASK (PAGE_SIZE - 1)
|
||||
|
||||
/* As visible from the user space process, where is the top of the
|
||||
* stack (first non-stack byte), when in paged mode?
|
||||
*/
|
||||
#define VM_STACKTOP 0x80000000
|
||||
|
||||
#endif /* _I386_VMPARAM_H_ */
|
||||
|
||||
@@ -97,9 +97,7 @@
|
||||
#define CPROF 99 /* to PM */
|
||||
|
||||
/* Calls provided by PM and FS that are not part of the API */
|
||||
#define EXEC_NEWMEM 100 /* from VFS or RS to PM: new memory map for
|
||||
* exec
|
||||
*/
|
||||
#define PM_NEWEXEC 100 /* from VFS or RS to PM: new exec */
|
||||
#define SRV_FORK 101 /* to PM: special fork call for RS */
|
||||
#define EXEC_RESTART 102 /* to PM: final part of exec for RS */
|
||||
#define GETPROCNR 104 /* to PM */
|
||||
|
||||
@@ -54,4 +54,7 @@ error "_MINIX_MACHINE has incorrect value (0)"
|
||||
|
||||
#define _KMESS_BUF_SIZE 10000
|
||||
|
||||
/* Default stack size (limit) */
|
||||
#define DEFAULT_STACK_LIMIT (64 * 1024 * 1024)
|
||||
|
||||
#endif /* _MINIX_SYS_CONFIG_H */
|
||||
|
||||
@@ -166,26 +166,6 @@ struct mem_range
|
||||
phys_bytes mr_limit; /* Highest memory address in range */
|
||||
};
|
||||
|
||||
/* For EXEC_NEWMEM */
|
||||
struct exec_newmem
|
||||
{
|
||||
vir_bytes text_addr; /* Starting address of text section */
|
||||
vir_bytes text_bytes; /* Length of text section (in bytes) */
|
||||
vir_bytes data_addr; /* Starting address of data section */
|
||||
vir_bytes data_bytes; /* Length of data section (in bytes) */
|
||||
vir_bytes tot_bytes; /* Minimum stack region size (in bytes) */
|
||||
vir_bytes args_bytes; /* Arguments/environ size on stack (in bytes) */
|
||||
int sep_id; /* Separate I&D? */
|
||||
int is_elf; /* Is ELF exe? */
|
||||
dev_t st_dev; /* Device holding executable file */
|
||||
ino_t st_ino; /* Inode of executable file */
|
||||
time_t enst_ctime; /* Last changed time of executable file */
|
||||
uid_t new_uid; /* Process UID after exec */
|
||||
gid_t new_gid; /* Process GID after exec */
|
||||
int setugid; /* Process is setuid or setgid */
|
||||
char progname[16]; /* Should be at least PROC_NAME_LEN */
|
||||
};
|
||||
|
||||
/* Memory chunks. */
|
||||
struct memory {
|
||||
phys_bytes base;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
int vm_exit(endpoint_t ep);
|
||||
int vm_fork(endpoint_t ep, int slotno, endpoint_t *child_ep);
|
||||
int vm_brk(endpoint_t ep, char *newaddr);
|
||||
int vm_exec_newmem(endpoint_t ep, struct exec_newmem *args, int
|
||||
args_bytes, char **ret_stack_top, int *ret_flags);
|
||||
int vm_push_sig(endpoint_t ep, vir_bytes *old_sp);
|
||||
int vm_willexit(endpoint_t ep);
|
||||
int vm_adddma(endpoint_t proc_e, phys_bytes start, phys_bytes size);
|
||||
|
||||
Reference in New Issue
Block a user