fix_tios.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* fix_tios.c: Routines for TIOS-specific M68000 code fixup
  2. Copyright (C) 2003 Kevin Kofler
  3. Copyright (C) 2003 Sebastian Reichelt
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  15. #include "fix_tios.h"
  16. #include "tios.h"
  17. // Turn an M68000 absolute JRA/JSR to an F-Line jump.
  18. void M68kTIOSMakeFLineJump (RELOC *Reloc, I1 *Opcode, BOOLEAN IsJSR)
  19. {
  20. if ((Reloc->Size == 4) && (!(Reloc->Relative)))
  21. {
  22. // Optimize the JRA or JSR into an F-Line BRA.L or BSR.L.
  23. Opcode [0] = (IsJSR ? M68K_TIOS_BSR_L_0 : M68K_TIOS_BRA_L_0);
  24. Opcode [1] = (IsJSR ? M68K_TIOS_BSR_L_1 : M68K_TIOS_BRA_L_1);
  25. // Change the reloc to 4-byte relative.
  26. Reloc->Relative = TRUE;
  27. }
  28. }