|
|
1.1 root 1: /****************************************************************************** 1.1.1.2 ! root 2: * Copyright (c) 2004, 2011 IBM Corporation 1.1 root 3: * All rights reserved. 4: * This program and the accompanying materials 5: * are made available under the terms of the BSD License 6: * which accompanies this distribution, and is available at 7: * http://www.opensource.org/licenses/bsd-license.php 8: * 9: * Contributors: 10: * IBM Corporation - initial implementation 11: *****************************************************************************/ 12: 1.1.1.2 ! root 13: /* ! 14: * libelf Forth wrapper ! 15: */ ! 16: ! 17: #include <libelf.h> ! 18: ! 19: // : elf-load-file ( fileaddr -- entry type ) ! 20: PRIM(ELF_X2d_LOAD_X2d_FILE) ! 21: { ! 22: void *file_addr = TOS.a; ! 23: int type; ! 24: unsigned long entry; ! 25: type = elf_load_file(file_addr, &entry, elf_forth_claim, flush_cache); ! 26: TOS.u = entry; ! 27: PUSH; TOS.n = type; ! 28: } ! 29: MIRP ! 30: ! 31: // : elf-load-file-to-addr ( fileaddr destaddr -- entry type ) ! 32: PRIM(ELF_X2d_LOAD_X2d_FILE_X2d_TO_X2d_ADDR) ! 33: { ! 34: void *dest_addr = TOS.a; POP; 1.1 root 35: void *file_addr = TOS.a; 36: int type; 37: unsigned long entry; 1.1.1.2 ! root 38: type = elf_load_file_to_addr(file_addr, dest_addr, &entry, ! 39: elf_forth_claim, flush_cache); 1.1 root 40: TOS.u = entry; 41: PUSH; TOS.n = type; 1.1.1.2 ! root 42: } 1.1 root 43: MIRP
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.