Upx_Doxygen
https://github.com/upx/upx
p_tos.h
1 /* p_tos.h --
2 
3  This file is part of the UPX executable compressor.
4 
5  Copyright (C) 1996-2016 Markus Franz Xaver Johannes Oberhumer
6  Copyright (C) 1996-2016 Laszlo Molnar
7  All Rights Reserved.
8 
9  UPX and the UCL library are free software; you can redistribute them
10  and/or modify them under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of
12  the License, or (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING.
21  If not, write to the Free Software Foundation, Inc.,
22  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24  Markus F.X.J. Oberhumer Laszlo Molnar
25  <markus@oberhumer.com> <ezerotven+github@gmail.com>
26  */
27 
28 
29 #ifndef __UPX_P_TOS_H
30 #define __UPX_P_TOS_H 1
31 
32 
33 /*************************************************************************
34 // atari/tos
35 **************************************************************************/
36 
37 class PackTos : public Packer
38 {
39  typedef Packer super;
40 public:
41  PackTos(InputFile *f);
42  virtual int getVersion() const { return 13; }
43  virtual int getFormat() const { return UPX_F_ATARI_TOS; }
44  virtual const char *getName() const { return "atari/tos"; }
45  virtual const char *getFullName(const options_t *) const { return "m68k-atari.tos"; }
46  virtual const int *getCompressionMethods(int method, int level) const;
47  virtual const int *getFilters() const;
48 
49  virtual void pack(OutputFile *fo);
50  virtual void unpack(OutputFile *fo);
51 
52  virtual bool canPack();
53  virtual int canUnpack();
54 
55  virtual void fileInfo();
56 
57 protected:
58  virtual Linker* newLinker() const;
59  virtual void buildLoader(const Filter *ft);
60  unsigned getDecomprOffset(int method, int small) const;
61 
62  virtual int readFileHeader();
63  virtual bool checkFileHeader();
64 
65  __packed_struct(tos_header_t)
66  BE16 fh_magic;
67  BE32 fh_text;
68  BE32 fh_data;
69  BE32 fh_bss;
70  BE32 fh_sym;
71  BE32 fh_reserved;
72  BE32 fh_flag;
73  BE16 fh_reloc;
74  __packed_struct_end()
75 
76  tos_header_t ih, oh;
77 
78  // symbols for buildLoader()
80  {
81  enum { LOOP_NONE, LOOP_SUBQ_L, LOOP_SUBQ_W, LOOP_DBRA };
82  struct LoopInfo {
83  unsigned mode; unsigned count; unsigned value;
84  void init(unsigned count, bool allow_dbra=true);
85  };
86  // buildLoader() input
87  bool need_reloc;
88  LoopInfo loop1;
89  LoopInfo loop2;
90  LoopInfo loop3;
91  unsigned up21_d4;
92  unsigned up21_a6;
93  unsigned up31_base_d4;
94  unsigned up31_base_a6;
95  // buildLoader() output
96  unsigned up31_d4;
97  unsigned up31_a6;
98  // currently not used by buildLoader()
99  unsigned flush_cache_rts_offset;
100  unsigned clear_dirty_stack_len;
101  unsigned copy_to_stack_len;
102 
103  void reset() { memset(this, 0, sizeof(*this)); }
104  };
105  LinkerSymbols symbols;
106 };
107 
108 
109 #endif /* already included */
110 
111 /* vim:set ts=4 sw=4 et: */
Definition: linker.h:35
Definition: options.h:45
Definition: p_tos.h:37
Definition: file.h:89
Definition: packer.h:115
Definition: p_tos.h:82
Definition: file.h:121
Definition: filter.h:53
Definition: p_tos.h:79