azan

prayers time calculator written in nasm x86-64
git clone https://git.afify.dev/azan.git
Log | Files | Refs | README | LICENSE

commit 69bfc1aac0e4824d298828ca0b091eb2ec0127a6
parent 00b8d7055a307f48461b7160dca9a8d96a7004c2
Author: afify <hassan@afify.dev>
Date:   Sat, 28 Nov 2020 16:14:50 +0300

[feat] support FreeBSD & NetBSD

Diffstat:
MREADME.md | 8++++----
Mazan.s | 2+-
Mconfig.mk | 2++
Mmacros.s | 7++++++-
Msyscalls.s | 10++++++++++
5 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -2,12 +2,12 @@ azan ========= **prayers time calculator, written in nasm.** -- binary size ≈ 8.8 kb -- instructions ≈ 250-400 -- branches ≈ 6-20 - standalone nasm - unix portable syscalls -- tested on Linux and OpenBSD +- tested on Linux, OpenBSD, FreeBSD and NetBSD +- binary size ≈ 7 kb +- instructions ≈ 250-400 +- branches ≈ 6-20 Installation ------------ diff --git a/azan.s b/azan.s @@ -7,7 +7,7 @@ BITS 64 %include "macros.s" %include "math.s" %include "config.s" -CHECK_OPENBSD +CHECK_BSD section .rodata sec_inday: dq 0x40f5180000000000 ;double 86400.0 diff --git a/config.mk b/config.mk @@ -8,6 +8,8 @@ MANPREFIX = ${PREFIX}/share/man # flags AFLAGS = -f elf64 -w+all -D$$(uname) -DVERSION=\"${VERSION}\" LFLAGS = -m elf_x86_64 -s -no-pie +# FreeBSD (uncomment) +# LFLAGS = -m elf_amd64_fbsd -s # assembler and linker ASM = nasm diff --git a/macros.s b/macros.s @@ -11,12 +11,17 @@ %define ROUND_DOWN 01B ;toward -inf %define MAX_ARGC 2 -%macro CHECK_OPENBSD 0 +%macro CHECK_BSD 0 %ifdef OpenBSD section .note.openbsd.ident note dd 8, 4, 1 db "OpenBSD", 0 dd 0 +%elifdef NetBSD +section .note.openbsd.ident note + dd 7, 4, 1 + db "NetBSD", 0, 0 + dd 0 %endif %endmacro diff --git a/syscalls.s b/syscalls.s @@ -11,6 +11,16 @@ %define SYS_exit 1 %define SYS_write 4 %define SYS_gettimeofday 67 +%elifdef FreeBSD + %define SYS_exit 1 + %define SYS_write 4 + %define SYS_gettimeofday 116 +%elifdef NetBSD + %define SYS_exit 1 + %define SYS_write 4 + %define SYS_gettimeofday 116 +%else + %fatal "OS not supported" %endif %endif ;SYSCALLS_S