English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 02 September 2015, 16:48   #1
jeremysmith
 
Posts: n/a
Amiga Hunk HUNK_RELOC32

Hi folks,

The relocation hunk has a number of the number of relocations.

The problem is each relocation has just 1 long word.

I figure that there would be 2.

Let's take this line of assembly:

280: JSR 0x600 (where 0x600 is, in the executable: 0x0... 0x600 is after relocation has been parsed)

1 would specify the offset to the long that needs changing (282, after JSR opcode) and another one to indicate where the long points to (0x600).

So why is there only one 32-bit long? What am I missing?

Jeremy.

Last edited by jeremysmith; 02 September 2015 at 17:00. Reason: Changes
 
Old 02 September 2015, 19:41   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
http://eab.abime.net/showthread.php?t=78811 should answer it (and more).
Toni Wilen is offline  
Old 02 September 2015, 19:46   #3
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Each list of relocations is preceeded by what section (what hunk in your file) it is pointing into, and after having allocated all sections, you only need to add the address of the referenced section to the relocation entry, and the relocation is complete.
Leffmann is offline  
Old 02 September 2015, 20:52   #4
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by jeremysmith View Post
The relocation hunk has a number of the number of relocations.

The problem is each relocation has just 1 long word.

I figure that there would be 2.
There are 2 longwords of data used in calculating each relocated address.

1) the longword data at the relocated offset (in the code)
2) the longword of the hunk base in memory (not known until the hunk memory is allocated by the scatter loader)
matthey is offline  
Old 03 September 2015, 03:05   #5
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 520
I tried to make my wiki page as detailed as possible. There's Python "pseudo-code" taken from my disassembler.
copse is offline  
Old 03 September 2015, 18:57   #6
jeremysmith
 
Posts: n/a
Thanks copse. Actually, I wanted to know about the relocations as I'm writing a 68000 disassembler.

Now that I see you have written one, I can use that, so I don't have to worry about fixing mine!

I've got peasauce working now in Python.

Also thanks to everyone else for their help!

Cheers!

Last edited by jeremysmith; 03 September 2015 at 19:22.
 
Old 26 February 2016, 13:50   #7
Hedeon
Semi-Retired
 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 1,994
Try to make it PC-relative as much as possible is my advice:

JSR Label(pc) instead of JSR Label
Hedeon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Resourcer supporting OVERLAY hunk???? CFou! Coders. General 1 06 March 2017 23:06
Amiga Hunk Loadfile Format: HUNK_RELOC32 kiasanth Coders. System 3 25 June 2015 11:58
Input: Bad loadfile hunk Turran project.ClassicWB 0 23 November 2013 11:33
Bad LoadFile Hunk amiga support.Apps 4 26 June 2008 02:31
Problem with bad hunk files on WHDload Peanutuk support.Apps 12 01 August 2004 18:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:30.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.14553 seconds with 13 queries