GDB (API)
/home/stan/gdb/src/gdb/rl78-tdep.c
Go to the documentation of this file.
00001 /* Target-dependent code for the Renesas RL78 for GDB, the GNU debugger.
00002 
00003    Copyright (C) 2011-2013 Free Software Foundation, Inc.
00004 
00005    Contributed by Red Hat, Inc.
00006 
00007    This file is part of GDB.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 3 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00021 
00022 #include "defs.h"
00023 #include "arch-utils.h"
00024 #include "prologue-value.h"
00025 #include "target.h"
00026 #include "regcache.h"
00027 #include "opcode/rl78.h"
00028 #include "dis-asm.h"
00029 #include "gdbtypes.h"
00030 #include "frame.h"
00031 #include "frame-unwind.h"
00032 #include "frame-base.h"
00033 #include "value.h"
00034 #include "gdbcore.h"
00035 #include "dwarf2-frame.h"
00036 #include "reggroups.h"
00037 
00038 #include "elf/rl78.h"
00039 #include "elf-bfd.h"
00040 
00041 /* Register Banks.  */
00042 
00043 enum
00044 {
00045   RL78_BANK0 = 0,
00046   RL78_BANK1 = 1,
00047   RL78_BANK2 = 2,
00048   RL78_BANK3 = 3,
00049   RL78_NUMBANKS = 4,
00050   RL78_REGS_PER_BANK = 8
00051 };
00052 
00053 /* Register Numbers.  */
00054 
00055 enum
00056 {
00057   /* All general purpose registers are 8 bits wide.  */
00058   RL78_RAW_BANK0_R0_REGNUM = 0,
00059   RL78_RAW_BANK0_R1_REGNUM,
00060   RL78_RAW_BANK0_R2_REGNUM,
00061   RL78_RAW_BANK0_R3_REGNUM,
00062   RL78_RAW_BANK0_R4_REGNUM,
00063   RL78_RAW_BANK0_R5_REGNUM,
00064   RL78_RAW_BANK0_R6_REGNUM,
00065   RL78_RAW_BANK0_R7_REGNUM,
00066 
00067   RL78_RAW_BANK1_R0_REGNUM,
00068   RL78_RAW_BANK1_R1_REGNUM,
00069   RL78_RAW_BANK1_R2_REGNUM,
00070   RL78_RAW_BANK1_R3_REGNUM,
00071   RL78_RAW_BANK1_R4_REGNUM,
00072   RL78_RAW_BANK1_R5_REGNUM,
00073   RL78_RAW_BANK1_R6_REGNUM,
00074   RL78_RAW_BANK1_R7_REGNUM,
00075 
00076   RL78_RAW_BANK2_R0_REGNUM,
00077   RL78_RAW_BANK2_R1_REGNUM,
00078   RL78_RAW_BANK2_R2_REGNUM,
00079   RL78_RAW_BANK2_R3_REGNUM,
00080   RL78_RAW_BANK2_R4_REGNUM,
00081   RL78_RAW_BANK2_R5_REGNUM,
00082   RL78_RAW_BANK2_R6_REGNUM,
00083   RL78_RAW_BANK2_R7_REGNUM,
00084 
00085   RL78_RAW_BANK3_R0_REGNUM,
00086   RL78_RAW_BANK3_R1_REGNUM,
00087   RL78_RAW_BANK3_R2_REGNUM,
00088   RL78_RAW_BANK3_R3_REGNUM,
00089   RL78_RAW_BANK3_R4_REGNUM,
00090   RL78_RAW_BANK3_R5_REGNUM,
00091   RL78_RAW_BANK3_R6_REGNUM,
00092   RL78_RAW_BANK3_R7_REGNUM,
00093 
00094   RL78_PSW_REGNUM,      /* 8 bits */
00095   RL78_ES_REGNUM,       /* 8 bits */
00096   RL78_CS_REGNUM,       /* 8 bits */
00097   RL78_RAW_PC_REGNUM,   /* 20 bits; we'll use 32 bits for it.  */
00098 
00099   /* Fixed address SFRs (some of those above are SFRs too.) */
00100   RL78_SPL_REGNUM,      /* 8 bits; lower half of SP */
00101   RL78_SPH_REGNUM,      /* 8 bits; upper half of SP */
00102   RL78_PMC_REGNUM,      /* 8 bits */
00103   RL78_MEM_REGNUM,      /* 8 bits ?? */
00104 
00105   RL78_NUM_REGS,
00106 
00107   /* Pseudo registers.  */
00108   RL78_PC_REGNUM = RL78_NUM_REGS,
00109   RL78_SP_REGNUM,
00110 
00111   RL78_X_REGNUM,
00112   RL78_A_REGNUM,
00113   RL78_C_REGNUM,
00114   RL78_B_REGNUM,
00115   RL78_E_REGNUM,
00116   RL78_D_REGNUM,
00117   RL78_L_REGNUM,
00118   RL78_H_REGNUM,
00119 
00120   RL78_AX_REGNUM,
00121   RL78_BC_REGNUM,
00122   RL78_DE_REGNUM,
00123   RL78_HL_REGNUM,
00124 
00125   RL78_BANK0_R0_REGNUM,
00126   RL78_BANK0_R1_REGNUM,
00127   RL78_BANK0_R2_REGNUM,
00128   RL78_BANK0_R3_REGNUM,
00129   RL78_BANK0_R4_REGNUM,
00130   RL78_BANK0_R5_REGNUM,
00131   RL78_BANK0_R6_REGNUM,
00132   RL78_BANK0_R7_REGNUM,
00133 
00134   RL78_BANK1_R0_REGNUM,
00135   RL78_BANK1_R1_REGNUM,
00136   RL78_BANK1_R2_REGNUM,
00137   RL78_BANK1_R3_REGNUM,
00138   RL78_BANK1_R4_REGNUM,
00139   RL78_BANK1_R5_REGNUM,
00140   RL78_BANK1_R6_REGNUM,
00141   RL78_BANK1_R7_REGNUM,
00142 
00143   RL78_BANK2_R0_REGNUM,
00144   RL78_BANK2_R1_REGNUM,
00145   RL78_BANK2_R2_REGNUM,
00146   RL78_BANK2_R3_REGNUM,
00147   RL78_BANK2_R4_REGNUM,
00148   RL78_BANK2_R5_REGNUM,
00149   RL78_BANK2_R6_REGNUM,
00150   RL78_BANK2_R7_REGNUM,
00151 
00152   RL78_BANK3_R0_REGNUM,
00153   RL78_BANK3_R1_REGNUM,
00154   RL78_BANK3_R2_REGNUM,
00155   RL78_BANK3_R3_REGNUM,
00156   RL78_BANK3_R4_REGNUM,
00157   RL78_BANK3_R5_REGNUM,
00158   RL78_BANK3_R6_REGNUM,
00159   RL78_BANK3_R7_REGNUM,
00160 
00161   RL78_BANK0_RP0_REGNUM,
00162   RL78_BANK0_RP1_REGNUM,
00163   RL78_BANK0_RP2_REGNUM,
00164   RL78_BANK0_RP3_REGNUM,
00165 
00166   RL78_BANK1_RP0_REGNUM,
00167   RL78_BANK1_RP1_REGNUM,
00168   RL78_BANK1_RP2_REGNUM,
00169   RL78_BANK1_RP3_REGNUM,
00170 
00171   RL78_BANK2_RP0_REGNUM,
00172   RL78_BANK2_RP1_REGNUM,
00173   RL78_BANK2_RP2_REGNUM,
00174   RL78_BANK2_RP3_REGNUM,
00175 
00176   RL78_BANK3_RP0_REGNUM,
00177   RL78_BANK3_RP1_REGNUM,
00178   RL78_BANK3_RP2_REGNUM,
00179   RL78_BANK3_RP3_REGNUM,
00180 
00181   RL78_NUM_TOTAL_REGS,
00182   RL78_NUM_PSEUDO_REGS = RL78_NUM_TOTAL_REGS - RL78_NUM_REGS
00183 };
00184 
00185 /* Architecture specific data.  */
00186 
00187 struct gdbarch_tdep
00188 {
00189   /* The ELF header flags specify the multilib used.  */
00190   int elf_flags;
00191 
00192   struct type *rl78_void,
00193               *rl78_uint8,
00194               *rl78_int8,
00195               *rl78_uint16,
00196               *rl78_int16,
00197               *rl78_uint32,
00198               *rl78_int32,
00199               *rl78_data_pointer,
00200               *rl78_code_pointer;
00201 };
00202 
00203 /* This structure holds the results of a prologue analysis.  */
00204 
00205 struct rl78_prologue
00206 {
00207   /* The offset from the frame base to the stack pointer --- always
00208      zero or negative.
00209 
00210      Calling this a "size" is a bit misleading, but given that the
00211      stack grows downwards, using offsets for everything keeps one
00212      from going completely sign-crazy: you never change anything's
00213      sign for an ADD instruction; always change the second operand's
00214      sign for a SUB instruction; and everything takes care of
00215      itself.  */
00216   int frame_size;
00217 
00218   /* Non-zero if this function has initialized the frame pointer from
00219      the stack pointer, zero otherwise.  */
00220   int has_frame_ptr;
00221 
00222   /* If has_frame_ptr is non-zero, this is the offset from the frame
00223      base to where the frame pointer points.  This is always zero or
00224      negative.  */
00225   int frame_ptr_offset;
00226 
00227   /* The address of the first instruction at which the frame has been
00228      set up and the arguments are where the debug info says they are
00229      --- as best as we can tell.  */
00230   CORE_ADDR prologue_end;
00231 
00232   /* reg_offset[R] is the offset from the CFA at which register R is
00233      saved, or 1 if register R has not been saved.  (Real values are
00234      always zero or negative.)  */
00235   int reg_offset[RL78_NUM_TOTAL_REGS];
00236 };
00237 
00238 /* Implement the "register_type" gdbarch method.  */
00239 
00240 static struct type *
00241 rl78_register_type (struct gdbarch *gdbarch, int reg_nr)
00242 {
00243   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
00244 
00245   if (reg_nr == RL78_PC_REGNUM)
00246     return tdep->rl78_code_pointer;
00247   else if (reg_nr == RL78_RAW_PC_REGNUM)
00248     return tdep->rl78_uint32;
00249   else if (reg_nr <= RL78_MEM_REGNUM
00250            || (RL78_X_REGNUM <= reg_nr && reg_nr <= RL78_H_REGNUM)
00251            || (RL78_BANK0_R0_REGNUM <= reg_nr
00252                && reg_nr <= RL78_BANK3_R7_REGNUM))
00253     return tdep->rl78_int8;
00254   else
00255     return tdep->rl78_data_pointer;
00256 }
00257 
00258 /* Implement the "register_name" gdbarch method.  */
00259 
00260 static const char *
00261 rl78_register_name (struct gdbarch *gdbarch, int regnr)
00262 {
00263   static const char *const reg_names[] =
00264   {
00265     "",         /* bank0_r0 */
00266     "",         /* bank0_r1 */
00267     "",         /* bank0_r2 */
00268     "",         /* bank0_r3 */
00269     "",         /* bank0_r4 */
00270     "",         /* bank0_r5 */
00271     "",         /* bank0_r6 */
00272     "",         /* bank0_r7 */
00273 
00274     "",         /* bank1_r0 */
00275     "",         /* bank1_r1 */
00276     "",         /* bank1_r2 */
00277     "",         /* bank1_r3 */
00278     "",         /* bank1_r4 */
00279     "",         /* bank1_r5 */
00280     "",         /* bank1_r6 */
00281     "",         /* bank1_r7 */
00282 
00283     "",         /* bank2_r0 */
00284     "",         /* bank2_r1 */
00285     "",         /* bank2_r2 */
00286     "",         /* bank2_r3 */
00287     "",         /* bank2_r4 */
00288     "",         /* bank2_r5 */
00289     "",         /* bank2_r6 */
00290     "",         /* bank2_r7 */
00291 
00292     "",         /* bank3_r0 */
00293     "",         /* bank3_r1 */
00294     "",         /* bank3_r2 */
00295     "",         /* bank3_r3 */
00296     "",         /* bank3_r4 */
00297     "",         /* bank3_r5 */
00298     "",         /* bank3_r6 */
00299     "",         /* bank3_r7 */
00300 
00301     "psw",
00302     "es",
00303     "cs",
00304     "",
00305 
00306     "",         /* spl */
00307     "",         /* sph */
00308     "pmc",
00309     "mem",
00310 
00311     "pc",
00312     "sp",
00313 
00314     "x",
00315     "a",
00316     "c",
00317     "b",
00318     "e",
00319     "d",
00320     "l",
00321     "h",
00322 
00323     "ax",
00324     "bc",
00325     "de",
00326     "hl",
00327 
00328     "bank0_r0",
00329     "bank0_r1",
00330     "bank0_r2",
00331     "bank0_r3",
00332     "bank0_r4",
00333     "bank0_r5",
00334     "bank0_r6",
00335     "bank0_r7",
00336 
00337     "bank1_r0",
00338     "bank1_r1",
00339     "bank1_r2",
00340     "bank1_r3",
00341     "bank1_r4",
00342     "bank1_r5",
00343     "bank1_r6",
00344     "bank1_r7",
00345 
00346     "bank2_r0",
00347     "bank2_r1",
00348     "bank2_r2",
00349     "bank2_r3",
00350     "bank2_r4",
00351     "bank2_r5",
00352     "bank2_r6",
00353     "bank2_r7",
00354 
00355     "bank3_r0",
00356     "bank3_r1",
00357     "bank3_r2",
00358     "bank3_r3",
00359     "bank3_r4",
00360     "bank3_r5",
00361     "bank3_r6",
00362     "bank3_r7",
00363 
00364     "bank0_rp0",
00365     "bank0_rp1",
00366     "bank0_rp2",
00367     "bank0_rp3",
00368 
00369     "bank1_rp0",
00370     "bank1_rp1",
00371     "bank1_rp2",
00372     "bank1_rp3",
00373 
00374     "bank2_rp0",
00375     "bank2_rp1",
00376     "bank2_rp2",
00377     "bank2_rp3",
00378 
00379     "bank3_rp0",
00380     "bank3_rp1",
00381     "bank3_rp2",
00382     "bank3_rp3"
00383   };
00384 
00385   return reg_names[regnr];
00386 }
00387 
00388 /* Implement the "register_reggroup_p" gdbarch method.  */
00389 
00390 static int
00391 rl78_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
00392                           struct reggroup *group)
00393 {
00394   if (group == all_reggroup)
00395     return 1;
00396 
00397   /* All other registers are saved and restored.  */
00398   if (group == save_reggroup || group == restore_reggroup)
00399     {
00400       if ((regnum < RL78_NUM_REGS
00401            && regnum != RL78_SPL_REGNUM
00402            && regnum != RL78_SPH_REGNUM
00403            && regnum != RL78_RAW_PC_REGNUM)
00404           || regnum == RL78_SP_REGNUM
00405           || regnum == RL78_PC_REGNUM)
00406         return 1;
00407       else
00408         return 0;
00409     }
00410 
00411   if ((RL78_BANK0_R0_REGNUM <= regnum && regnum <= RL78_BANK3_R7_REGNUM)
00412       || regnum == RL78_ES_REGNUM
00413       || regnum == RL78_CS_REGNUM
00414       || regnum == RL78_SPL_REGNUM
00415       || regnum == RL78_SPH_REGNUM
00416       || regnum == RL78_PMC_REGNUM
00417       || regnum == RL78_MEM_REGNUM
00418       || regnum == RL78_RAW_PC_REGNUM
00419       || (RL78_BANK0_RP0_REGNUM <= regnum && regnum <= RL78_BANK3_RP3_REGNUM))
00420     return group == system_reggroup;
00421 
00422   return group == general_reggroup;
00423 }
00424 
00425 /* Strip bits to form an instruction address.  (When fetching a
00426    32-bit address from the stack, the high eight bits are garbage.
00427    This function strips off those unused bits.)  */
00428 
00429 static CORE_ADDR
00430 rl78_make_instruction_address (CORE_ADDR addr)
00431 {
00432   return addr & 0xffffff;
00433 }
00434 
00435 /* Set / clear bits necessary to make a data address.  */
00436 
00437 static CORE_ADDR
00438 rl78_make_data_address (CORE_ADDR addr)
00439 {
00440   return (addr & 0xffff) | 0xf0000;
00441 }
00442 
00443 /* Implement the "pseudo_register_read" gdbarch method.  */
00444 
00445 static enum register_status
00446 rl78_pseudo_register_read (struct gdbarch *gdbarch,
00447                            struct regcache *regcache,
00448                            int reg, gdb_byte *buffer)
00449 {
00450   enum register_status status;
00451 
00452   if (RL78_BANK0_R0_REGNUM <= reg && reg <= RL78_BANK3_R7_REGNUM)
00453     {
00454       int raw_regnum = RL78_RAW_BANK0_R0_REGNUM
00455                        + (reg - RL78_BANK0_R0_REGNUM);
00456 
00457       status = regcache_raw_read (regcache, raw_regnum, buffer);
00458     }
00459   else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM)
00460     {
00461       int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM)
00462                        + RL78_RAW_BANK0_R0_REGNUM;
00463 
00464       status = regcache_raw_read (regcache, raw_regnum, buffer);
00465       if (status == REG_VALID)
00466         status = regcache_raw_read (regcache, raw_regnum + 1, buffer + 1);
00467     }
00468   else if (reg == RL78_SP_REGNUM)
00469     {
00470       status = regcache_raw_read (regcache, RL78_SPL_REGNUM, buffer);
00471       if (status == REG_VALID)
00472         status = regcache_raw_read (regcache, RL78_SPH_REGNUM, buffer + 1);
00473     }
00474   else if (reg == RL78_PC_REGNUM)
00475     {
00476       gdb_byte rawbuf[4];
00477 
00478       status = regcache_raw_read (regcache, RL78_RAW_PC_REGNUM, rawbuf);
00479       memcpy (buffer, rawbuf, 3);
00480     }
00481   else if (RL78_X_REGNUM <= reg && reg <= RL78_H_REGNUM)
00482     {
00483       ULONGEST psw;
00484 
00485       status = regcache_raw_read_unsigned (regcache, RL78_PSW_REGNUM, &psw);
00486       if (status == REG_VALID)
00487         {
00488           /* RSB0 is at bit 3; RSBS1 is at bit 5.  */
00489           int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
00490           int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
00491                            + (reg - RL78_X_REGNUM);
00492           status = regcache_raw_read (regcache, raw_regnum, buffer);
00493         }
00494     }
00495   else if (RL78_AX_REGNUM <= reg && reg <= RL78_HL_REGNUM)
00496     {
00497       ULONGEST psw;
00498 
00499       status = regcache_raw_read_unsigned (regcache, RL78_PSW_REGNUM, &psw);
00500       if (status == REG_VALID)
00501         {
00502           /* RSB0 is at bit 3; RSBS1 is at bit 5.  */
00503           int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
00504           int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
00505                            + 2 * (reg - RL78_AX_REGNUM);
00506           status = regcache_raw_read (regcache, raw_regnum, buffer);
00507           if (status == REG_VALID)
00508             status = regcache_raw_read (regcache, raw_regnum + 1,
00509                                         buffer + 1);
00510         }
00511     }
00512   else
00513     gdb_assert_not_reached ("invalid pseudo register number");
00514   return status;
00515 }
00516 
00517 /* Implement the "pseudo_register_write" gdbarch method.  */
00518 
00519 static void
00520 rl78_pseudo_register_write (struct gdbarch *gdbarch,
00521                             struct regcache *regcache,
00522                             int reg, const gdb_byte *buffer)
00523 {
00524   if (RL78_BANK0_R0_REGNUM <= reg && reg <= RL78_BANK3_R7_REGNUM)
00525     {
00526       int raw_regnum = RL78_RAW_BANK0_R0_REGNUM
00527                        + (reg - RL78_BANK0_R0_REGNUM);
00528 
00529       regcache_raw_write (regcache, raw_regnum, buffer);
00530     }
00531   else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM)
00532     {
00533       int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM)
00534                        + RL78_RAW_BANK0_R0_REGNUM;
00535 
00536       regcache_raw_write (regcache, raw_regnum, buffer);
00537       regcache_raw_write (regcache, raw_regnum + 1, buffer + 1);
00538     }
00539   else if (reg == RL78_SP_REGNUM)
00540     {
00541       regcache_raw_write (regcache, RL78_SPL_REGNUM, buffer);
00542       regcache_raw_write (regcache, RL78_SPH_REGNUM, buffer + 1);
00543     }
00544   else if (reg == RL78_PC_REGNUM)
00545     {
00546       gdb_byte rawbuf[4];
00547 
00548       memcpy (rawbuf, buffer, 3);
00549       rawbuf[3] = 0;
00550       regcache_raw_write (regcache, RL78_RAW_PC_REGNUM, rawbuf);
00551     }
00552   else if (RL78_X_REGNUM <= reg && reg <= RL78_H_REGNUM)
00553     {
00554       ULONGEST psw;
00555       int bank;
00556       int raw_regnum;
00557 
00558       regcache_raw_read_unsigned (regcache, RL78_PSW_REGNUM, &psw);
00559       bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
00560       /* RSB0 is at bit 3; RSBS1 is at bit 5.  */
00561       raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
00562                    + (reg - RL78_X_REGNUM);
00563       regcache_raw_write (regcache, raw_regnum, buffer);
00564     }
00565   else if (RL78_AX_REGNUM <= reg && reg <= RL78_HL_REGNUM)
00566     {
00567       ULONGEST psw;
00568       int bank, raw_regnum;
00569 
00570       regcache_raw_read_unsigned (regcache, RL78_PSW_REGNUM, &psw);
00571       bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
00572       /* RSB0 is at bit 3; RSBS1 is at bit 5.  */
00573       raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
00574                    + 2 * (reg - RL78_AX_REGNUM);
00575       regcache_raw_write (regcache, raw_regnum, buffer);
00576       regcache_raw_write (regcache, raw_regnum + 1, buffer + 1);
00577     }
00578   else
00579     gdb_assert_not_reached ("invalid pseudo register number");
00580 }
00581 
00582 /* Implement the "breakpoint_from_pc" gdbarch method.  */
00583 
00584 static const gdb_byte *
00585 rl78_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
00586                          int *lenptr)
00587 {
00588   /* The documented BRK instruction is actually a two byte sequence,
00589      {0x61, 0xcc}, but instructions may be as short as one byte.
00590      Correspondence with Renesas revealed that the one byte sequence
00591      0xff is used when a one byte breakpoint instruction is required.  */
00592   static gdb_byte breakpoint[] = { 0xff };
00593 
00594   *lenptr = sizeof breakpoint;
00595   return breakpoint;
00596 }
00597 
00598 /* Define a "handle" struct for fetching the next opcode.  */
00599 
00600 struct rl78_get_opcode_byte_handle
00601 {
00602   CORE_ADDR pc;
00603 };
00604 
00605 /* Fetch a byte on behalf of the opcode decoder.  HANDLE contains
00606    the memory address of the next byte to fetch.  If successful,
00607    the address in the handle is updated and the byte fetched is
00608    returned as the value of the function.  If not successful, -1
00609    is returned.  */
00610 
00611 static int
00612 rl78_get_opcode_byte (void *handle)
00613 {
00614   struct rl78_get_opcode_byte_handle *opcdata = handle;
00615   int status;
00616   gdb_byte byte;
00617 
00618   status = target_read_memory (opcdata->pc, &byte, 1);
00619   if (status == 0)
00620     {
00621       opcdata->pc += 1;
00622       return byte;
00623     }
00624   else
00625     return -1;
00626 }
00627 
00628 /* Function for finding saved registers in a 'struct pv_area'; this
00629    function is passed to pv_area_scan.
00630 
00631    If VALUE is a saved register, ADDR says it was saved at a constant
00632    offset from the frame base, and SIZE indicates that the whole
00633    register was saved, record its offset.  */
00634 
00635 static void
00636 check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size,
00637                  pv_t value)
00638 {
00639   struct rl78_prologue *result = (struct rl78_prologue *) result_untyped;
00640 
00641   if (value.kind == pvk_register
00642       && value.k == 0
00643       && pv_is_register (addr, RL78_SP_REGNUM)
00644       && size == register_size (target_gdbarch (), value.reg))
00645     result->reg_offset[value.reg] = addr.k;
00646 }
00647 
00648 /* Analyze a prologue starting at START_PC, going no further than
00649    LIMIT_PC.  Fill in RESULT as appropriate.  */
00650 
00651 static void
00652 rl78_analyze_prologue (CORE_ADDR start_pc,
00653                        CORE_ADDR limit_pc, struct rl78_prologue *result)
00654 {
00655   CORE_ADDR pc, next_pc;
00656   int rn;
00657   pv_t reg[RL78_NUM_TOTAL_REGS];
00658   struct pv_area *stack;
00659   struct cleanup *back_to;
00660   CORE_ADDR after_last_frame_setup_insn = start_pc;
00661   int bank = 0;
00662 
00663   memset (result, 0, sizeof (*result));
00664 
00665   for (rn = 0; rn < RL78_NUM_TOTAL_REGS; rn++)
00666     {
00667       reg[rn] = pv_register (rn, 0);
00668       result->reg_offset[rn] = 1;
00669     }
00670 
00671   stack = make_pv_area (RL78_SP_REGNUM, gdbarch_addr_bit (target_gdbarch ()));
00672   back_to = make_cleanup_free_pv_area (stack);
00673 
00674   /* The call instruction has saved the return address on the stack.  */
00675   reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM], -4);
00676   pv_area_store (stack, reg[RL78_SP_REGNUM], 4, reg[RL78_PC_REGNUM]);
00677 
00678   pc = start_pc;
00679   while (pc < limit_pc)
00680     {
00681       int bytes_read;
00682       struct rl78_get_opcode_byte_handle opcode_handle;
00683       RL78_Opcode_Decoded opc;
00684 
00685       opcode_handle.pc = pc;
00686       bytes_read = rl78_decode_opcode (pc, &opc, rl78_get_opcode_byte,
00687                                      &opcode_handle);
00688       next_pc = pc + bytes_read;
00689 
00690       if (opc.id == RLO_sel)
00691         {
00692           bank = opc.op[1].addend;
00693         }
00694       else if (opc.id == RLO_mov
00695                && opc.op[0].type == RL78_Operand_PreDec
00696                && opc.op[0].reg == RL78_Reg_SP
00697                && opc.op[1].type == RL78_Operand_Register)
00698         {
00699           int rsrc = (bank * RL78_REGS_PER_BANK) 
00700                    + 2 * (opc.op[1].reg - RL78_Reg_AX);
00701 
00702           reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM], -1);
00703           pv_area_store (stack, reg[RL78_SP_REGNUM], 1, reg[rsrc]);
00704           reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM], -1);
00705           pv_area_store (stack, reg[RL78_SP_REGNUM], 1, reg[rsrc + 1]);
00706           after_last_frame_setup_insn = next_pc;
00707         }
00708       else if (opc.id == RLO_sub
00709                && opc.op[0].type == RL78_Operand_Register
00710                && opc.op[0].reg == RL78_Reg_SP
00711                && opc.op[1].type == RL78_Operand_Immediate)
00712         {
00713           int addend = opc.op[1].addend;
00714 
00715           reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM],
00716                                                  -addend);
00717           after_last_frame_setup_insn = next_pc;
00718         }
00719       else
00720         {
00721           /* Terminate the prologue scan.  */
00722           break;
00723         }
00724 
00725       pc = next_pc;
00726     }
00727 
00728   /* Is the frame size (offset, really) a known constant?  */
00729   if (pv_is_register (reg[RL78_SP_REGNUM], RL78_SP_REGNUM))
00730     result->frame_size = reg[RL78_SP_REGNUM].k;
00731 
00732   /* Record where all the registers were saved.  */
00733   pv_area_scan (stack, check_for_saved, (void *) result);
00734 
00735   result->prologue_end = after_last_frame_setup_insn;
00736 
00737   do_cleanups (back_to);
00738 }
00739 
00740 /* Implement the "addr_bits_remove" gdbarch method.  */
00741 
00742 static CORE_ADDR
00743 rl78_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
00744 {
00745   return addr & 0xffffff;
00746 }
00747 
00748 /* Implement the "address_to_pointer" gdbarch method.  */
00749 
00750 static void
00751 rl78_address_to_pointer (struct gdbarch *gdbarch,
00752                          struct type *type, gdb_byte *buf, CORE_ADDR addr)
00753 {
00754   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00755 
00756   store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
00757                           addr & 0xffffff);
00758 }
00759 
00760 /* Implement the "pointer_to_address" gdbarch method.  */
00761 
00762 static CORE_ADDR
00763 rl78_pointer_to_address (struct gdbarch *gdbarch,
00764                          struct type *type, const gdb_byte *buf)
00765 {
00766   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00767   CORE_ADDR addr
00768     = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
00769 
00770   /* Is it a code address?  */
00771   if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
00772       || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
00773       || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))
00774       || TYPE_LENGTH (type) == 4)
00775     return rl78_make_instruction_address (addr);
00776   else
00777     return rl78_make_data_address (addr);
00778 }
00779 
00780 /* Implement the "skip_prologue" gdbarch method.  */
00781 
00782 static CORE_ADDR
00783 rl78_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
00784 {
00785   const char *name;
00786   CORE_ADDR func_addr, func_end;
00787   struct rl78_prologue p;
00788 
00789   /* Try to find the extent of the function that contains PC.  */
00790   if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
00791     return pc;
00792 
00793   rl78_analyze_prologue (pc, func_end, &p);
00794   return p.prologue_end;
00795 }
00796 
00797 /* Implement the "unwind_pc" gdbarch method.  */
00798 
00799 static CORE_ADDR
00800 rl78_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
00801 {
00802   return rl78_addr_bits_remove
00803            (arch, frame_unwind_register_unsigned (next_frame,
00804                                                   RL78_PC_REGNUM));
00805 }
00806 
00807 /* Implement the "unwind_sp" gdbarch method.  */
00808 
00809 static CORE_ADDR
00810 rl78_unwind_sp (struct gdbarch *arch, struct frame_info *next_frame)
00811 {
00812   return frame_unwind_register_unsigned (next_frame, RL78_SP_REGNUM);
00813 }
00814 
00815 /* Given a frame described by THIS_FRAME, decode the prologue of its
00816    associated function if there is not cache entry as specified by
00817    THIS_PROLOGUE_CACHE.  Save the decoded prologue in the cache and
00818    return that struct as the value of this function.  */
00819 
00820 static struct rl78_prologue *
00821 rl78_analyze_frame_prologue (struct frame_info *this_frame,
00822                            void **this_prologue_cache)
00823 {
00824   if (!*this_prologue_cache)
00825     {
00826       CORE_ADDR func_start, stop_addr;
00827 
00828       *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct rl78_prologue);
00829 
00830       func_start = get_frame_func (this_frame);
00831       stop_addr = get_frame_pc (this_frame);
00832 
00833       /* If we couldn't find any function containing the PC, then
00834          just initialize the prologue cache, but don't do anything.  */
00835       if (!func_start)
00836         stop_addr = func_start;
00837 
00838       rl78_analyze_prologue (func_start, stop_addr, *this_prologue_cache);
00839     }
00840 
00841   return *this_prologue_cache;
00842 }
00843 
00844 /* Given a frame and a prologue cache, return this frame's base.  */
00845 
00846 static CORE_ADDR
00847 rl78_frame_base (struct frame_info *this_frame, void **this_prologue_cache)
00848 {
00849   struct rl78_prologue *p
00850     = rl78_analyze_frame_prologue (this_frame, this_prologue_cache);
00851   CORE_ADDR sp = get_frame_register_unsigned (this_frame, RL78_SP_REGNUM);
00852 
00853   return rl78_make_data_address (sp - p->frame_size);
00854 }
00855 
00856 /* Implement the "frame_this_id" method for unwinding frames.  */
00857 
00858 static void
00859 rl78_this_id (struct frame_info *this_frame,
00860               void **this_prologue_cache, struct frame_id *this_id)
00861 {
00862   *this_id = frame_id_build (rl78_frame_base (this_frame,
00863                                               this_prologue_cache),
00864                              get_frame_func (this_frame));
00865 }
00866 
00867 /* Implement the "frame_prev_register" method for unwinding frames.  */
00868 
00869 static struct value *
00870 rl78_prev_register (struct frame_info *this_frame,
00871                     void **this_prologue_cache, int regnum)
00872 {
00873   struct rl78_prologue *p
00874     = rl78_analyze_frame_prologue (this_frame, this_prologue_cache);
00875   CORE_ADDR frame_base = rl78_frame_base (this_frame, this_prologue_cache);
00876 
00877   if (regnum == RL78_SP_REGNUM)
00878     return frame_unwind_got_constant (this_frame, regnum, frame_base);
00879 
00880   else if (regnum == RL78_SPL_REGNUM)
00881     return frame_unwind_got_constant (this_frame, regnum,
00882                                       (frame_base & 0xff));
00883 
00884   else if (regnum == RL78_SPH_REGNUM)
00885     return frame_unwind_got_constant (this_frame, regnum,
00886                                       ((frame_base >> 8) & 0xff));
00887 
00888   /* If prologue analysis says we saved this register somewhere,
00889      return a description of the stack slot holding it.  */
00890   else if (p->reg_offset[regnum] != 1)
00891     {
00892       struct value *rv =
00893         frame_unwind_got_memory (this_frame, regnum,
00894                                  frame_base + p->reg_offset[regnum]);
00895 
00896       if (regnum == RL78_PC_REGNUM)
00897         {
00898           ULONGEST pc = rl78_make_instruction_address (value_as_long (rv));
00899 
00900           return frame_unwind_got_constant (this_frame, regnum, pc);
00901         }
00902       return rv;
00903     }
00904 
00905   /* Otherwise, presume we haven't changed the value of this
00906      register, and get it from the next frame.  */
00907   else
00908     return frame_unwind_got_register (this_frame, regnum, regnum);
00909 }
00910 
00911 static const struct frame_unwind rl78_unwind =
00912 {
00913   NORMAL_FRAME,
00914   default_frame_unwind_stop_reason,
00915   rl78_this_id,
00916   rl78_prev_register,
00917   NULL,
00918   default_frame_sniffer
00919 };
00920 
00921 /* Implement the "dwarf_reg_to_regnum" gdbarch method.  */
00922 
00923 static int
00924 rl78_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
00925 {
00926   if (0 <= reg && reg <= 31)
00927     {
00928       if ((reg & 1) == 0)
00929         /* Map even registers to their 16-bit counterparts.  This
00930            is usually what is required from the DWARF info.  */
00931         return (reg >> 1) + RL78_BANK0_RP0_REGNUM;
00932       else
00933         return reg;
00934     }
00935   else if (reg == 32)
00936     return RL78_SP_REGNUM;
00937   else if (reg == 33)
00938     return -1;                  /* ap */
00939   else if (reg == 34)
00940     return RL78_PSW_REGNUM;
00941   else if (reg == 35)
00942     return RL78_ES_REGNUM;
00943   else if (reg == 36)
00944     return RL78_CS_REGNUM;
00945   else if (reg == 37)
00946     return RL78_PC_REGNUM;
00947   else
00948     internal_error (__FILE__, __LINE__,
00949                     _("Undefined dwarf2 register mapping of reg %d"),
00950                     reg);
00951 }
00952 
00953 /* Implement the `register_sim_regno' gdbarch method.  */
00954 
00955 static int
00956 rl78_register_sim_regno (struct gdbarch *gdbarch, int regnum)
00957 {
00958   gdb_assert (regnum < RL78_NUM_REGS);
00959 
00960   /* So long as regnum is in [0, RL78_NUM_REGS), it's valid.  We
00961      just want to override the default here which disallows register
00962      numbers which have no names.  */
00963   return regnum;
00964 }
00965 
00966 /* Implement the "return_value" gdbarch method.  */
00967 
00968 static enum return_value_convention
00969 rl78_return_value (struct gdbarch *gdbarch,
00970                    struct value *function,
00971                    struct type *valtype,
00972                    struct regcache *regcache,
00973                    gdb_byte *readbuf, const gdb_byte *writebuf)
00974 {
00975   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00976   ULONGEST valtype_len = TYPE_LENGTH (valtype);
00977 
00978   if (valtype_len > 8)
00979     return RETURN_VALUE_STRUCT_CONVENTION;
00980 
00981   if (readbuf)
00982     {
00983       ULONGEST u;
00984       int argreg = RL78_RAW_BANK1_R0_REGNUM;
00985       int offset = 0;
00986 
00987       while (valtype_len > 0)
00988         {
00989           regcache_cooked_read_unsigned (regcache, argreg, &u);
00990           store_unsigned_integer (readbuf + offset, 1, byte_order, u);
00991           valtype_len -= 1;
00992           offset += 1;
00993           argreg++;
00994         }
00995     }
00996 
00997   if (writebuf)
00998     {
00999       ULONGEST u;
01000       int argreg = RL78_RAW_BANK1_R0_REGNUM;
01001       int offset = 0;
01002 
01003       while (valtype_len > 0)
01004         {
01005           u = extract_unsigned_integer (writebuf + offset, 1, byte_order);
01006           regcache_cooked_write_unsigned (regcache, argreg, u);
01007           valtype_len -= 1;
01008           offset += 1;
01009           argreg++;
01010         }
01011     }
01012 
01013   return RETURN_VALUE_REGISTER_CONVENTION;
01014 }
01015 
01016 
01017 /* Implement the "frame_align" gdbarch method.  */
01018 
01019 static CORE_ADDR
01020 rl78_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
01021 {
01022   return rl78_make_data_address (align_down (sp, 2));
01023 }
01024 
01025 
01026 /* Implement the "dummy_id" gdbarch method.  */
01027 
01028 static struct frame_id
01029 rl78_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
01030 {
01031   return
01032     frame_id_build (rl78_make_data_address
01033                       (get_frame_register_unsigned
01034                         (this_frame, RL78_SP_REGNUM)),
01035                     get_frame_pc (this_frame));
01036 }
01037 
01038 
01039 /* Implement the "push_dummy_call" gdbarch method.  */
01040 
01041 static CORE_ADDR
01042 rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
01043                       struct regcache *regcache, CORE_ADDR bp_addr,
01044                       int nargs, struct value **args, CORE_ADDR sp,
01045                       int struct_return, CORE_ADDR struct_addr)
01046 {
01047   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
01048   gdb_byte buf[4];
01049   int i;
01050 
01051   /* Push arguments in reverse order.  */
01052   for (i = nargs - 1; i >= 0; i--)
01053     {
01054       struct type *value_type = value_enclosing_type (args[i]);
01055       int len = TYPE_LENGTH (value_type);
01056       int container_len = (len + 1) & ~1;
01057 
01058       sp -= container_len;
01059       write_memory (rl78_make_data_address (sp),
01060                     value_contents_all (args[i]), len);
01061     }
01062 
01063   /* Store struct value address.  */
01064   if (struct_return)
01065     {
01066       store_unsigned_integer (buf, 2, byte_order, struct_addr);
01067       sp -= 2;
01068       write_memory (rl78_make_data_address (sp), buf, 2);
01069     }
01070 
01071   /* Store return address.  */
01072   sp -= 4;
01073   store_unsigned_integer (buf, 4, byte_order, bp_addr);
01074   write_memory (rl78_make_data_address (sp), buf, 4);
01075 
01076   /* Finally, update the stack pointer...  */
01077   regcache_cooked_write_unsigned (regcache, RL78_SP_REGNUM, sp);
01078 
01079   /* DWARF2/GCC uses the stack address *before* the function call as a
01080      frame's CFA.  */
01081   return rl78_make_data_address (sp + 4);
01082 }
01083 
01084 /* Allocate and initialize a gdbarch object.  */
01085 
01086 static struct gdbarch *
01087 rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
01088 {
01089   struct gdbarch *gdbarch;
01090   struct gdbarch_tdep *tdep;
01091   int elf_flags;
01092 
01093   /* Extract the elf_flags if available.  */
01094   if (info.abfd != NULL
01095       && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
01096     elf_flags = elf_elfheader (info.abfd)->e_flags;
01097   else
01098     elf_flags = 0;
01099 
01100 
01101   /* Try to find the architecture in the list of already defined
01102      architectures.  */
01103   for (arches = gdbarch_list_lookup_by_info (arches, &info);
01104        arches != NULL;
01105        arches = gdbarch_list_lookup_by_info (arches->next, &info))
01106     {
01107       if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
01108         continue;
01109 
01110       return arches->gdbarch;
01111     }
01112 
01113   /* None found, create a new architecture from the information
01114      provided.  */
01115   tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
01116   gdbarch = gdbarch_alloc (&info, tdep);
01117   tdep->elf_flags = elf_flags;
01118 
01119   /* Initialize types.  */
01120   tdep->rl78_void = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");
01121   tdep->rl78_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8_t");
01122   tdep->rl78_int8 = arch_integer_type (gdbarch, 8, 0, "int8_t");
01123   tdep->rl78_uint16 = arch_integer_type (gdbarch, 16, 1, "uint16_t");
01124   tdep->rl78_int16 = arch_integer_type (gdbarch, 16, 0, "int16_t");
01125   tdep->rl78_uint32 = arch_integer_type (gdbarch, 32, 1, "uint32_t");
01126   tdep->rl78_int32 = arch_integer_type (gdbarch, 32, 0, "int32_t");
01127 
01128   tdep->rl78_data_pointer
01129     = arch_type (gdbarch, TYPE_CODE_PTR, 16 / TARGET_CHAR_BIT,
01130                  xstrdup ("rl78_data_addr_t"));
01131   TYPE_TARGET_TYPE (tdep->rl78_data_pointer) = tdep->rl78_void;
01132   TYPE_UNSIGNED (tdep->rl78_data_pointer) = 1;
01133 
01134   tdep->rl78_code_pointer
01135     = arch_type (gdbarch, TYPE_CODE_PTR, 32 / TARGET_CHAR_BIT,
01136                  xstrdup ("rl78_code_addr_t"));
01137   TYPE_TARGET_TYPE (tdep->rl78_code_pointer) = tdep->rl78_void;
01138   TYPE_UNSIGNED (tdep->rl78_code_pointer) = 1;
01139 
01140   /* Registers.  */
01141   set_gdbarch_num_regs (gdbarch, RL78_NUM_REGS);
01142   set_gdbarch_num_pseudo_regs (gdbarch, RL78_NUM_PSEUDO_REGS);
01143   set_gdbarch_register_name (gdbarch, rl78_register_name);
01144   set_gdbarch_register_type (gdbarch, rl78_register_type);
01145   set_gdbarch_pc_regnum (gdbarch, RL78_PC_REGNUM);
01146   set_gdbarch_sp_regnum (gdbarch, RL78_SP_REGNUM);
01147   set_gdbarch_pseudo_register_read (gdbarch, rl78_pseudo_register_read);
01148   set_gdbarch_pseudo_register_write (gdbarch, rl78_pseudo_register_write);
01149   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, rl78_dwarf_reg_to_regnum);
01150   set_gdbarch_register_reggroup_p (gdbarch, rl78_register_reggroup_p);
01151   set_gdbarch_register_sim_regno (gdbarch, rl78_register_sim_regno);
01152 
01153   /* Data types.  */
01154   set_gdbarch_char_signed (gdbarch, 0);
01155   set_gdbarch_short_bit (gdbarch, 16);
01156   set_gdbarch_int_bit (gdbarch, 16);
01157   set_gdbarch_long_bit (gdbarch, 32);
01158   set_gdbarch_long_long_bit (gdbarch, 64);
01159   set_gdbarch_ptr_bit (gdbarch, 16);
01160   set_gdbarch_addr_bit (gdbarch, 32);
01161   set_gdbarch_dwarf2_addr_size (gdbarch, 4);
01162   set_gdbarch_float_bit (gdbarch, 32);
01163   set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
01164   set_gdbarch_double_bit (gdbarch, 32);
01165   set_gdbarch_long_double_bit (gdbarch, 64);
01166   set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
01167   set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
01168   set_gdbarch_pointer_to_address (gdbarch, rl78_pointer_to_address);
01169   set_gdbarch_address_to_pointer (gdbarch, rl78_address_to_pointer);
01170   set_gdbarch_addr_bits_remove (gdbarch, rl78_addr_bits_remove);
01171 
01172   /* Breakpoints.  */
01173   set_gdbarch_breakpoint_from_pc (gdbarch, rl78_breakpoint_from_pc);
01174   set_gdbarch_decr_pc_after_break (gdbarch, 1);
01175 
01176   /* Disassembly.  */
01177   set_gdbarch_print_insn (gdbarch, print_insn_rl78);
01178 
01179   /* Frames, prologues, etc.  */
01180   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
01181   set_gdbarch_skip_prologue (gdbarch, rl78_skip_prologue);
01182   set_gdbarch_unwind_pc (gdbarch, rl78_unwind_pc);
01183   set_gdbarch_unwind_sp (gdbarch, rl78_unwind_sp);
01184   set_gdbarch_frame_align (gdbarch, rl78_frame_align);
01185 
01186   dwarf2_append_unwinders (gdbarch);
01187   frame_unwind_append_unwinder (gdbarch, &rl78_unwind);
01188 
01189   /* Dummy frames, return values.  */
01190   set_gdbarch_dummy_id (gdbarch, rl78_dummy_id);
01191   set_gdbarch_push_dummy_call (gdbarch, rl78_push_dummy_call);
01192   set_gdbarch_return_value (gdbarch, rl78_return_value);
01193 
01194   /* Virtual tables.  */
01195   set_gdbarch_vbit_in_delta (gdbarch, 1);
01196 
01197   return gdbarch;
01198 }
01199 
01200 /* -Wmissing-prototypes */
01201 extern initialize_file_ftype _initialize_rl78_tdep;
01202 
01203 /* Register the above initialization routine.  */
01204 
01205 void
01206 _initialize_rl78_tdep (void)
01207 {
01208   register_gdbarch_init (bfd_arch_rl78, rl78_gdbarch_init);
01209 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines