build: bring windows back#867
Merged
pkova merged 34 commits intojb/palloc-migratefrom Sep 16, 2025
Merged
Conversation
Otherwise zlib is fetched all the time for no reason, see ziglang/zig#23051 for details.
Some stupid linux header was deprecated.
Collaborator
|
We should use the pread/pwrite versions from here: https://github.com/urbit/urbit/blob/e8bfe8c22da7f81012834e5067df3afdc4f2c228/pkg/urbit/compat/mingw/compat.c#L147-L201. |
pkova
added a commit
that referenced
this pull request
Nov 12, 2025
A few days ago I decided to fix the ctrl-c interrupts that had been broken on windows since I brought it back in #867. How hard could it be? It turns out @locpyl-tidnyd was really cooking with gas here. The fundamental mismatch between unix and windows here is the following: ctrl-c on unix delivers a synchronous SIGINT signal whereas on windows it starts a new thread to handle the interrupt. A new thread! We can't deal with that! https://github.com/urbit/vere/blob/25356bc2ba022492715741b444b61f2452510021/pkg/noun/platform/windows/rsignal.c#L52-L63 Ok looks like we suspend the main thread that's cool, what's `oldfn`? https://github.com/urbit/vere/blob/25356bc2ba022492715741b444b61f2452510021/pkg/noun/platform/windows/rsignal.c#L117-L167 We replace the _instruction pointer_ on the _main thread_ with our longjmp and pass it the first argument in rcx as per the windows x64 calling convention. If we are in the middle of an exception handler already we unwind the stack and hijack the CONTEXT structure (on the stack) that windows uses to restore execution state after the handler has run. It turns out we have to use `__builtin_longjmp` when we do this crazy shit because the native longjmp on windows also tries to unwind the stack and gets really confused. All in all I hope that this writeup will be useful to the next poor soul who looks at this stuff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on the work in urbit/urbit#4675 with some upgrades.
The structured exception handling code in the original is crazy. It was originally done because libsigsegv installs a top level structured exception handler which means that every time we fault we end up unwinding a potentially very deep stack. We (and most likely libsigsegv too) can instead install a vectored exception handler that functions exactly as we want without unwinding the stack.
We still have cross-compilation from any of our supported targets to any of our supported targets.
Current known limitations:
Demand paging does not work.
The spin hint does not work.
JSON tracing does not work.
The jump buffer in the road struct needs to be 16 byte aligned on windows, we'll fix when merging @joemfb:s allocator work.
There are some strange padding zeroes at the end of south.bin breaking checkpoint version negotiation, fix same as above.