| OLD | NEW |
| 1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
| 3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "386/asm.h" | 5 #include "386/asm.h" |
| 6 | 6 |
| 7 TEXT _rt0_386(SB),7,0ドル | 7 TEXT _rt0_386(SB),7,0ドル |
| 8 // copy arguments forward on an even stack | 8 // copy arguments forward on an even stack |
| 9 MOVL 0(SP), AX // argc | 9 MOVL 0(SP), AX // argc |
| 10 LEAL 4(SP), BX // argv | 10 LEAL 4(SP), BX // argv |
| 11 SUBL 128,ドル SP // plenty of scratch | 11 SUBL 128,ドル SP // plenty of scratch |
| 12 ANDL $~15, SP | 12 ANDL $~15, SP |
| 13 MOVL AX, 120(SP) // save argc, argv away | 13 MOVL AX, 120(SP) // save argc, argv away |
| 14 MOVL BX, 124(SP) | 14 MOVL BX, 124(SP) |
| 15 | 15 |
| 16 // if there is an initcgo, call it to let it | 16 // if there is an initcgo, call it to let it |
| 17 // initialize and to set up GS. if not, | 17 // initialize and to set up GS. if not, |
| 18 // we set up GS ourselves. | 18 // we set up GS ourselves. |
| 19 MOVL initcgo(SB), AX | 19 MOVL initcgo(SB), AX |
| 20 TESTL AX, AX | 20 TESTL AX, AX |
| 21 JZ 3(PC) | 21 JZ 3(PC) |
| 22 CALL AX | 22 CALL AX |
| 23 JMP ok | 23 JMP ok |
| 24 | 24 |
| 25 // set up %gs | 25 // set up %gs |
| 26 CALL ldt0setup(SB) | 26 CALL ldt0setup(SB) |
| 27 | 27 |
| 28 // store through it, to make sure it works | 28 // store through it, to make sure it works |
| 29 CMPL isplan9(SB), 1ドル |
| 30 JEQ ok |
| 29 get_tls(BX) | 31 get_tls(BX) |
| 30 MOVL 0ドルx123, g(BX) | 32 MOVL 0ドルx123, g(BX) |
| 31 MOVL tls0(SB), AX | 33 MOVL tls0(SB), AX |
| 32 CMPL AX, 0ドルx123 | 34 CMPL AX, 0ドルx123 |
| 33 JEQ ok | 35 JEQ ok |
| 34 MOVL AX, 0 // abort | 36 MOVL AX, 0 // abort |
| 35 ok: | 37 ok: |
| 36 // set up m and g "registers" | 38 // set up m and g "registers" |
| 37 get_tls(BX) | 39 get_tls(BX) |
| 38 LEAL g0(SB), CX | 40 LEAL g0(SB), CX |
| (...skipping 368 matching lines...) | | Loading... |
| 407 INT 3ドル | 409 INT 3ドル |
| 408 CMPL SP, g_stackguard(AX) | 410 CMPL SP, g_stackguard(AX) |
| 409 JHI 2(PC) | 411 JHI 2(PC) |
| 410 INT 3ドル | 412 INT 3ドル |
| 411 RET | 413 RET |
| 412 | 414 |
| 413 GLOBL m0(SB), 1024ドル | 415 GLOBL m0(SB), 1024ドル |
| 414 GLOBL g0(SB), 1024ドル | 416 GLOBL g0(SB), 1024ドル |
| 415 GLOBL tls0(SB), 32ドル | 417 GLOBL tls0(SB), 32ドル |
| 416 GLOBL initcgo(SB), 4ドル | 418 GLOBL initcgo(SB), 4ドル |
| 417 | 419 GLOBL isplan9(SB), 4ドル |
| OLD | NEW |