Skip to content

Commit

Permalink
Start filling out rom_image format.
Browse files Browse the repository at this point in the history
  • Loading branch information
trhodeos committed Feb 27, 2018
1 parent 4cab2e3 commit 0cf6d2c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/print_elf/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main
import (
"debug/elf"
"os"
"fmt"
)

func main() {
path := os.Args[1]
f, err := elf.Open(path)
if err != nil { panic(err) }
defer f.Close()

fmt.Printf("%+v\n", f)
for _, sec := range(f.Sections) {
fmt.Printf("%+v\n", sec.SectionHeader)
}
}
15 changes: 15 additions & 0 deletions rom_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ import (
"os"
)

// Format:
// -- 0x0:
// romheader
// -- 0x40
// .text of Boot
// -- 0x40 + 2864 = 0xB70
// all of font
// -- 0x40 + 2864 + 1150 = 0xFEE
// -- 0x400:
// some len(0x10) preamble
// .text of entry.o
// -- 0x440:
// ???


func fill(f *os.File, fill byte, start int, end int) error {
if start > end {
return errors.New(fmt.Sprintf("When filling bytes, start [%d] is greater than end [%d].", start, end))
Expand Down

0 comments on commit 0cf6d2c

Please sign in to comment.