UbixOS  2.0
i386_exec.c File Reference
#include <sys/_null.h>
#include <sys/types.h>
#include <sys/elf.h>
#include <sys/gdt.h>
#include <ubixos/exec.h>
#include <ubixos/ld.h>
#include <ubixos/kpanic.h>
#include <ubixos/endtask.h>
#include <vmm/vmm.h>
#include <lib/kmalloc.h>
#include <lib/kprintf.h>
#include <vfs/file.h>
#include <assert.h>
#include <string.h>
#include <sys/descrip.h>
Include dependency graph for i386_exec.c:

Go to the source code of this file.

Macros

#define ARGV_PAGE   0x100
 
#define AT_BASE   7 /* Interpreter's base address. */
 
#define AT_ENTRY   9 /* Where interpreter should transfer control. */
 
#define AT_EXECFD   2 /* File descriptor of program to load. */
 
#define AT_FLAGS   8 /* Flags (unused for i386). */
 
#define AT_IGNORE   1 /* Ignored entry. */
 
#define AT_NULL   0 /* Terminates the vector. */
 
#define AT_PAGESZ   6 /* Page size in bytes. */
 
#define AT_PHDR   3 /* Program header of program already loaded. */
 
#define AT_PHENT   4 /* Size of each program header entry. */
 
#define AT_PHNUM   5 /* Number of program header entries. */
 
#define AUXARGS_ENTRY(pos, id, val)   {*pos = id;pos++; *pos = val;pos++;}
 
#define ELF_AUX   0x100
 
#define ENOEXEC   -1
 
#define ENVP_PAGE   0x100
 
#define STACK_PAD   0x1000
 

Functions

void execFile (char *file, char **argv, char **envp, int console)
 
uint32_t execThread (void(*tproc)(void), uint32_t stack, char *arg)
 
int sys_exec (struct thread *td, char *file, char **argv, char **envp)
 

Macro Definition Documentation

◆ ARGV_PAGE

#define ARGV_PAGE   0x100

Definition at line 46 of file i386_exec.c.

◆ AT_BASE

#define AT_BASE   7 /* Interpreter's base address. */

Definition at line 59 of file i386_exec.c.

◆ AT_ENTRY

#define AT_ENTRY   9 /* Where interpreter should transfer control. */

Definition at line 61 of file i386_exec.c.

◆ AT_EXECFD

#define AT_EXECFD   2 /* File descriptor of program to load. */

Definition at line 54 of file i386_exec.c.

◆ AT_FLAGS

#define AT_FLAGS   8 /* Flags (unused for i386). */

Definition at line 60 of file i386_exec.c.

◆ AT_IGNORE

#define AT_IGNORE   1 /* Ignored entry. */

Definition at line 53 of file i386_exec.c.

◆ AT_NULL

#define AT_NULL   0 /* Terminates the vector. */

Definition at line 52 of file i386_exec.c.

◆ AT_PAGESZ

#define AT_PAGESZ   6 /* Page size in bytes. */

Definition at line 58 of file i386_exec.c.

◆ AT_PHDR

#define AT_PHDR   3 /* Program header of program already loaded. */

Definition at line 55 of file i386_exec.c.

◆ AT_PHENT

#define AT_PHENT   4 /* Size of each program header entry. */

Definition at line 56 of file i386_exec.c.

◆ AT_PHNUM

#define AT_PHNUM   5 /* Number of program header entries. */

Definition at line 57 of file i386_exec.c.

◆ AUXARGS_ENTRY

#define AUXARGS_ENTRY (   pos,
  id,
  val 
)    {*pos = id;pos++; *pos = val;pos++;}

Definition at line 63 of file i386_exec.c.

◆ ELF_AUX

#define ELF_AUX   0x100

Definition at line 47 of file i386_exec.c.

◆ ENOEXEC

#define ENOEXEC   -1

Definition at line 50 of file i386_exec.c.

◆ ENVP_PAGE

#define ENVP_PAGE   0x100

Definition at line 45 of file i386_exec.c.

◆ STACK_PAD

#define STACK_PAD   0x1000

Definition at line 48 of file i386_exec.c.

Function Documentation

◆ execFile()

void execFile ( char *  file,
char **  argv,
char **  envp,
int  console 
)

Definition at line 244 of file i386_exec.c.

◆ execThread()

◆ sys_exec()

int sys_exec ( struct thread td,
char *  file,
char **  argv,
char **  envp 
)

Clean the virtual of COW pages left over from the fork

Definition at line 491 of file i386_exec.c.