XenevaOS
Loading...
Searching...
No Matches
Macros | Functions | Variables
loader.c File Reference
#include <loader.h>
#include <Drivers/uart.h>
#include <string.h>
#include <Mm/pmmngr.h>
#include <Mm/vmmngr.h>
#include <Mm/kmalloc.h>
#include <aucon.h>
#include <Fs/vfs.h>
#include <pe.h>
#include <Hal/AA64/sched.h>
#include <Hal/AA64/aa64lowlevel.h>
#include <ftmngr.h>
Include dependency graph for loader.c:

Macros

#define LOADER_SCRATCH_VIRT   0xFFFFC00000700000
 
#define PUSH(stack, type, item)
 
#define PUSHALIGN(stack, align)
 
#define PUSHSTRING(stack, s)
 

Functions

void testFunc ()
 
void AuProcessEntUser (uint64_t rcx)
 AuProcessEntUser – main kernel thread call in order to enter user for processes.
 
bool setStk ()
 
int AuLoadExecToProcess (AuProcess *proc, char *filename, int argc, char **argv)
 AuLoadExecToProcess – loads an executable to the process.
 
void AuInitialiseLoader ()
 AuInitialiseLoader – initialize the loader and allocate atleast 1 MiB for scratch use.
 

Variables

uint64_t_ldr_scratchBuffer
 
uint64_t physFrames [64]
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ LOADER_SCRATCH_VIRT

#define LOADER_SCRATCH_VIRT   0xFFFFC00000700000

◆ PUSH

#define PUSH (   stack,
  type,
  item 
)
Value:
do { \
stack -= sizeof(type); \
while (stack & (sizeof(type)-1))stack--; \
*((type*)(stack)) = (item); \
}while (0);

◆ PUSHALIGN

#define PUSHALIGN (   stack,
  align 
)
Value:
do {\
stack &= ~((align)-1); \
}while(0)

◆ PUSHSTRING

#define PUSHSTRING (   stack,
 
)
Value:
do { \
size_t l = strlen(s) - 1; \
do {\
PUSH2(stack, char, s[l]); \
l--; \
} while (l >= 0); \
}while (0)
ACPI_SIZE strlen(const char *String)
Definition utclib.c:379

Function Documentation

◆ AuInitialiseLoader()

void AuInitialiseLoader ( )

AuInitialiseLoader – initialize the loader and allocate atleast 1 MiB for scratch use.

◆ AuLoadExecToProcess()

int AuLoadExecToProcess ( AuProcess proc,
char *  filename,
int  argc,
char **  argv 
)

AuLoadExecToProcess – loads an executable to the process.

Parameters
proc– pointer to process data structure
filename– executable file name
argc– number of arguments
argv– array of argument in strings
Returns
0 on success -1 on failure

◆ AuProcessEntUser()

void AuProcessEntUser ( uint64_t  rcx)

AuProcessEntUser – main kernel thread call in order to enter user for processes.

Parameters
rcx– user entry structure

◆ setStk()

bool setStk ( )
extern

◆ testFunc()

void testFunc ( )

Variable Documentation

◆ _ldr_scratchBuffer

uint64_t* _ldr_scratchBuffer

◆ physFrames

uint64_t physFrames[64]