File: x86-64.linux.code.l

package info (click to toggle)
picolisp 3.1.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,100 kB
  • sloc: ansic: 14,205; lisp: 795; makefile: 290; sh: 13
file content (40 lines) | stat: -rw-r--r-- 835 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 19apr11abu
# (c) Software Lab. Alexander Burger

# System macros
(code 'errno_A 0)
   call __errno_location  # Get address of 'errno'
   ld4 (A)  # Load value
   ret

(code 'errnoC 0)
   call __errno_location  # Get address of 'errno'
   xchg A C
   st4 (C)  # Store new value
   ret

(code 's_isdirS_F 0)  # S_ISDIR
   ld4 (S `(+ I ST_MODE))  # Get 'st_mode' from 'stat'
   and A `S_IFMT
   cmp A `S_IFDIR
   ret

(code 'wifstoppedS_F 0)  # WIFSTOPPED
   ld A (S I)  # Get status
   cmp B `(hex "7F")  # (((status) & 0xff) == 0x7f)
   ret

(code 'wifsignaledS_F 0)  # WIFSIGNALED
   ld A (S I)  # Get status
   and B `(hex "7F")  # (((status) & 0x7f) + 1) >> 1) > 0)
   inc B
   shr B 1
   ret

(code 'wtermsigS_A 0)  # WTERMSIG
   ld A (S I)  # Get status
   and B `(hex "7F")  # ((status) & 0x7f)
   zxt
   ret

# vi:et:ts=3:sw=3