diff options
| author | Michael Hudson-Doyle <michael.hudson@canonical.com> | 2015-10-28 12:10:28 +1300 |
|---|---|---|
| committer | Michael Hudson-Doyle <michael.hudson@canonical.com> | 2015-11-18 01:36:44 +0000 |
| commit | 6056cc5df602938a97e8d70176fa90e2b09f3020 (patch) | |
| tree | 941effc182dec5591d2acf3cee81b9118203d830 /src/runtime/sys_linux_386.s | |
| parent | c8abb02178315303ee20f4d32fea91f50a4ac74c (diff) | |
| download | go-6056cc5df602938a97e8d70176fa90e2b09f3020.tar.xz | |
runtime: handle volatility of CX when dynamically linking on linux/386
Mostly by avoiding CX entirely, sometimes by reloading it.
I also vetted the assembly in other packages, it's all fine.
Change-Id: I50059669aaaa04efa303cf22ac228f9d14d83db0
Reviewed-on: https://go-review.googlesource.com/16386
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_386.s')
| -rw-r--r-- | src/runtime/sys_linux_386.s | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index 3067c03d0e..1a3aaf0104 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -408,7 +408,7 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$-8 // setldt(int entry, int address, int limit) TEXT runtime·setldt(SB),NOSPLIT,$32 MOVL entry+0(FP), BX // entry - MOVL address+4(FP), CX // base address + MOVL address+4(FP), DX // base address #ifdef GOOS_android /* @@ -416,8 +416,8 @@ TEXT runtime·setldt(SB),NOSPLIT,$32 * address currently holds m->tls, which must be %gs:0xf8. * See cgo/gcc_android_386.c for the derivation of the constant. */ - SUBL $0xf8, CX - MOVL CX, 0(CX) + SUBL $0xf8, DX + MOVL DX, 0(DX) #else /* * When linking against the system libraries, @@ -429,23 +429,23 @@ TEXT runtime·setldt(SB),NOSPLIT,$32 * To accommodate that rewrite, we translate * the address here and bump the limit to 0xffffffff (no limit) * so that -4(GS) maps to 0(address). - * Also, the final 0(GS) (current 4(CX)) has to point + * Also, the final 0(GS) (current 4(DX)) has to point * to itself, to mimic ELF. */ - ADDL $0x4, CX // address - MOVL CX, 0(CX) + ADDL $0x4, DX // address + MOVL DX, 0(DX) // We copy the glibc dynamic linker behaviour of storing the // __kernel_vsyscall entry point at 0x10(GS) so that it can be invoked // by "CALL 0x10(GS)" in all situations, not only those where the // binary is actually dynamically linked. MOVL runtime·_vdso(SB), AX - MOVL AX, 0x10(CX) + MOVL AX, 0x10(DX) #endif // set up user_desc LEAL 16(SP), AX // struct user_desc MOVL BX, 0(AX) - MOVL CX, 4(AX) + MOVL DX, 4(AX) MOVL $0xfffff, 8(AX) MOVL $(SEG_32BIT|LIMIT_IN_PAGES|USEABLE|CONTENTS_DATA), 12(AX) // flag bits |
