12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- /*
- * aout.h
- *
- * Copyright (C) 2016 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _AOUT_H_
- #define _AOUT_H_
- #include <common.h>
- #include <thread.h>
- #include <filesystem.h>
- #include <process.h>
- #define OMAGIC 0x0107
- #define NMAGIC 0x0108
- #define ZMAGIC 0x010B
- #define QMAGIC 0x00CC
- #define AOUT_TYPE_FIELD(x) ((x) & 0x1E)
- #define AOUT_SYM_UNDEFINED 0x00
- #define AOUT_SYM_EXTERN 0x01
- #define AOUT_SYM_ABSOLUTE 0x02
- #define AOUT_SYM_TEXT 0x04
- #define AOUT_SYM_DATA 0x06
- #define AOUT_SYM_BSS 0x08
- #pragma pack(push, 1)
- typedef struct
- {
- dword_t midmag;
- dword_t text_size;
- dword_t data_size;
- dword_t bss_size;
- dword_t sym_size;
- dword_t entry_point;
- dword_t text_reloc_size;
- dword_t data_reloc_size;
- } aout_header_t;
- typedef struct
- {
- dword_t address;
- dword_t symbol_num : 24;
- dword_t pc_relative : 1;
- dword_t length : 2;
- dword_t external : 1;
- dword_t base_rel : 1;
- dword_t jump_table : 1;
- dword_t relative : 1;
- dword_t copy : 1;
- } aout_reloc_t;
- typedef struct
- {
- union
- {
- dword_t name_offset;
- char *name;
- };
- byte_t type;
- byte_t other;
- word_t reserved;
- dword_t value;
- } aout_symbol_t;
- #pragma pack(pop)
- #endif
|