Changeset 666f492 in mainline
- Timestamp:
- 2010-05-24T18:42:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- da1bafb
- Parents:
- c555155
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/panic.S
rc555155 r666f492 27 27 # 28 28 29 .text 29 .text 30 30 31 31 .set noat … … 34 34 35 35 #include <arch/asm/regname.h> 36 36 37 37 .global panic_printf 38 38 39 /* From printf return directly to halt() */ 39 /* From printf return directly to halt() */ 40 40 panic_printf: 41 41 jal printf … … 43 43 j halt 44 44 nop 45 /* This code does not work, god knows why */ 46 /* lui $ra, %hi(halt) 45 46 /* This code does not work, god knows why 47 lui $ra, %hi(halt) 47 48 j printf 48 49 ori $ra, %lo(halt) */ -
kernel/arch/ppc32/src/ppc32.c
rc555155 r666f492 201 201 pic_init(assigned_address[0].addr, PAGE_SIZE, &pic_cir, 202 202 &pic_cir_arg); 203 203 204 204 #ifdef CONFIG_MAC_KBD 205 205 uintptr_t pa = assigned_address[0].addr + 0x16000; … … 223 223 } 224 224 } 225 225 226 226 /* 227 227 * This is the necessary evil until the userspace driver is entirely … … 284 284 { 285 285 // TODO 286 while ( 1);286 while (true); 287 287 } 288 288 -
kernel/generic/include/lib/elf.h
rc555155 r666f492 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 42 42 * current ELF version 43 43 */ 44 #define EV_CURRENT 44 #define EV_CURRENT 1 45 45 46 46 /** 47 47 * ELF types 48 48 */ 49 #define ET_NONE 0/* No type */50 #define ET_REL 1/* Relocatable file */51 #define ET_EXEC 2/* Executable */52 #define ET_DYN 3/* Shared object */53 #define ET_CORE 4/* Core */54 #define ET_LOPROC 0xff00/* Processor specific */55 #define ET_HIPROC 0xffff/* Processor specific */56 57 /** 49 #define ET_NONE 0 /* No type */ 50 #define ET_REL 1 /* Relocatable file */ 51 #define ET_EXEC 2 /* Executable */ 52 #define ET_DYN 3 /* Shared object */ 53 #define ET_CORE 4 /* Core */ 54 #define ET_LOPROC 0xff00 /* Processor specific */ 55 #define ET_HIPROC 0xffff /* Processor specific */ 56 57 /** 58 58 * ELF machine types 59 59 */ 60 #define EM_NO 0/* No machine */61 #define EM_SPARC 2/* SPARC */62 #define EM_386 3/* i386 */63 #define EM_MIPS 8/* MIPS RS3000 */64 #define EM_MIPS_RS3_LE 10/* MIPS RS3000 LE */65 #define EM_PPC 20/* PPC32 */66 #define EM_PPC64 21/* PPC64 */67 #define EM_ARM 40/* ARM */68 #define EM_SPARCV9 43/* SPARC64 */69 #define EM_IA_64 50/* IA-64 */70 #define EM_X86_64 62/* AMD64/EMT64 */60 #define EM_NO 0 /* No machine */ 61 #define EM_SPARC 2 /* SPARC */ 62 #define EM_386 3 /* i386 */ 63 #define EM_MIPS 8 /* MIPS RS3000 */ 64 #define EM_MIPS_RS3_LE 10 /* MIPS RS3000 LE */ 65 #define EM_PPC 20 /* PPC32 */ 66 #define EM_PPC64 21 /* PPC64 */ 67 #define EM_ARM 40 /* ARM */ 68 #define EM_SPARCV9 43 /* SPARC64 */ 69 #define EM_IA_64 50 /* IA-64 */ 70 #define EM_X86_64 62 /* AMD64/EMT64 */ 71 71 72 72 /** 73 73 * ELF identification indexes 74 74 */ 75 #define EI_MAG0 76 #define EI_MAG1 77 #define EI_MAG2 78 #define EI_MAG3 79 #define EI_CLASS 4/* File class */80 #define EI_DATA 5/* Data encoding */81 #define EI_VERSION 6/* File version */82 #define EI_OSABI 83 #define EI_ABIVERSION 84 #define EI_PAD 9/* Start of padding bytes */85 #define EI_NIDENT 16/* ELF identification table size */75 #define EI_MAG0 0 76 #define EI_MAG1 1 77 #define EI_MAG2 2 78 #define EI_MAG3 3 79 #define EI_CLASS 4 /* File class */ 80 #define EI_DATA 5 /* Data encoding */ 81 #define EI_VERSION 6 /* File version */ 82 #define EI_OSABI 7 83 #define EI_ABIVERSION 8 84 #define EI_PAD 9 /* Start of padding bytes */ 85 #define EI_NIDENT 16 /* ELF identification table size */ 86 86 87 87 /** 88 88 * ELF magic number 89 89 */ 90 #define ELFMAG0 91 #define ELFMAG1 92 #define ELFMAG2 93 #define ELFMAG3 90 #define ELFMAG0 0x7f 91 #define ELFMAG1 'E' 92 #define ELFMAG2 'L' 93 #define ELFMAG3 'F' 94 94 95 95 /** 96 96 * ELF file classes 97 97 */ 98 #define ELFCLASSNONE 99 #define ELFCLASS32 100 #define ELFCLASS64 98 #define ELFCLASSNONE 0 99 #define ELFCLASS32 1 100 #define ELFCLASS64 2 101 101 102 102 /** 103 103 * ELF data encoding types 104 104 */ 105 #define ELFDATANONE 106 #define ELFDATA2LSB 1/* Least significant byte first (little endian) */107 #define ELFDATA2MSB 2/* Most signigicant byte first (big endian) */105 #define ELFDATANONE 0 106 #define ELFDATA2LSB 1 /* Least significant byte first (little endian) */ 107 #define ELFDATA2MSB 2 /* Most signigicant byte first (big endian) */ 108 108 109 109 /** 110 110 * ELF error return codes 111 111 */ 112 #define EE_OK 0/* No error */113 #define EE_INVALID 1/* Invalid ELF image */114 #define EE_MEMORY 2/* Cannot allocate address space */115 #define EE_INCOMPATIBLE 3/* ELF image is not compatible with current architecture */116 #define EE_UNSUPPORTED 4/* Non-supported ELF (e.g. dynamic ELFs) */117 #define EE_LOADER 5/* The image is actually a program loader */118 #define EE_IRRECOVERABLE 112 #define EE_OK 0 /* No error */ 113 #define EE_INVALID 1 /* Invalid ELF image */ 114 #define EE_MEMORY 2 /* Cannot allocate address space */ 115 #define EE_INCOMPATIBLE 3 /* ELF image is not compatible with current architecture */ 116 #define EE_UNSUPPORTED 4 /* Non-supported ELF (e.g. dynamic ELFs) */ 117 #define EE_LOADER 5 /* The image is actually a program loader */ 118 #define EE_IRRECOVERABLE 6 119 119 120 120 /** 121 121 * ELF section types 122 122 */ 123 #define SHT_NULL 124 #define SHT_PROGBITS 125 #define SHT_SYMTAB 126 #define SHT_STRTAB 127 #define SHT_RELA 128 #define SHT_HASH 129 #define SHT_DYNAMIC 130 #define SHT_NOTE 131 #define SHT_NOBITS 132 #define SHT_REL 133 #define SHT_SHLIB 134 #define SHT_DYNSYM 135 #define SHT_LOOS 136 #define SHT_HIOS 137 #define SHT_LOPROC 138 #define SHT_HIPROC 139 #define SHT_LOUSER 140 #define SHT_HIUSER 123 #define SHT_NULL 0 124 #define SHT_PROGBITS 1 125 #define SHT_SYMTAB 2 126 #define SHT_STRTAB 3 127 #define SHT_RELA 4 128 #define SHT_HASH 5 129 #define SHT_DYNAMIC 6 130 #define SHT_NOTE 7 131 #define SHT_NOBITS 8 132 #define SHT_REL 9 133 #define SHT_SHLIB 10 134 #define SHT_DYNSYM 11 135 #define SHT_LOOS 0x60000000 136 #define SHT_HIOS 0x6fffffff 137 #define SHT_LOPROC 0x70000000 138 #define SHT_HIPROC 0x7fffffff 139 #define SHT_LOUSER 0x80000000 140 #define SHT_HIUSER 0xffffffff 141 141 142 142 /** 143 143 * ELF section flags 144 144 */ 145 #define SHF_WRITE 0x1146 #define SHF_ALLOC 147 #define SHF_EXECINSTR 148 #define SHF_TLS 149 #define SHF_MASKPROC 145 #define SHF_WRITE 0x1 146 #define SHF_ALLOC 0x2 147 #define SHF_EXECINSTR 0x4 148 #define SHF_TLS 0x400 149 #define SHF_MASKPROC 0xf0000000 150 150 151 151 /** 152 152 * Symbol binding 153 153 */ 154 #define STB_LOCAL 155 #define STB_GLOBAL 156 #define STB_WEAK 157 #define STB_LOPROC 158 #define STB_HIPROC 154 #define STB_LOCAL 0 155 #define STB_GLOBAL 1 156 #define STB_WEAK 2 157 #define STB_LOPROC 13 158 #define STB_HIPROC 15 159 159 160 160 /** 161 161 * Symbol types 162 162 */ 163 #define STT_NOTYPE 164 #define STT_OBJECT 165 #define STT_FUNC 166 #define STT_SECTION 167 #define STT_FILE 168 #define STT_LOPROC 169 #define STT_HIPROC 163 #define STT_NOTYPE 0 164 #define STT_OBJECT 1 165 #define STT_FUNC 2 166 #define STT_SECTION 3 167 #define STT_FILE 4 168 #define STT_LOPROC 13 169 #define STT_HIPROC 15 170 170 171 171 /** 172 172 * Program segment types 173 173 */ 174 #define PT_NULL 175 #define PT_LOAD 176 #define PT_DYNAMIC 177 #define PT_INTERP 178 #define PT_NOTE 179 #define PT_SHLIB 180 #define PT_PHDR 181 #define PT_LOPROC 182 #define PT_HIPROC 174 #define PT_NULL 0 175 #define PT_LOAD 1 176 #define PT_DYNAMIC 2 177 #define PT_INTERP 3 178 #define PT_NOTE 4 179 #define PT_SHLIB 5 180 #define PT_PHDR 6 181 #define PT_LOPROC 0x70000000 182 #define PT_HIPROC 0x7fffffff 183 183 184 184 /** 185 185 * Program segment attributes. 186 186 */ 187 #define PF_X 188 #define PF_W 189 #define PF_R 187 #define PF_X 1 188 #define PF_W 2 189 #define PF_R 4 190 190 191 191 /** … … 195 195 * ELF object file specifications. They are the only types used 196 196 * in ELF header. 197 * 197 198 */ 198 199 typedef uint64_t elf_xword; … … 206 207 * 207 208 * These types are specific for 32-bit format. 209 * 208 210 */ 209 211 typedef uint32_t elf32_addr; … … 214 216 * 215 217 * These types are specific for 64-bit format. 218 * 216 219 */ 217 220 typedef uint64_t elf64_addr; … … 235 238 elf_half e_shstrndx; 236 239 }; 240 237 241 struct elf64_header { 238 242 uint8_t e_ident[EI_NIDENT]; … … 252 256 }; 253 257 254 /* 258 /** 255 259 * ELF segment header. 256 260 * Segments headers are also known as program headers. … … 266 270 elf_word p_align; 267 271 }; 272 268 273 struct elf64_segment_header { 269 274 elf_word p_type; … … 277 282 }; 278 283 279 /* 284 /** 280 285 * ELF section header 281 286 */ … … 292 297 elf_word sh_entsize; 293 298 }; 299 294 300 struct elf64_section_header { 295 301 elf_word sh_name; … … 305 311 }; 306 312 307 /* 313 /** 308 314 * ELF symbol table entry 309 315 */ … … 316 322 elf_half st_shndx; 317 323 }; 324 318 325 struct elf64_symbol { 319 326 elf_word st_name; … … 325 332 }; 326 333 327 #ifdef __32_BITS__ 334 #ifdef __32_BITS__ 328 335 typedef struct elf32_header elf_header_t; 329 336 typedef struct elf32_segment_header elf_segment_header_t; … … 331 338 typedef struct elf32_symbol elf_symbol_t; 332 339 #endif 340 333 341 #ifdef __64_BITS__ 334 342 typedef struct elf64_header elf_header_t; … … 340 348 extern const char *elf_error(unsigned int rc); 341 349 342 /* Interpreter string used to recognize the program loader */343 #define ELF_INTERP_ZSTR "kernel"350 /** Interpreter string used to recognize the program loader */ 351 #define ELF_INTERP_ZSTR "kernel" 344 352 #define ELF_INTERP_ZLEN sizeof(ELF_INTERP_ZSTR) 345 353
Note:
See TracChangeset
for help on using the changeset viewer.