github.com/usbarmory/armory-boot@v0.0.0-20240307133412-208c66a380b9/mem.go (about) 1 // https://github.com/usbarmory/armory-boot 2 // 3 // Copyright (c) WithSecure Corporation 4 // https://foundry.withsecure.com 5 // 6 // Use of this source code is governed by the license 7 // that can be found in the LICENSE file. 8 9 package main 10 11 import ( 12 _ "unsafe" 13 14 "github.com/usbarmory/tamago/dma" 15 ) 16 17 // Override imx6ul.ramStart, usbarmory.ramSize and dma allocation, as the 18 // mapped kernel image needs to be within the first 128MiB of RAM. 19 20 //go:linkname ramStart runtime.ramStart 21 var ramStart uint32 = 0x90000000 22 23 //go:linkname ramSize runtime.ramSize 24 var ramSize uint32 = 0x08000000 25 26 // DMA region for target kernel boot 27 var mem *dma.Region 28 29 // DMA region for bootloader operation 30 const ( 31 dmaStart = 0x98000000 32 dmaSize = 0x08000000 33 ) 34 35 // DMA region for target kernel boot 36 const ( 37 memoryStart = 0x80000000 38 memorySize = 0x10000000 39 40 kernelOffset = 0x00800000 41 paramsOffset = 0x07000000 42 initrdOffset = 0x08000000 43 ) 44 45 func init() { 46 dma.Init(dmaStart, dmaSize) 47 48 mem, _ = dma.NewRegion(memoryStart, memorySize, false) 49 mem.Reserve(memorySize, 0) 50 }