Skip to content

Instantly share code, notes, and snippets.

@lukego
Created February 7, 2015 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukego/88ac918d3984b0ab36cb to your computer and use it in GitHub Desktop.
Save lukego/88ac918d3984b0ab36cb to your computer and use it in GitHub Desktop.
Impossible bug?

This error:

Invalid DMA address: 0x5002e0925a00
core/memory.lua:95: DMA address tag check failed

is reported by this function:

local uint64_t = ffi.typeof("uint64_t")
function virtual_to_physical (virt_addr)
   local u64 = ffi.cast(uint64_t, virt_addr)
   if bit.band(u64, 0x500000000000ULL) == 0 then
      print("Invalid DMA address: 0x"..bit.tohex(u64,12))
      error("DMA address tag check failed")
   end
   return bit.bxor(u64, 0x500000000000ULL)
end

... and this happens only in certain configurations of a larger application. (Perfectly unreproducible in certain configurations and certainly reproducible in others.)

How can this happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment