public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* add eflags to basic_cpu
@ 2004-06-29 18:20 Stan Cox
  0 siblings, 0 replies; only message in thread
From: Stan Cox @ 2004-06-29 18:20 UTC (permalink / raw)
  To: sid

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]


This patch builds on Dave Brolley's machine extension to allow a
cgen-cpu component to access the eflags from the executable.  This
allows, for example, differentiating between different machine variants.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 4181.patch --]
[-- Type: text/x-patch, Size: 6565 bytes --]

component/loader/ChangeLog

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.
 
Index: component/loader/compLoader.cxx
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/loader/compLoader.cxx,v
retrieving revision 1.46
diff -u -2 -p -r1.46 compLoader.cxx
--- component/loader/compLoader.cxx	28 Apr 2004 17:29:58 -0000	1.46
+++ component/loader/compLoader.cxx	29 Jun 2004 18:09:04 -0000
@@ -122,4 +122,6 @@ protected:
   // 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
@@ -165,4 +167,5 @@ public:
       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);
@@ -250,8 +253,10 @@ class elf_loader: public generic_loader
       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;
@@ -265,4 +270,5 @@ class elf_loader: public generic_loader
 	  else
 	    this->endian_pin.drive(sidutil::endian_big);
+	  this->eflags_pin.drive((host_int_4) eflags);
 
 	  if (this->verbose_p)
Index: component/loader/elfload.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/loader/elfload.c,v
retrieving revision 1.16
diff -u -2 -p -r1.16 elfload.c
--- component/loader/elfload.c	16 May 2004 22:45:02 -0000	1.16
+++ component/loader/elfload.c	29 Jun 2004 18:09:04 -0000
@@ -83,5 +83,6 @@ textSectionAddress (unsigned long long a
 
 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];
@@ -91,4 +92,5 @@ readElfFile (PFLOAD func, unsigned* entr
   int psymSize;
   int psymNum;
+  int eFlags;
   unsigned long long secOffset;
   int secSize;
@@ -126,4 +128,5 @@ readElfFile (PFLOAD func, unsigned* entr
       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);
@@ -133,4 +136,5 @@ readElfFile (PFLOAD func, unsigned* entr
       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);
@@ -267,4 +271,5 @@ readElfFile (PFLOAD func, unsigned* entr
   *little_endian = littleEndian;
   *section_table = textSections;
+  *e_flags = eFlags;
 
   return 1;
Index: component/loader/elfload.h
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/loader/elfload.h,v
retrieving revision 1.11
diff -u -2 -p -r1.11 elfload.h
--- component/loader/elfload.h	12 Feb 2004 20:43:28 -0000	1.11
+++ component/loader/elfload.h	29 Jun 2004 18:09:04 -0000
@@ -49,5 +49,5 @@ extern int textSectionAddress(unsigned l
 /* 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

include/ChangeLog

2004-06-29  Stan Cox  <scox@redhat.com>

	* sidcpuutil.h (basic_cpu): Add eflags_set_pin, set_eflags.
 
Index: include/sidcpuutil.h
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/include/sidcpuutil.h,v
retrieving revision 1.49
diff -u -2 -p -r1.49 sidcpuutil.h
--- include/sidcpuutil.h	22 Mar 2004 22:16:17 -0000	1.49
+++ include/sidcpuutil.h	29 Jun 2004 18:09:04 -0000
@@ -408,4 +408,7 @@ namespace sidutil
     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
@@ -551,4 +554,5 @@ public:
       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 (),
@@ -576,4 +580,5 @@ public:
 	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);
@@ -707,4 +712,5 @@ public:
   {
     void set_endian(sid::host_int_4) {}
+    void set_eflags(sid::host_int_4) {}
 
   protected:
@@ -803,4 +809,5 @@ public:
   {
     void set_endian(sid::host_int_4) {}
+    void set_eflags(sid::host_int_4) {}
 
   protected:

main/dynamic/ChangeLog

2004-06-29  Stan Cox  <scox@redhat.com>

	* commonCfg.cxx (add_cpu):  Add eflags-set pin.
 
Index: main/dynamic/commonCfg.cxx
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/main/dynamic/commonCfg.cxx,v
retrieving revision 1.22
diff -u -2 -p -r1.22 commonCfg.cxx
--- main/dynamic/commonCfg.cxx	22 Mar 2004 22:17:31 -0000	1.22
+++ main/dynamic/commonCfg.cxx	29 Jun 2004 18:09:04 -0000
@@ -709,4 +709,5 @@ void LoaderCfg::add_cpu (CpuCfg *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!");
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-29 18:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-29 18:20 add eflags to basic_cpu Stan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).