]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/ibl.git/blobdiff - src/interp/elf/file_ovr.h
Added elf interpreter
[keystone-rtos/ibl.git] / src / interp / elf / file_ovr.h
diff --git a/src/interp/elf/file_ovr.h b/src/interp/elf/file_ovr.h
new file mode 100644 (file)
index 0000000..d3e2619
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _FILE_OVR_H
+#define _FILE_OVR_H
+/**
+ *  @file file_ovr.h
+ *
+ *  @brief
+ *             Overrides the standard file operations (fseek, fread, ftell, fclose).
+ *             This file must be included after the standard elf includes
+ */
+#include <limits.h>
+
+
+/* Redirect seek and reads */
+#define fseek(x,y,z)        (*x->seek)((Int32)(y),(Int32)(z))
+#define fread(w,x,y,z)      (((*z->read)((Uint8 *)(w),(Uint32)((x)*(y)))) == 0 ? (y) : 0)
+#define ftell(x)            UINT_MAX
+#define fclose(x)           0
+
+
+#define FILE BOOT_MODULE_FXN_TABLE
+
+#endif /* _FILE_OVR_H */