Live data from Hacker News

Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

devblogs.microsoft.com

21–30 of 65 posts

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#21

Tangent: on 64-bit Apple platforms, nothing is mapped in the lowest 4GiB of address space. This ensures any pointer truncated to 32 bits and dereferenced will segfault.

This was only 'enforced' by the linker on x86. You could handcraft a Mach-O executable to get around it. But it is now enforced enforced by OSX on ARM.

I don't see any good reason for this. My own half assed explanation is they're enforcing 32b cleanliness. It's not a very good explanation. But it's my explanation for something I don't like.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#22

Has anyone here ever used Windows NT on a DEC Alpha? A company in Ireland I worked for gave a mobile phone GIS demo to the Irish national phone company and Digital lent us a beefy server with two AXP CPUs (it was gonna be the future!) running windows NT. We literally pulled it on cobbled dublin streets on a a handcart to bring it to their offices.

Back around 2001, I bought a secondhand Alpha ATX mobo and for a lark installed NT 4 on it. I didn’t do much with it though.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#23
> No. The virtual address space starts at the 64KB boundary. You can confirm this by calling GetSystemInfo and checking the lpMinimum­Application­Address. It will be 0x00000000`00010000.

Aw, man. I recently found out there is also a similar restriction on Linux. Bummer, because I have a good use for putting code into the lower 64KB of memory (not 4KB, still want to use that for catching NPEs). My use case is a fast interpreter for bytecode. Since every bytecode handler needs an entry in the dispatch table, and I have 7--yes 7!--dispatch tables, I'd like to make their entries 2 bytes. So instead of taking 1KB each, they would take only 512B each. But alas.

Another great use case is Wasm. Since the memory is a sandboxed 4GB range and only indexed into by 32-bit offsets, placing it at virtual address 0 would save an add instruction (or use of segment register) on every access.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#24

Has anyone here ever used Windows NT on a DEC Alpha? A company in Ireland I worked for gave a mobile phone GIS demo to the Irish national phone company and Digital lent us a beefy server with two AXP CPUs (it was gonna be the future!) running windows NT. We literally pulled it on cobbled dublin streets on a a handcart to bring it to their offices.

What was the overlap of both products being commercially available? I didn't think it was too long.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#25

Tangent: on 64-bit Apple platforms, nothing is mapped in the lowest 4GiB of address space. This ensures any pointer truncated to 32 bits and dereferenced will segfault.

This was only 'enforced' by the linker on x86. You could handcraft a Mach-O executable to get around it. But it is now enforced enforced by OSX on ARM. I don't see any good reason for this. My own half assed explanation is they're enforcing 32b cleanliness. It's not a very good explanation. But it's my explanation for something I don't like.

When migrating 32bit apps to 64bit platforms, it's common to follow the recipe:

1. Try to recompile on 64bit without any changes 2. Realize the program does not work because the types have different sizes now 3. Cast everything on sight to types that have same size as in 32bit. 4. Now the program "works" (as in, it compiled and maybe ran but you didn't test thoroughly)

This address space restrictions ensures that if you happen to cast a pointer in this way it will not work, forcing the developer to review what he's doing.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#26

Tangent: on 64-bit Apple platforms, nothing is mapped in the lowest 4GiB of address space. This ensures any pointer truncated to 32 bits and dereferenced will segfault.

This was only 'enforced' by the linker on x86. You could handcraft a Mach-O executable to get around it. But it is now enforced enforced by OSX on ARM. I don't see any good reason for this. My own half assed explanation is they're enforcing 32b cleanliness. It's not a very good explanation. But it's my explanation for something I don't like.

You didn’t need to handcraft it, the linker has a ‘pagezero_size’ argument which allows you to set it as small as one page and then the rest of the low 4GB can be used.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#27

Has anyone here ever used Windows NT on a DEC Alpha? A company in Ireland I worked for gave a mobile phone GIS demo to the Irish national phone company and Digital lent us a beefy server with two AXP CPUs (it was gonna be the future!) running windows NT. We literally pulled it on cobbled dublin streets on a a handcart to bring it to their offices.

What was the overlap of both products being commercially available? I didn't think it was too long.

Wikipedia says it was only commercially available for NT4, I do somewhere have the Dec Alpha Windows 2000 beta discs (It got killed very late in the beta).

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#28

Has anyone here ever used Windows NT on a DEC Alpha? A company in Ireland I worked for gave a mobile phone GIS demo to the Irish national phone company and Digital lent us a beefy server with two AXP CPUs (it was gonna be the future!) running windows NT. We literally pulled it on cobbled dublin streets on a a handcart to bring it to their offices.

In the mid-90's, I worked at a place that had one used for our intranet server running Win NT with IIS.

Mostly used a DEC Alpha as a "visible" competitor to our major server provider at the time (Compaq) to try and manage the prices they were charging (at least until Compaq bought Digital, and then eventually bought by/merged with HP).

One interesting thing was that we had a faulty RAM chip that we only discovered due to a bug in website publishing to IIS causing a big memory leak which crashed the server. Once the the chip was replaced, we still had the underlying leak - but at least the server didn't crash any more.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#29
post #17
post #13

Earlier quoted context omitted.

So sad to see Alpha die off, especially since I haven't noticed any architectures with anything like PALCode spring up since. The Alpha's firmware was essentially a hypervisor that only supported a single guest, and the OS kernel had to upcall to the firmware for any privileged operations. In particular, it would be nice to have userspace programs be able to take advantage of new/larger registers without requiring th…

PAL code didn't do anything like context switches and I'm not sure how it could, given how the OS needs to know the specifics of the thread context in many scenarios.

I believe in the specific case of L4/Alpha, the PALCode did perform the context switches. Granted, I doubt it was as robust as the VMS or Tru64 PALCode versions that were production-ready.

Re: Why doesn’t Windows use 64-bit virtual address space below 0x00000000`7ffe0000?

#30

Tangent: on 64-bit Apple platforms, nothing is mapped in the lowest 4GiB of address space. This ensures any pointer truncated to 32 bits and dereferenced will segfault.

This was only 'enforced' by the linker on x86. You could handcraft a Mach-O executable to get around it. But it is now enforced enforced by OSX on ARM. I don't see any good reason for this. My own half assed explanation is they're enforcing 32b cleanliness. It's not a very good explanation. But it's my explanation for something I don't like.

Can't one just remap the zero page?
Post reply on HN