IBNOS
|
Go to the source code of this file.
Functions | |
uint32_t | stringLength (const char *str) |
Returns the length of a nullterminated string. More... | |
bool | stringIsEqual (const char *str, const char *buf, uint32_t len) |
Checks if the string is equal to the memory region. More... | |
uint32_t | stringParseOctal (const char *str, uint32_t len) |
Converts an octal string to a integer number. More... | |
void * | memset (void *ptr, int value, size_t num) |
Fills a memory region with some specific byte value. More... | |
void * | memcpy (void *destination, const void *source, size_t num) |
Copies a block of memory from source to destination. More... | |
void * | memmove (void *destination, const void *source, size_t num) |
Moves a block of memory from source to destination. More... | |
void | debugCaptureCpuContext (struct taskContext *context) |
Fills out the task context structure with the values from the currently running code. More... | |
asm (".text\align 4\ ".globl debugCaptureCpuContext\" "debugCaptureCpuContext:\" " pushl %eax\" " movl 8(%esp), %eax\" "\" " popl 0x28(%eax)\" " movl %ecx, 0x2C(%eax)\" " movl %edx, 0x30(%eax)\" " movl %ebx, 0x34(%eax)\" " leal 4(%esp), %edx\" " movl %edx, 0x38(%eax)\" " movl %ebp, 0x3C(%eax)\" " movl %esi, 0x40(%eax)\" " movl %edi, 0x44(%eax)\" "\" " movw %es, 0x48(%eax)\" " movw %cs, 0x4C(%eax)\" " movw %ss, 0x50(%eax)\" " movw %ds, 0x54(%eax)\" " movw %fs, 0x58(%eax)\" " movw %gs, 0x5C(%eax)\" "\" " movl %cr3, %edx\" " movl %edx, 0x1C(%eax)\" " movl(%esp), %edx\" " movl %edx, 0x20(%eax)\" " pushfl\" " popl 0x24(%eax)\" "\" " ret\") | |
void | debugAssertFailed (const char *assertion, const char *file, const char *function, const char *line, struct taskContext *context) |
Used internally to implement assert() More... | |
void | debugNotImplemented (const char *file, const char *function, const char *line, struct taskContext *context) |
Used internally to implement NOTIMPLEMENTED() More... | |
asm | ( | ".text\lign 4\".globl debugCaptureCpuContext\" "debugCaptureCpuContext:\" " pushl %eax\" " movl | 8%esp, |
%eax\" "\" " popl 0x28(%eax)\" " movl % | ecx, | ||
0x2C(%eax)\" " movl % | edx, | ||
0x30(%eax)\" " movl % | ebx, | ||
0x34(%eax)\" " leal 4(%esp) | , | ||
%edx\" " movl % | edx, | ||
0x38(%eax)\" " movl % | ebp, | ||
0x3C(%eax)\" " movl % | esi, | ||
0x40(%eax)\" " movl % | edi, | ||
0x44(%eax)\" "\" " movw % | es, | ||
0x48(%eax)\" " movw % | cs, | ||
0x4C(%eax)\" " movw % | ss, | ||
0x50(%eax)\" " movw % | ds, | ||
0x54(%eax)\" " movw % | fs, | ||
0x58(%eax)\" " movw % | gs, | ||
0x5C(%eax)\" "\" " movl % | cr3, | ||
%edx\" " movl % | edx, | ||
0x1C(%eax)\" " movl(%esp) | , | ||
%edx\" " movl % | edx, | ||
0x20(%eax)\" " pushfl\" " popl 0x24(%eax)\" "\" " ret\" | |||
) |
void debugAssertFailed | ( | const char * | assertion, |
const char * | file, | ||
const char * | function, | ||
const char * | line, | ||
struct taskContext * | context | ||
) |
Used internally to implement assert()
This function shows an assertion message. Normally it shouldn't be necessary to call this function manually, all values will automatically be filled out by using the assert() macro from util.h.
assertion | String containing the condition which failed |
file | File in which the assertion occured |
function | Function in which the assertion occured |
line | String representing the line number, where the assertion occured |
context | Task context structure containing the CPU registers after the error occured |
void debugCaptureCpuContext | ( | struct taskContext * | context | ) |
Fills out the task context structure with the values from the currently running code.
This function will capture all registers, segment registers, and control registers and save these values to the task context structure. The stack pointer and EIP will be adjusted, so that they point immediately after this function returns.
context | Pointer to a task context structure |
void debugNotImplemented | ( | const char * | file, |
const char * | function, | ||
const char * | line, | ||
struct taskContext * | context | ||
) |
Used internally to implement NOTIMPLEMENTED()
file | File in which the feature is missing |
function | Function in which the assertion occured |
line | String representing the line number, where the assertion occured |
context | Task context structure containing the CPU registers |
void* memcpy | ( | void * | destination, |
const void * | source, | ||
size_t | num | ||
) |
Copies a block of memory from source to destination.
The source and destination blocks shouldn't be overlapping, otherwise it is not safe to call this function. If the regions could be overlapping please use memmove() instead.
destination | Pointer to the destination memory region |
source | Pointer to the source memory region |
num | Length of the memory region to copy, in bytes |
void* memmove | ( | void * | destination, |
const void * | source, | ||
size_t | num | ||
) |
Moves a block of memory from source to destination.
Similar to memcpy(), but will also work safely if both source and destination regions are overlapping.
destination | Pointer to the destination memory region |
source | Pointer to the source memory region |
num | Length of the memory region to copy, in bytes |
void* memset | ( | void * | ptr, |
int | value, | ||
size_t | num | ||
) |
bool stringIsEqual | ( | const char * | str, |
const char * | buf, | ||
uint32_t | len | ||
) |
uint32_t stringLength | ( | const char * | str | ) |