Gnu i8068 assembly language program with a relocation

Here is code directly from header.S:

BOOTSEG		= 0x07C0		/* original address of boot-sector */
SYSSEG		= 0x1000		/* historical load address >> 4 */

...

	.code16
	.section ".bstext", "ax"

	.global bootsect_start
bootsect_start:
...
	# Normalize the start address
	ljmp	$BOOTSEG, $start2

start2:
	movw	%cs, %ax
	movw	%ax, %ds

objdump was commanded to disassemble header.o with options set to

  1. Interpret the code as if it were executing in an i8086 computer (real, 16-bit mode).
  2. Show relocation records right under the machine code that each record patches.
  3. Print the source code

Here is the objdump command and its output captured by the script program:

Script started on Sat 10 Aug 2013 08:42:30 PM EDT
seth@knowledge:/sda15/GIT/linux/arch/x86/boot$ objdump -Mi8086 --disassemble --reloc --source header.o

header.o:     file format elf32-i386

Disassembly of section .bstext:

00000000 <bootsect_start>:
	.byte 0x4d
	.byte 0x5a
#endif

	# Normalize the start address
	ljmp	$BOOTSEG, $start2
   0:	ea 05 00 c0 07       	ljmp   $0x7c0,$0x5
			1: R_386_16	.bstext

00000005 <start2>:

start2:
	movw	%cs, %ax
   5:	8c c8                	mov    %cs,%ax

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: