From f009fe1f63597427802d669c937c2bdc693b2698 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 29 Aug 2006 23:46:21 +0200 Subject: [PATCH] Start work on updating p_tos. --- src/p_tos.cpp | 2 ++ src/p_tos.h | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/p_tos.cpp b/src/p_tos.cpp index 5fe8c716..9aee73c6 100644 --- a/src/p_tos.cpp +++ b/src/p_tos.cpp @@ -419,6 +419,8 @@ void PackTos::pack(OutputFile *fo) const unsigned i_sym = ih.fh_sym; const unsigned i_bss = ih.fh_bss; + symbols.reset(); + // read file const unsigned isize = file_size - i_sym; ibuf.alloc(isize); diff --git a/src/p_tos.h b/src/p_tos.h index 2326dc22..e86da43a 100644 --- a/src/p_tos.h +++ b/src/p_tos.h @@ -75,6 +75,24 @@ protected: tos_header_t ih, oh; + struct LinkerSymbols + { + enum { LOOP_UNKNOWN, LOOP_SUBQ_L, LOOP_SUBQ_W, LOOP_DBRA }; + // before linker->relocate() + unsigned loop1_count; int loop1_mode; + unsigned loop2_count; int loop2_mode; + unsigned loop3_count; int loop3_mode; + // after linker->relocate() + unsigned copy_to_stack_len; + unsigned flush_cache_rts_offset; + unsigned clear_bss_size_p4; + unsigned clear_dirty_stack_len; + // FIXME: up11 etc. + + void reset() { memset(this, 0, sizeof(*this)); } + }; + LinkerSymbols symbols; + protected: unsigned patch_d_subq(void *l, int llen, int, unsigned, const char*); unsigned patch_d_loop(void *l, int llen, int, unsigned, const char*, const char*);