aboutsummaryrefslogtreecommitdiff
path: root/ia32/elf/syscall.sts
blob: 3acfef23349d8ba3010ce1b5a34dceb18c6ee178 (plain)
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
41
defasm sys_exit
    # b8 ?' # 1 ?.                      ; mov eax, 1
    # 31 ?' # db ?'                     ; xor ebx, ebx
    # cd ?' # 80 ?'                     ; int 0x80
; no need in next since this is the last instruction

_data_segment ?choose
    ?$ ?? _iobuf # 0 ?.
_code_segment ?choose

defasm sys_read
    # b8 ?' # 3 ?.                      ; mov eax, 3
    # 31 ?' # db ?'                     ; xor ebx, ebx
    # b9 ?' _iobuf ?.                   ; mov ecx, _iobuf
    # ba ?' # 1 ?.                      ; mov edx, 1
    # cd ?' # 80 ?'                     ; int 0x80
    # 31 ?' # db ?'                     ; xor ebx, ebx
    # 8a ?' # 1d ?' _iobuf ?.           ; mov bl, [_iobuf]
    # 53 ?'                             ; push ebx
    # 50 ?'                             ; push eax
next

defasm sys_write
    # 58 ?'                             ; pop eax
    # a2 ?' _iobuf ?.                   ; mov [_iobuf], al
    # b8 ?' # 4 ?.                      ; mov eax, 4
    # bb ?' # 1 ?.                      ; mov ebx, 1
    # b9 ?' _iobuf ?.                   ; mov ecx, _iobuf
    # ba ?' # 1 ?.                      ; mov edx, 1
    # cd ?' # 80 ?'                     ; int 0x80
next

defasm sys_write_err
    # 58 ?'                             ; pop eax
    # a2 ?' _iobuf ?.                   ; mov [_iobuf], al
    # b8 ?' # 4 ?.                      ; mov eax, 4
    # bb ?' # 2 ?.                      ; mov ebx, 2
    # b9 ?' _iobuf ?.                   ; mov ecx, _iobuf
    # ba ?' # 1 ?.                      ; mov edx, 1
    # cd ?' # 80 ?'                     ; int 0x80
next