Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support std.os.windows.peb on 32-bit arm windows #4645

Closed
andrewrk opened this issue Mar 5, 2020 · 0 comments · Fixed by #4651
Closed

support std.os.windows.peb on 32-bit arm windows #4645

andrewrk opened this issue Mar 5, 2020 · 0 comments · Fixed by #4651
Labels
arch-arm 32-bit ARM contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. os-windows standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Mar 5, 2020

Here are some helpful tid bits from #winehackers on freenode:

<andrewrk> does anyone know how to access the Process Environment Block on aarch64 or arm windows?
<andrewrk> https://github.com/ziglang/zig/blob/1aae5bebe9616f2640b77728a76bea8c92d9aca0/lib/std/os/windows.zig#L1086-L1103
<ken> andrewrk: Can you call Windows APIs like NtCurrentTeb() ?  If so, NtCurrentTeb()->Peb.
<andrewrk> yeah, alright will do. do you think that's more reliable than the inline asm?
<madewokherd> it's certainly more portable
<ken> The problem is I'm not sure there is an inline asm way to do it.  If there is, Wine doesn't replicate it.
<ken> There could be other reasons for that, though.
<andrewrk> good to know. that makes it more portable since wine is one way to run windows software :)
<ken> Looking through wine-devel archives, I see that the x18 register holds the TEB pointer.
<ken> on Windows.
<ken> I don't know ARM assembly, but the PEB pointer would be at offset 0x30 from there for 32-bit and 0x60 for 64-bit.
<andrewrk> thanks!
@andrewrk andrewrk added this to the 0.7.0 milestone Mar 5, 2020
@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels Mar 5, 2020
LemonBoy added a commit to LemonBoy/zig that referenced this issue Mar 5, 2020
Use the NtCurrentTeb API instead of using some inline asm, this is much
nicer and also more portable.

Closes ziglang#4645
LemonBoy added a commit to LemonBoy/zig that referenced this issue Mar 6, 2020
Use the NtCurrentTeb API instead of using some inline asm, this is much
nicer and also more portable.

Closes ziglang#4645
@andrewrk andrewrk reopened this Mar 6, 2020
@andrewrk andrewrk removed the arch-aarch64 64-bit ARM label Mar 6, 2020
@andrewrk andrewrk changed the title support std.os.windows.peb on arm windows support std.os.windows.peb on 32-bit arm windows Mar 6, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 14, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@alexrp alexrp modified the milestones: 0.16.0, 0.14.0 Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm 32-bit ARM contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. os-windows standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants