~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/runtime/cgo/gcc_amd64.S

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * are callee-save so they must be saved explicitly.
20
20
 * The standard x86-64 ABI passes the three arguments m, g, fn
21
21
 * in %rdi, %rsi, %rdx.
22
 
 *
23
 
 * Also need to set %r15 to g and %r14 to m (see ../pkg/runtime/mkasmh.sh)
24
 
 * during the call.
25
22
 */
26
23
.globl EXT(crosscall_amd64)
27
24
EXT(crosscall_amd64):
46
43
        popq %rbx
47
44
        ret
48
45
 
49
 
/*
50
 
 * void crosscall2(void (*fn)(void*, int32), void *arg, int32 argsize)
51
 
 *
52
 
 * Save registers and call fn with two arguments.  fn is a Go function
53
 
 * which takes parameters on the stack rather than in registers.
54
 
 */
55
 
.globl EXT(crosscall2)
56
 
EXT(crosscall2):
57
 
        subq  $0x58, %rsp       /* keeps stack pointer 32-byte aligned */
58
 
        movq  %rbx, 0x10(%rsp)
59
 
        movq  %rbp, 0x18(%rsp)
60
 
        movq  %r12, 0x20(%rsp)
61
 
        movq  %r13, 0x28(%rsp)
62
 
        movq  %r14, 0x30(%rsp)
63
 
        movq  %r15, 0x38(%rsp)
64
 
 
65
 
#if defined(_WIN64)
66
 
        // Win64 save RBX, RBP, RDI, RSI, RSP, R12, R13, R14, and R15
67
 
        movq    %rdi, 0x40(%rsp)
68
 
        movq    %rsi, 0x48(%rsp)
69
 
 
70
 
        movq  %rdx, 0(%rsp)     /* arg */
71
 
        movq  %r8, 8(%rsp)      /* argsize (includes padding) */
72
 
        
73
 
        call *%rcx      /* fn */
74
 
#else
75
 
        movq  %rsi, 0(%rsp)     /* arg */
76
 
        movq  %rdx, 8(%rsp)     /* argsize (includes padding) */
77
 
 
78
 
        call *%rdi      /* fn */
 
46
#ifdef __ELF__
 
47
.section .note.GNU-stack,"",@progbits
79
48
#endif
80
 
 
81
 
        movq  0x10(%rsp), %rbx
82
 
        movq  0x18(%rsp), %rbp
83
 
        movq  0x20(%rsp), %r12
84
 
        movq  0x28(%rsp), %r13
85
 
        movq  0x30(%rsp), %r14
86
 
        movq  0x38(%rsp), %r15
87
 
#if defined(__WIN64)
88
 
        movq    0x40(%rsp), %rdi
89
 
        movq    0x48(%rsp), %rsi
90
 
#endif  
91
 
        addq  $0x58, %rsp
92
 
        ret