From: Rich Felker Date: Mon, 13 Apr 2015 21:26:08 +0000 (-0400) Subject: allow i386 __set_thread_area to be called more than once X-Git-Tag: v1.1.9~81 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f630df09b1fd954eda16e2f779da0b5ecc9d80d3;p=oweals%2Fmusl.git allow i386 __set_thread_area to be called more than once previously a new GDT slot was requested, even if one had already been obtained by a previous call. instead extract the old slot number from GS and reuse it if it was already set. the formula (GS-3)/8 for the slot number automatically yields -1 (request for new slot) if GS is zero (unset). --- diff --git a/src/thread/i386/__set_thread_area.s b/src/thread/i386/__set_thread_area.s index ad538151..1d852689 100644 --- a/src/thread/i386/__set_thread_area.s +++ b/src/thread/i386/__set_thread_area.s @@ -6,7 +6,11 @@ __set_thread_area: push $0x51 push $0xfffff push 16(%esp) - push $-1 + xor %edx,%edx + mov %gs,%dx + sub $3,%edx + sar $3,%edx + push %edx mov %esp,%ebx xor %eax,%eax mov $243,%al