Lines Matching refs:fsctx
74 static int fs_init(fileio_ctx_t *fsctx,uint8_t *file)
76 fsctx->beginning = file;
77 fsctx->ptr = file;
81 static int fs_seek(fileio_ctx_t *fsctx,int off,int how)
83 fsctx->ptr = fsctx->beginning + off;
88 static int fs_read(fileio_ctx_t *fsctx,uint8_t *dest,int cnt)
91 uint8_t *sptr = fsctx->ptr;
98 fsctx->ptr += cnt;
104 * readprogsegment(fsctx,addr,size)
110 * fsctx - file I/O dispatch
118 static int readprogsegment(fileio_ctx_t *fsctx,
128 res = fs_read(fsctx,addr,size);
185 static Elf32_Shdr *elfgetshdr(fileio_ctx_t *fsctx,Elf32_Ehdr *ep)
195 if (fs_seek(fsctx,ep->e_shoff,FILE_SEEK_BEGINNING) != ep->e_shoff ||
196 fs_read(fsctx,(uint8_t *)shtab,size) != size) {
220 static int elfload_internal(fileio_ctx_t *fsctx,
232 if (fs_read(fsctx,(uint8_t *) ep,sizeof(*ep)) != sizeof(*ep)) {
269 if (fs_seek(fsctx,ep->e_phoff,FILE_SEEK_BEGINNING) != ep->e_phoff ||
270 fs_read(fsctx,(uint8_t *)phtab,nbytes) != nbytes) {
286 shtab = elfgetshdr(fsctx,ep);
310 if (fs_seek(fsctx,ph->p_offset,FILE_SEEK_BEGINNING) != ph->p_offset) {
315 res = readprogsegment(fsctx,
362 fileio_ctx_t fsctx;
364 fs_init(&fsctx,file);
372 res = fs_hook(&fsctx,"z");
383 res = elfload_internal(&fsctx,entrypt,flags);