- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# exec.c File Reference

`#include <ubixos/exec.h>`
`#include <ubixos/elf.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 <lib/string.h>`
`#include <assert.h>`

Include dependency graph for exec.c:

Go to the source code of this file.

## Defines
#define | STACK_ADDR 0xC800000
## Functions
void | execFile (char *file, int argc, char **argv, int console)
uInt32 | execThread (void(*tproc)(void), uInt32 stack, char *arg)
void | sys_exec (char *file, char *ap)
| New exec...
void | sysExec (char *file, char *ap)

## Define Documentation

#define STACK_ADDR 0xC800000

Definition at line 42 of file exec.c.

Referenced by execFile(), and sysExec().

## Function Documentation

void execFile | ( | char * | file,
|  | int | argc,
|  | char ** | argv,
|  | int | console |
| ) |  |  |

Definition at line 143 of file exec.c.

References _current, assert, tssStruct::back_link, tssStruct::cr3, tssStruct::cs, tssStruct::ds, tssStruct::ebp, tssStruct::edi, elfHeader::eEntry, tssStruct::eflags, elfHeader::eIdent, tssStruct::eip, elfHeader::ePhnum, elfHeader::ePhoff, tssStruct::es, tssStruct::esi, tssStruct::esp, tssStruct::esp0, tssStruct::esp1, tssStruct::esp2, elfHeader::eType, fclose(), fopen(), fread(), tssStruct::fs, fseek(), taskStruct::gid, tssStruct::gs, taskStruct::id, tssStruct::io_map, K_PANIC, KERNEL_PAGE_DEFAULT, kernelPageDirectory, kfree(), kmalloc(), kpanic(), kprintf(), tssStruct::ldt, memset(), taskStruct::oInfo, tty_termNode::owner, PAGE_DEFAULT, PAGE_PRESENT, PAGE_STACK, PAGE_USER, fileDescriptorStruct::perms, elfProgramHeader::phMemsz, elfProgramHeader::phVaddr, READY, sched_setStatus(), schedNewTask(), tssStruct::ss, tssStruct::ss0, tssStruct::ss1, tssStruct::ss2, STACK_ADDR, taskStruct::td, taskStruct::term, tssStruct::trace_bitmap, taskStruct::tss, tty_find(), taskStruct::uid, thread::vm_daddr, vmm_remapPage(), vmm_setPageAttributes(), vmmCreateVirtualSpace(), vmmFindFreePage(), osInfo::vmStart, x1000, x18, and x30.

Referenced by kmain().

Here is the call graph for this function:

uInt32 execThread | ( | void(*)(void) | tproc,
|  | uInt32 | stack,
|  | char * | arg |
| ) |  |  |

Definition at line 55 of file exec.c.

References assert, tssStruct::back_link, tssStruct::cr3, tssStruct::cs, tssStruct::ds, tssStruct::ebp, tssStruct::edi, tssStruct::eflags, tssStruct::eip, tssStruct::es, tssStruct::esi, tssStruct::esp, tssStruct::esp0, tssStruct::esp1, tssStruct::esp2, tssStruct::fs, tssStruct::gs, taskStruct::id, taskStruct::imageFd, tssStruct::io_map, kernelPageDirectory, kpanic(), tssStruct::ldt, taskStruct::oInfo, READY, sched_setStatus(), schedNewTask(), tssStruct::ss, tssStruct::ss0, tssStruct::ss1, tssStruct::ss2, tssStruct::trace_bitmap, taskStruct::tss, and osInfo::vmStart.

Referenced by kmain(), and ubthread_create().

Here is the call graph for this function:

void sys_exec | ( | char * | file,
|  | char * | ap |
| ) |  |  |

New exec...

Clean the virtual of COW pages left over from the fork

Adjust iframe

build argc and argv[]

Start of Env

Definition at line 552 of file exec.c.

References _current, elfHeader::eEntry, elfHeader::eIdent, i386_frame::eip, elfHeader::ePhnum, elfHeader::ePhoff, ET_EXEC, elfHeader::eType, fclose(), fopen(), fread(), fseek(), taskStruct::id, taskStruct::imageFd, K_PANIC, kfree(), kmalloc(), kprintf(), memset(), taskStruct::oInfo, PAGE_DEFAULT, PAGE_PRESENT, PAGE_SHIFT, PAGE_USER, elfProgramHeader::phMemsz, elfProgramHeader::phOffset, elfProgramHeader::phVaddr, PT_INTERP, PT_LOAD, PT_PHDR, round_page, taskStruct::td, trunc_page, thread::vm_daddr, thread::vm_dsize, vmm_remapPage(), vmm_setPageAttributes(), vmmFindFreePage(), osInfo::vmStart, and x1000.

Referenced by sysExec().

Here is the call graph for this function:

void sysExec | ( | char * | file,
|  | char * | ap |
| ) |  |  |

Definition at line 334 of file exec.c.

References _current, assert, i386_frame::ebp, elfHeader::eEntry, elfHeader::eIdent, i386_frame::eip, endTask(), elfHeader::ePhnum, elfHeader::ePhoff, elfHeader::eShnum, elfHeader::eShoff, tssStruct::esp0, elfHeader::eType, fclose(), fopen(), fread(), fseek(), taskStruct::id, taskStruct::imageFd, K_PANIC, kfree(), kmalloc(), kpanic(), kprintf(), ldEnable(), memset(), taskStruct::oInfo, PAGE_DEFAULT, PAGE_PRESENT, PAGE_SHIFT, PAGE_SIZE, PAGE_USER, fileDescriptorStruct::perms, elfProgramHeader::phMemsz, elfProgramHeader::phVaddr, PT_DYNAMIC, PT_INTERP, PT_LOAD, round_page, STACK_ADDR, strcpy, strlen, sys_exec(), taskStruct::td, trunc_page, taskStruct::tss, i386_frame::user_esp, thread::vm_daddr, thread::vm_dsize, VM_TASK, vmm_cleanVirtualSpace(), vmm_remapPage(), vmm_setPageAttributes(), vmmFindFreePage(), vmmGetFreeVirtualPage(), osInfo::vmStart, and x1000.

Here is the call graph for this function: