Skip to content

Instantly share code, notes, and snippets.

@eugeneia
Created June 4, 2018 10:29
Show Gist options
  • Save eugeneia/aa18ffd009a150d72a2a3f5c9fe9d5cb to your computer and use it in GitHub Desktop.
Save eugeneia/aa18ffd009a150d72a2a3f5c9fe9d5cb to your computer and use it in GitHub Desktop.
mmap
$ sudo ./snabb snsh -i
Snabb> =memory
table: 0x41a8dce0
Snabb> S = require("syscall")
Snabb> h = memory.allocate_huge_page(64, true)
Error in core/main.lua:28: ftruncate
Snabb> h = memory.allocate_huge_page(memory.get_huge_page_size(), true)
Snabb> =h
cdata<void *>: 0x500024400000
Snabb>p = S.mmap(0x500024400000, 64, 'read, write', 'private, anonymous, hugetlb')
Snabb> =p
cdata<void *>: 0x7fc59c400000
Snabb> p = S.mmap(0x500024400000, memory.get_huge_page_size(), 'read, write', 'private, anonymous, hugetlb')
Snabb> =p
cdata<void *>: 0x7fc59c200000
Snabb> h2 = memory.allocate_huge_page(memory.get_huge_page_size(), true)
Snabb> =h2
cdata<void *>: 0x500023c00000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment