Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Fixed SEH in fibers on Windows Server OSes. #150

Merged
merged 3 commits into from Feb 13, 2012

Conversation

dnadlinger
Copy link
Member

Windows Server 2008 and 2008 R2 validate the exception chain by default, so we need to install a Windows-internal default handler at the root of the chain. See in-code comment for details.

@dnadlinger
Copy link
Member Author

@CyberShadow: Since I happen to know that you use a Windows Server box, could you please test the commit, if you have time?

@CyberShadow
Copy link
Member

I can't seem to build this branch of druntime... the import target fails with:

dmd -c -d -o- -Isrc -Iimport -Hfimport\core\sys\posix\sys\un.di src\core\sys\posix\sys\un.d
src\core\sys\posix\sys\un.d(17): Error: import __anonymous sa_family_t not found
src\core\sys\posix\sys\un.d(17): Error: alias core.sys.posix.sys.un.sa_family_t recursive alias declaration

Edit: never mind, works after merging into master.

@CyberShadow
Copy link
Member

Unittests pass for me.

Windows Server 2008 and 2008 R2 validate the exception chain by default, so we need to install a Windows-internal default handler at the root of the chain. See in-code comment for details.
@dnadlinger
Copy link
Member Author

Okay, thanks (and rebased to latest master).

complexmath added a commit that referenced this pull request Feb 13, 2012
Fixed SEH in fibers on Windows Server OSes.
@complexmath complexmath merged commit e0f90e7 into dlang:master Feb 13, 2012
@braddr
Copy link
Member

braddr commented Dec 4, 2014

I know this is ancient code, but it's failing on windows server 2012 for 32 bit windows apps. See the thread I started on dmd-internal.

@dnadlinger dnadlinger deleted the fiber-seh branch December 5, 2014 21:18
@dnadlinger
Copy link
Member Author

Do the tests pass if you revert the change (and disable SEHOP)? Otherwise, broken EH in fibres is hardly related to this PR.

@braddr
Copy link
Member

braddr commented Dec 5, 2014

Daniel's investigations suggest while it looks similar, it might be a different cause for the same test to fail. He's digging into it, though more eyes couldn't hurt. I haven't tried reverting this change to see if it helps yet. I'm more focused on other things right now since disabling the tests isn't the end of the world.

@dnadlinger
Copy link
Member Author

Okay, I see. Fibres being broken on Windows is sort of a big deal, given that vibe.d makes extensive use of them and there is std.concurrency.Scheduler now. However, I unfortunately have zero time to spend on this right now. The way I tracked the original issue down was spending a weekend with IDA and reverse-engineering the Windows SEH code. It's quite an interesting challenge because of all the userland-kernel gates (WoW64), but I still don't have a better suggestion on how to approach this.

@yebblies
Copy link
Member

yebblies commented Dec 6, 2014

@klickverbot I tried disabling SEHOP and it didn't seem to make a difference.

rracariu pushed a commit to rracariu/druntime that referenced this pull request Jan 31, 2019
We cannot use ldc.intrinsics.llvm_readcyclecounter because that is not an accurate time counter (it is a counter of CPU cycles, where here we want a time clock).
Also, priviledged execution rights are needed to enable correct counting with ldc.intrinsics.llvm_readcyclecounter on AArch64.
So instead, we use the general virtual counter register, and also read out the frequency of that counter.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants