Skip to content

Commit 946bb0b

Browse files
committed
Add FreeBSD mmap flags
1 parent e90758c commit 946bb0b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

qiling/os/posix/const.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,23 @@ class linux_mmap_flags(Flag):
647647
MAP_UNINITIALIZED = 0x04000000
648648

649649

650+
# see: https://github.com/freebsd/freebsd-src/blob/master/sys/sys/mman.h
651+
class freebsd_mmap_flags(Flag):
652+
MAP_FILE = 0x00000000
653+
MAP_SHARED = 0x00000001
654+
MAP_PRIVATE = 0x00000002
655+
656+
MAP_FIXED = 0x00000010
657+
MAP_STACK = 0x00000400
658+
MAP_NOSYNC = 0x00000800
659+
MAP_ANONYMOUS = 0x00001000
660+
MAP_GUARD = 0x00002000
661+
MAP_EXCL = 0x00004000
662+
MAP_NOCORE = 0x00020000
663+
664+
# define this alias for compatibility with other os flags
665+
MAP_FIXED_NOREPLACE = MAP_EXCL
666+
650667
# see: https://github.com/torvalds/linux/blob/master/arch/mips/include/uapi/asm/mman.h
651668
class mips_mmap_flags(Flag):
652669
MAP_FILE = 0x00000000

qiling/os/posix/syscall/mman.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __select_mmap_flags(archtype: QL_ARCH, ostype: QL_OS):
8080

8181
osflags = {
8282
QL_OS.LINUX: mips_mmap_flags if archtype == QL_ARCH.MIPS else linux_mmap_flags,
83-
QL_OS.FREEBSD: linux_mmap_flags, # FIXME: need one for freebsd
83+
QL_OS.FREEBSD: freebsd_mmap_flags,
8484
QL_OS.MACOS: macos_mmap_flags,
8585
QL_OS.QNX: qnx_mmap_flags # FIXME: only for arm?
8686
}[ostype]

0 commit comments

Comments
 (0)