From: Zachary Amsden <zach@vmware.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>, Chris Wright <chrisw@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Virtualization Mailing List <virtualization@lists.osdl.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
Martin Bligh <mbligh@mbligh.org>,
Pratap Subrahmanyam <pratap@vmware.com>,
Christopher Li <chrisl@vmware.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 4/21] i386 Broken bios common
Date: Tue, 08 Nov 2005 13:52:21 -0800 [thread overview]
Message-ID: <43711E15.4090502@vmware.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0511080703530.3247@g5.osdl.org>
Linus Torvalds wrote:
>On Mon, 7 Nov 2005, Zachary Amsden wrote:
>
>
>>Both the APM BIOS and PnP BIOS code use a segment hack to simulate real
>>mode selector 0x40 (which points to the BIOS data area at 0x00400 in
>>real mode). Several broken BIOSen use selector 0x40 as if they were
>>running in real mode, which we make work by faking up selector 0x40 in
>>the GDT to point to physical memory starting at 0x400. We limit the
>>access to the remainder of this physical page using a byte granular
>>limit. Rather than have this tricky code in multiple places, it makes
>>sense to define it in one place, and the GDT makes a very convenient
>>place for it. Use GDT entry 4 as the BAD_BIOS_CACHE segment.
>>
>>
>
>I'd much rather use entry 8 instead, which should just automatically mean
>that selector 0x40 _always_ points to virtual address 0x400. No switching
>etc..
>
>Isn't this what Wine already has to work around, or something?
>
>
I have answers now to the questions:
Wine has to support allocating thread pointers for NT processes in
ntdll, so it needs a way to allocate descriptors. It doesn't seem to
care if they are LDT or GDT descriptors.
>Ingo, can we move the TLS selectors upwards, or does user space perhaps
>know about the current TLS layout? Wine in particular may well know ;(
>
>
It does not know. And DOSemu appears to only use LDT. GDT is used to
allocate a global thread area for Wine, but it has a fallback mechanism
that appears to have been built from the start to deal with varying
thread selectors rather than a fixed notion (as GDT TLS segments are not
available on 2.4). Rather convenient.
Now the million dollar question is : who uses three TLS segments? Wine
appears to use glibc, private, and I have no idea what other software
makes use of this. If only two thread selectors were needed, then this
does the trick. Or we could rebase the selectors down to 0x20-0x30.
* ------- start of TLS (Thread-Local Storage) segments:
*
* 6 - TLS segment #1 [ glibc's TLS segment ]
* 7 - TLS segment #2 [ Wine's %fs Win32 segment ]
* 8 - BIOS real mode segment
Zach
prev parent reply other threads:[~2005-11-08 21:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-08 4:22 [PATCH 4/21] i386 Broken bios common Zachary Amsden
2005-11-08 7:19 ` Ingo Molnar
2005-11-08 12:48 ` Zachary Amsden
2005-11-08 12:57 ` Ingo Molnar
2005-11-08 15:06 ` Linus Torvalds
2005-11-08 15:16 ` H. Peter Anvin
2005-11-08 21:07 ` Zachary Amsden
2005-11-08 21:52 ` Zachary Amsden [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43711E15.4090502@vmware.com \
--to=zach@vmware.com \
--cc=akpm@osdl.org \
--cc=chrisl@vmware.com \
--cc=chrisw@osdl.org \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@mbligh.org \
--cc=mingo@elte.hu \
--cc=pratap@vmware.com \
--cc=torvalds@osdl.org \
--cc=virtualization@lists.osdl.org \
--cc=zwane@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).