It assumes that everything (code, data, bss) is loaded at address 0xC0100000. Every DEF file starts with a header. It was easy to get NASM to create DEF binaries. All I did was use the '-f bin' option so that it puts everything in the same place. Then I had the following code to create a program that would trigger INT3. I manually put the header, ORG and BITS directive in:
Code: Select all
org 0xC0100000
bits 32
db 'ADEF'
dd 7
db 0, 0, 1
db 'init'
resb 16 ; padding name 'init'
db 'PROJECT DARMA'
resb 7 ; padding developer name
dd _start
db 32
resb 44
_start:
mov eax,[_start]
int 3
jmp $
The question is basically: how do i get gcc to compile a program and assume that code, data and bss sections all start at 0xC0100000. And make it export my own executable format.