OSDN Git Service

* compLoader.cxx (generic_loader): Add eflags_pin.
authorscox <scox>
Tue, 29 Jun 2004 19:10:39 +0000 (19:10 +0000)
committerscox <scox>
Tue, 29 Jun 2004 19:10:39 +0000 (19:10 +0000)
(elf_loader): Add eflags.
(load_it): Set eflags.
* elfload.c (readElfFile): Add eflags.
* sidcpuutil.h (basic_cpu): Add eflags_set_pin, set_eflags.
* commonCfg.cxx (add_cpu):  Add eflags-set pin.

sid/component/loader/ChangeLog
sid/component/loader/compLoader.cxx
sid/component/loader/elfload.c
sid/component/loader/elfload.h
sid/include/ChangeLog
sid/include/sidcpuutil.h
sid/main/dynamic/ChangeLog
sid/main/dynamic/commonCfg.cxx

index 2b037a8..495c7be 100644 (file)
@@ -1,3 +1,10 @@
+2004-06-29  Stan Cox  <scox@redhat.com>
+
+       * compLoader.cxx (generic_loader):  Add eflags_pin.
+       (elf_loader): Add eflags.
+       (load_it): Set eflags.
+       * elfload.c (readElfFile): Add eflags.
+       
 2004-05-10  Frank Ch. Eigler  <fche@elastic.org>
 
        * elfload.c (textSectionAddress): Fix declaration placement typo.
index 45e7928..2b0833c 100644 (file)
@@ -121,6 +121,8 @@ protected:
   // endianness as specified in ELF header.
   // The value is one of sidutil::endian_*.
   output_pin endian_pin;
+  // eflags as specified in ELF header.
+  output_pin eflags_pin;
 
   // Provide address of write attempt to code section
   output_pin write_to_code_address_pin;
@@ -164,6 +166,7 @@ public:
       add_pin("load!", & this->doit_pin);
       add_pin("start-pc-set", & this->start_pc_pin);
       add_pin("endian-set", & this->endian_pin);
+      add_pin("eflags-set", &this->eflags_pin);
       add_pin("error", & this->error_pin);
       add_pin("write-to-code-address", & this->write_to_code_address_pin);
       add_accessor("load-accessor-insn", & this->load_accessor_insn);
@@ -249,10 +252,12 @@ class elf_loader: public generic_loader
       elf_loader::freeloader = this;
       unsigned entry_point;
       int little_endian_p;
+      unsigned eflags;
+
       const struct TextSection *section_table;
       int success_p = readElfFile(& elf_loader::load_function,
                                  & entry_point, & little_endian_p,
-                                 & section_table);
+                                 & eflags, & section_table);
       probe_upstream.set_section_table (section_table);
       elf_loader::freeloader = 0;
 
@@ -264,6 +269,7 @@ class elf_loader: public generic_loader
            this->endian_pin.drive(sidutil::endian_little);
          else
            this->endian_pin.drive(sidutil::endian_big);
+         this->eflags_pin.drive((host_int_4) eflags);
 
          if (this->verbose_p)
            cout << "loader: starting "
