2008-06-05 17:55:06 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
|
2008-06-05 20:53:15 -06:00
|
|
|
TEXT _rt0_amd64_darwin(SB),1,$-8
|
2008-06-05 17:55:06 -06:00
|
|
|
PUSHQ $0
|
|
|
|
MOVQ SP, BP
|
|
|
|
ANDQ $~15, SP
|
2008-06-26 15:09:26 -06:00
|
|
|
MOVQ 8(BP), DI // argc
|
|
|
|
LEAQ 16(BP), SI // argv
|
2008-06-05 17:55:06 -06:00
|
|
|
MOVL DI, DX
|
|
|
|
ADDL $1, DX
|
|
|
|
SHLL $3, DX
|
|
|
|
ADDQ SI, DX
|
|
|
|
MOVQ DX, CX
|
|
|
|
CMPQ (CX), $0
|
|
|
|
JEQ done
|
|
|
|
|
|
|
|
loop:
|
|
|
|
ADDQ $8, CX
|
|
|
|
CMPQ (CX), $0
|
|
|
|
JNE loop
|
|
|
|
|
|
|
|
done:
|
|
|
|
ADDQ $8, CX
|
2008-06-24 16:31:03 -06:00
|
|
|
SUBQ $16, SP
|
|
|
|
MOVL DI, 0(SP)
|
|
|
|
MOVQ SI, 8(SP)
|
|
|
|
CALL args(SB)
|
|
|
|
ADDQ $16, SP
|
2008-06-05 17:55:06 -06:00
|
|
|
CALL check(SB)
|
2008-06-24 18:58:18 -06:00
|
|
|
CALL main·main(SB)
|
2008-06-24 18:16:06 -06:00
|
|
|
CALL sys·exit(SB)
|
2008-06-05 17:55:06 -06:00
|
|
|
CALL notok(SB)
|
|
|
|
POPQ AX
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT FLUSH(SB),1,$-8
|
|
|
|
RET
|
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·exit(SB),1,$-8
|
2008-06-05 17:55:06 -06:00
|
|
|
MOVL 8(SP), DI // arg 1 exit status
|
|
|
|
MOVL $(0x2000000+1), AX
|
|
|
|
SYSCALL
|
|
|
|
JCC 2(PC)
|
|
|
|
CALL notok(SB)
|
|
|
|
RET
|
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·write(SB),1,$-8
|
2008-06-05 17:55:06 -06:00
|
|
|
MOVL 8(SP), DI // arg 1 fid
|
|
|
|
MOVQ 16(SP), SI // arg 2 buf
|
|
|
|
MOVL 24(SP), DX // arg 3 count
|
|
|
|
MOVL $(0x2000000+4), AX // syscall entry
|
|
|
|
SYSCALL
|
|
|
|
JCC 2(PC)
|
|
|
|
CALL notok(SB)
|
|
|
|
RET
|
|
|
|
|
2008-06-26 15:09:26 -06:00
|
|
|
TEXT open(SB),1,$-8
|
|
|
|
MOVQ 8(SP), DI
|
|
|
|
MOVL 16(SP), SI
|
2008-06-26 16:26:27 -06:00
|
|
|
MOVQ $0, R10
|
|
|
|
MOVL $(0x2000000+5), AX // syscall entry
|
2008-06-26 15:09:26 -06:00
|
|
|
SYSCALL
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT close(SB),1,$-8
|
|
|
|
MOVL 8(SP), DI
|
2008-06-26 16:26:27 -06:00
|
|
|
MOVL $(0x2000000+6), AX // syscall entry
|
2008-06-26 15:09:26 -06:00
|
|
|
SYSCALL
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT fstat(SB),1,$-8
|
|
|
|
MOVL 8(SP), DI
|
|
|
|
MOVQ 16(SP), SI
|
2008-06-26 16:26:27 -06:00
|
|
|
MOVL $(0x2000000+339), AX // syscall entry; really fstat64
|
2008-06-26 15:09:26 -06:00
|
|
|
SYSCALL
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT read(SB),1,$-8
|
|
|
|
MOVL 8(SP), DI
|
|
|
|
MOVQ 16(SP), SI
|
|
|
|
MOVL 24(SP), DX
|
2008-06-26 16:26:27 -06:00
|
|
|
MOVL $(0x2000000+3), AX // syscall entry
|
2008-06-26 15:09:26 -06:00
|
|
|
SYSCALL
|
|
|
|
RET
|
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·sigaction(SB),1,$-8
|
2008-06-23 17:34:17 -06:00
|
|
|
MOVL 8(SP), DI // arg 1 sig
|
|
|
|
MOVQ 16(SP), SI // arg 2 act
|
|
|
|
MOVQ 24(SP), DX // arg 3 oact
|
|
|
|
MOVQ 24(SP), CX // arg 3 oact
|
|
|
|
MOVQ 24(SP), R10 // arg 3 oact
|
|
|
|
MOVL $(0x2000000+46), AX // syscall entry
|
|
|
|
SYSCALL
|
|
|
|
JCC 2(PC)
|
|
|
|
CALL notok(SB)
|
|
|
|
RET
|
|
|
|
|
2008-06-23 21:12:39 -06:00
|
|
|
TEXT sigtramp(SB),1,$24
|
2008-06-23 17:34:17 -06:00
|
|
|
MOVL DX,0(SP)
|
|
|
|
MOVQ CX,8(SP)
|
|
|
|
MOVQ R8,16(SP)
|
|
|
|
CALL sighandler(SB)
|
|
|
|
RET
|
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·breakpoint(SB),1,$-8
|
2008-06-05 17:55:06 -06:00
|
|
|
BYTE $0xcc
|
|
|
|
RET
|
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·mmap(SB),1,$-8
|
2008-06-05 17:55:06 -06:00
|
|
|
MOVQ 8(SP), DI // arg 1 addr
|
|
|
|
MOVL 16(SP), SI // arg 2 len
|
|
|
|
MOVL 20(SP), DX // arg 3 prot
|
|
|
|
MOVL 24(SP), R10 // arg 4 flags
|
|
|
|
MOVL 28(SP), R8 // arg 5 fid
|
|
|
|
MOVL 32(SP), R9 // arg 6 offset
|
|
|
|
MOVL $(0x2000000+197), AX // syscall entry
|
|
|
|
SYSCALL
|
|
|
|
JCC 2(PC)
|
|
|
|
CALL notok(SB)
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT notok(SB),1,$-8
|
|
|
|
MOVL $0xf1, BP
|
|
|
|
MOVQ BP, (BP)
|
|
|
|
RET
|
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·memclr(SB),1,$-8
|
2008-06-05 17:55:06 -06:00
|
|
|
MOVQ 8(SP), DI // arg 1 addr
|
|
|
|
MOVL 16(SP), CX // arg 2 count
|
|
|
|
ADDL $7, CX
|
|
|
|
SHRL $3, CX
|
|
|
|
MOVQ $0, AX
|
|
|
|
CLD
|
|
|
|
REP
|
|
|
|
STOSQ
|
|
|
|
RET
|
2008-06-16 18:04:30 -06:00
|
|
|
|
2008-06-24 18:16:06 -06:00
|
|
|
TEXT sys·getcallerpc+0(SB),0,$0
|
2008-06-16 18:04:30 -06:00
|
|
|
MOVQ x+0(FP),AX
|
|
|
|
MOVQ -8(AX),AX
|
|
|
|
RET
|