Mercurial > sos > sos
view include/std.h @ 99:2a0aa3efc228
The shell script will now theroretically load the program into memory, will not run it.
The shell script loads a program into memory and displays the address but as
of now does not jump to it (though it does display the address it would jump to)
Added a memset function
Added a python script (credit for its writing to Jeff) that sets up a filesystem
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Sat, 14 May 2011 19:40:18 -0400 |
parents | 191e99dffd6c |
children | 14d96c95dd56 |
line wrap: on
line source
#include <die.h> #ifndef __STD_H #define __STD_H #define assert(x) do { if(!(x)) die(); } while (0) //min and max function definitions #define __fxn(TYPE) \ static inline TYPE Max_##TYPE(TYPE a, TYPE b) { return (a>b) ? a : b; } \ static inline TYPE Min_##TYPE(TYPE a, TYPE b) { return (a>b) ? b : a; } __fxn(int) __fxn(u64) __fxn(u32) #undef __fxn void init_all(u64 __memsize); double abs(double num); char* ftoa(double x, char *a, unsigned int prec); char* itoa(long long n, char *a, unsigned short base); s64 atoi(char *a); double atof(char *a); void sPrint(char *a); char* sGet(char *a, unsigned int n); //MALLOC CODE struct HEADER{ struct HEADER *next; size_t size; }; typedef struct HEADER Header; typedef Header blockUnit; void malloc_init(size_t memSize); void* malloc(size_t size); void free(void *ptr); void printHeader(Header* head); void printMem(); #endif