From: Zachary Amsden <zamsden@redhat.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Gleb Natapov <gleb@redhat.com>,
linux-kernel@vger.kernel.org, mingo@elte.hu, avi@redhat.com,
mtosatti@redhat.com
Subject: Re: use of setjmp/longjmp in x86 emulator.
Date: Mon, 01 Mar 2010 13:34:42 -1000 [thread overview]
Message-ID: <4B8C4F12.8050009@redhat.com> (raw)
In-Reply-To: <4B8C463B.7070900@zytor.com>
On 03/01/2010 12:56 PM, H. Peter Anvin wrote:
> On 03/01/2010 02:31 PM, H. Peter Anvin wrote:
>
>> On 03/01/2010 11:18 AM, Zachary Amsden wrote:
>>
>>> It's going to be ugly to emulate segmentation, NX and write protect
>>> support without hardware to do this checking for you, but it's just what
>>> you have to do in this slow path - tedious, fully specified emulation.
>>>
>>> Just because it's tedious doesn't mean we need to use setjmp / longjmp.
>>> Throw / catch might be effective, but it's still pretty bizarre to do
>>> tricks like that in C.
>>>
>>>
>> Well, setjmp/longjmp really is not much more than exception handling in C.
>>
>>
> For what it's worth, I think that setjmp/longjmp is not anywhere near as
> dangerous as people want to make it out to be. gcc will warn for
> dangerous uses (and a lot of non-dangerous uses), but generally the
> difficult problems can be dealt with by moving the setjmp-protected code
> into a separate function.
>
I'd be curious to see if it would need to evolve it to preemptsetjmp /
irqlongjmp or some other more complex forms in time.
But I'd rather implement a new language where acquisition of resources
such as locks, dynamically allocated objects, and ref counts are
predicated in the function typing and are heavily encouraged to possess
defined inverses. Then the closure of a particular layer of nesting
already has enough information to provide release upon escape, and the
compiler can easily take the burden of checking for a large class of
lock and resource violation.
And it would have to be prettier than the current languages that do
that, meaning operator overloading would be banned. Although it would
define rational numbers, super-extended precision arithmetic, imaginary
numbers, quaternions and matrices as part of the spec, so there would be
no need to use arithmetic overrides anyway, and then all the nonsensical
operators could die, die, die, especially the function () and logical
operator overrides.
Zach
next prev parent reply other threads:[~2010-03-01 23:34 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 9:18 use of setjmp/longjmp in x86 emulator Gleb Natapov
2010-03-01 12:45 ` Takuya Yoshikawa
2010-03-01 12:52 ` Gleb Natapov
2010-03-01 13:17 ` Takuya Yoshikawa
2010-03-01 13:26 ` Gleb Natapov
2010-03-01 19:13 ` john cooper
2010-03-02 7:28 ` Gleb Natapov
2010-03-07 9:00 ` Avi Kivity
2010-03-08 23:11 ` Eric W. Biederman
2010-03-09 6:28 ` Gleb Natapov
2010-03-01 16:13 ` Zachary Amsden
2010-03-01 17:47 ` Gleb Natapov
2010-03-01 18:39 ` Zachary Amsden
2010-03-01 18:47 ` Luca Barbieri
2010-03-01 19:03 ` Gleb Natapov
2010-03-01 19:18 ` Zachary Amsden
2010-03-01 22:31 ` H. Peter Anvin
2010-03-01 22:56 ` H. Peter Anvin
2010-03-01 23:34 ` Zachary Amsden [this message]
2010-03-01 23:43 ` H. Peter Anvin
2010-03-02 8:05 ` Gleb Natapov
2010-03-02 8:49 ` Gleb Natapov
2010-03-07 9:04 ` Avi Kivity
2010-03-08 0:08 ` H. Peter Anvin
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=4B8C4F12.8050009@redhat.com \
--to=zamsden@redhat.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mtosatti@redhat.com \
/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).