Mercurial > sos > sos
diff src/std.c @ 55:25be3895c62a
The filesystem now supports a much better cache system
Added memcpy to the standard library
readFSBlock now returns a pointer to the location of a file in memory (it
loads the file to a location in the cache). init_fs now takes two arguments, a
devid and the current memory size, it allocates 1% of the memory for the cache.
All functions have been modified to use this idea of reading files.
TODO make looking for a file in the cache more efficient
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 23:48:32 -0400 |
parents | 39fcefab46ed |
children | 480f5685b3c2 |
line wrap: on
line diff
--- a/src/std.c Sat Apr 09 21:55:59 2011 -0400 +++ b/src/std.c Sat Apr 09 23:48:32 2011 -0400 @@ -161,6 +161,20 @@ return ret; } +void* memcpy(void *destination, const void *source, size_t num) +{ + int i; + const u8 *from = source; + u8 *to = destination; + for(i = 0; i < num; i++) + to[i] = from[i]; + return destination; +} + + + +//DYNAMIC MEMORY + static Header base; static Header *allocp = NULL; //the location of the last known free block