index 96e1ff6..e184d67 100644 (file)
@@ -82,7 +82,8 @@ textSectionAddress (unsigned long long address, const struct TextSection *sectio
 */
 
 int
-readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struct TextSection **section_table)
+readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian,
+            unsigned* e_flags, const struct TextSection **section_table)
 {
   unsigned char fileHeader [64];
   unsigned char psymHdr [56];
@@ -90,6 +91,7 @@ readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struc
   unsigned long long psymOffset;
   int psymSize;
   int psymNum;
+  int eFlags;
   unsigned long long secOffset;
   int secSize;
   int secNum;
@@ -125,6 +127,7 @@ readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struc
     {
       entryPoint = fetchQuad (fileHeader+24, littleEndian);
       psymOffset = fetchQuad (fileHeader+32, littleEndian);
+      eFlags = fetchWord (fileHeader+40, littleEndian);
       psymSize = fetchShort (fileHeader+54, littleEndian);
       psymNum = fetchShort (fileHeader+56, littleEndian);
     }
@@ -132,6 +135,7 @@ readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struc
     {
       entryPoint = fetchWord (fileHeader+24, littleEndian);
       psymOffset = fetchWord (fileHeader+28, littleEndian);
+      eFlags = fetchWord (fileHeader+36, littleEndian);
       psymSize = fetchShort (fileHeader+42, littleEndian);
       psymNum = fetchShort (fileHeader+44, littleEndian);
     }
@@ -266,6 +270,7 @@ readElfFile (PFLOAD func, unsigned* entry_point, int* little_endian, const struc
   *entry_point = entryPoint;
   *little_endian = littleEndian;
   *section_table = textSections;
+  *e_flags = eFlags;
 
   return 1;
 }
index 82120f9..032ba78 100644 (file)
@@ -48,7 +48,7 @@ typedef int (*PFLOAD)(unsigned long long dest, char *dest2, unsigned long long o
 extern int textSectionAddress(unsigned long long, const struct TextSection *);
 /* Load an ELF executable into memory. FUNC is used to actually read the
    file. */
-extern int readElfFile(PFLOAD func, unsigned*, int*, const struct TextSection **);
+extern int readElfFile(PFLOAD func, unsigned*, int*, unsigned*, const struct TextSection **);
 
 #define EI_CLASS 4
 #define ELFCLASS64  2 /* 64 bit */
index 4af41c1..ab2de4f 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-29  Stan Cox  <scox@redhat.com>
+
+       * sidcpuutil.h (basic_cpu): Add eflags_set_pin, set_eflags.
+       
 2004-03-22  Dave Brolley  <brolley@redhat.com>
 
        * sidcpuutil.h (trace_pin): New member of basic_cpu.
index 5a99999..24238eb 100644 (file)
@@ -407,6 +407,9 @@ namespace sidutil
     callback_pin<basic_cpu> endian_set_pin;
     virtual void set_endian(sid::host_int_4) = 0;
     void endian_set_pin_handler(sid::host_int_4 v) { this->set_endian (v); }
+    callback_pin<basic_cpu> eflags_set_pin;
+    virtual void set_eflags(sid::host_int_4) {}
+    void eflags_set_pin_handler(sid::host_int_4 v) { this->set_eflags (v); }
 
     // Signal trap type code and argument
   private:
@@ -550,6 +553,7 @@ public:
       flush_icache_pin (this, & basic_cpu::flush_icache_pin_handler),
       pc_set_pin (this, & basic_cpu::pc_set_pin_handler),
       endian_set_pin (this, & basic_cpu::endian_set_pin_handler),
+      eflags_set_pin (this, & basic_cpu::eflags_set_pin_handler),
       debugger_bus (& this->data_bus),
       trace_stream (),
       trace_filename ("-"), // standard output
@@ -575,6 +579,7 @@ public:
        add_pin ("cg-callee", & this->cg_callee_pin);
        add_pin ("print-insn-summary!", & this->print_insn_summary_pin);
        add_pin ("endian-set!", & this->endian_set_pin);
+       add_pin ("eflags-set!", & this->eflags_set_pin);
        add_watchable_pin ("trap", & this->trap_type_pin); // output side
        add_watchable_pin ("trap-code", & this->trap_code_pin);
        add_pin ("trap", & this->trap_disposition_pin); // input side
@@ -706,6 +711,7 @@ public:
   class basic_big_endian_cpu: public basic_cpu
   {
     void set_endian(sid::host_int_4) {}
+    void set_eflags(sid::host_int_4) {}
 
   protected:
 
@@ -802,6 +808,7 @@ public:
   class basic_little_endian_cpu: public basic_cpu
   {
     void set_endian(sid::host_int_4) {}
+    void set_eflags(sid::host_int_4) {}
 
   protected:
     basic_little_endian_cpu ()
index 9ef1bca..a5f1b76 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-29  Stan Cox  <scox@redhat.com>
+
+       * commonCfg.cxx (add_cpu):  Add eflags-set pin.
+
 2004-04-27  Dave Brolley  <brolley@redhat.com>
 
        * commonCfg.h (CacheCfg::compute_comptype): Now virtual.
index 45de208..4e141c1 100644 (file)
@@ -708,6 +708,7 @@ void LoaderCfg::add_cpu (CpuCfg *cpu)
   assert (cpu);
   conn_pin (this, "start-pc-set", cpu, "start-pc-set!");
   conn_pin (this, "endian-set", cpu, "endian-set!");
+  conn_pin (this, "eflags-set", cpu, "eflags-set!");
 }
 
 void LoaderCfg::set_file (const string filename)