Cleanup in elf.c with .bss section clean; adm command mounts cdrom instead of floppy...
[ZeXOS.git] / apps / zasm / buffer.h
blob2456ec651718a4423322c41ecc303c855bb6ec1e
1 /*
2 * ZeX/OS
3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __BUFFER_H
20 #define __BUFFER_H
22 #define __PACKED__ __attribute__ ((__packed__))
24 typedef struct {
25 unsigned sect_name __PACKED__;
26 unsigned type __PACKED__;
27 unsigned flags __PACKED__;
28 unsigned virt_adr __PACKED__;
29 unsigned offset __PACKED__;
30 unsigned size __PACKED__;
31 unsigned link __PACKED__;
32 unsigned info __PACKED__;
33 unsigned align __PACKED__;
34 unsigned ent_size __PACKED__;
35 } elf_sect_t;
37 typedef struct {
38 unsigned magic;
39 unsigned char bitness;
40 unsigned char endian;
41 unsigned char elf_ver_1;
42 unsigned char res[9];
43 unsigned short file_type __PACKED__;
44 unsigned short machine __PACKED__;
45 unsigned elf_ver_2 __PACKED__;
46 unsigned entry_pt __PACKED__;
47 unsigned phtab_offset __PACKED__;
48 unsigned shtab_offset __PACKED__;
49 unsigned flags __PACKED__;
50 unsigned short file_hdr_size __PACKED__;
51 unsigned short phtab_ent_size __PACKED__;
52 unsigned short num_phtab_ents __PACKED__;
53 unsigned short shtab_ent_size __PACKED__;
54 unsigned short num_sects __PACKED__;
55 unsigned short shstrtab_index __PACKED__;
56 } elf_file_t;
58 extern int buffer_copy (unsigned offset, char *data, unsigned size);
59 extern char *buffer_get ();
60 extern int buffer_write (char *file);
61 extern int buffer_init ();
63 #endif