Live data from Hacker News

Finding a CPU Design Bug in the Xbox 360 (2018)

randomascii.wordpress.com

51–55 of 55 posts

Re: Finding a CPU Design Bug in the Xbox 360 (2018)

#51

Earlier quoted context omitted.

Yeah that part didn't make sense, not to mention that neither the PS3 nor the 360 were running 64-bit software. They didn't have enough memory for it to be worth it.

Parts of the 360 did. The hypervisor ran in 64bit mode, and use multiple simultaneous mirrors of physical address space with different security properties as part of its security model.

It's not like the games weren't running in 64 bit mode too (on both consoles)

They had full access to the 64 bit GPRs. There wasn't anything technically stopping game code from accessing the 64 bit address space by reinterpreting a 64 bit int as a pointer (except that nothing was mapped there).

It's only the pointers that were 32 bit, and that was nothing more than a compiler modification (like the linux x32 ABI).

They did it to minimise memory space/bandwidth. With only 512 MB of memory, it made zero sense to waste the full 8 bytes per pointer. The savings quickly add up for pointer heavy structures.

I remember this being a pain point for early PS3 homebrew. Stock gcc was missing the compiler modifications, and you had a choice between compiling 32 bit code (which couldn't use the 64bit GPRs) or wasting bandwidth on 64 bit pointers (with a bunch of hacky adapter code for dealing 32 bit pointers from Sony libraries)

Re: Finding a CPU Design Bug in the Xbox 360 (2018)

#52
post #50
post #47

Earlier quoted context omitted.

Because consoles don't use off-the-shelf CPUs for many reasons. Neither Intel nor AMD of that time would even consider making a bespoke CPU for Sony or MS. Even they could use off-the-shelf SKU it wouldn't be viable - neither one had one that fits in power envelope (not that it helped xbox...)

Consoles used off-the-shelf CPUs until the 6th generation. Even the Dreamcast and the first Xbox used off-the-shelf CPUs, it was only the PS2 and the GameCube that started the trend of using custom-made CPUs.

Not entirely accurate.

The PSX's CPU is semi-custom. The core is a reasonably stock R3000 CPU, but the MMU is slightly modified and they attached a custom GTE coprocessor.... I guess you can debate if attaching a co-processor counts as custom or not (but then the ps4/xbone/ps5/xbs use unmodified AMD jaguar/zen2 cores)

IMO, the N64's CPU counts as off-the-shelf... however the requirements of the N64 (especially cost requirements) might have slightly leaked into the design of the R4300i. But the N64's RSP is a custom CPU, a from scratch MIPS design that doesn't share DNA with anything else.

But the Dreamcast's CPU is actually the result of a joint venture between Hitachi and Sega. There are actually two variants of the SH4, the SH4 and SH4a. The Dreamcast uses the SH4a (despite half the documentation on the internet saying it uses the SH4), which adds a 4-way SIMD unit that's absolutely essential for processing vertices.

We don't know how much influence Sega's needs had over the whole SH4 design, but the SIMD unit is absolutely there for the Dreamcast, I'm pretty sure it's the first 4-way floating point SIMD on the market. The fact that both the SH4/SH4a were then sold to everyone else, doesn't mean they were off the shelf.

Really, the original Xbox using an off-the-shelf CPU is an outlier (technically it's a custom SKU, but really it's just a binned die with half the cache disabled).

Re: Finding a CPU Design Bug in the Xbox 360 (2018)

#53
post #35

Earlier quoted context omitted.

Whenever we lost a 360 we got a pre owned 360 from gamestop. I think they went for like $70 for one without any hdd.

That was the real story, by the time they started dying you could just grab a working one for "decently cheap" if you still cared. However, I wonder how many people got "burned" by it and swore off Xbox consoles going forward. I know that era we got a lot more use out of the Xbox (original) and the Wii.

I knew plenty of people who had rrod no one swore off xbox though. You were still in the ecosystem through games, controllers, xbox live membership, and in my case network effects since we all played halo.

Re: Finding a CPU Design Bug in the Xbox 360 (2018)

#54
post #51

Earlier quoted context omitted.

Parts of the 360 did. The hypervisor ran in 64bit mode, and use multiple simultaneous mirrors of physical address space with different security properties as part of its security model.

It's not like the games weren't running in 64 bit mode too (on both consoles) They had full access to the 64 bit GPRs. There wasn't anything technically stopping game code from accessing the 64 bit address space by reinterpreting a 64 bit int as a pointer (except that nothing was mapped there). It's only the pointers that were 32 bit, and that was nothing more than a compiler modification (like the linux x32 ABI). Th…

Games themselves ran in 32 bit mode.

The difference is that on PowerPC, 32bit mode on 64bit processors (clearing the SF bit in the MSR) is just enabling a hardware 32bit mask on the effective address before it gets translated into a virtual address.

Unlike on x86-64 and arm64, there's no free (or even that cheap) way to do an ILP32 abi purely in software. x86 and arm allow encodings for memory reference instructions that only use the bottom half of the registers (the E* registers on x86, and the W* registers on arm64). No such encoding exists on PowerPC for memory reference instructions, so you'd be stuck manually masking each generated pointer.

Because of that, the compiler hacks you're talking about are kind of the opposite from what you're describing. The hacks are because on the upstream gcc PowerPC backend, having a 32bit pointers in hardware and having operations that operate on 64bit quantities had the same feature flag despite technically being able to be separately enabled on actual hardware. It was just very rare to do so. So the goal of the hacks was to describe to the compiler that the target has 32 hardware pointers, but still can issue instructions like ldd to operate on the full 64bit GPRs.

Re: Finding a CPU Design Bug in the Xbox 360 (2018)

#55
post #28

Earlier quoted context omitted.

Fundamentally it's still a memory limitation, just in terms of memory latency/cache misses instead of capacity. If you double the size of your numbers you're doubling the space it takes up and all the problems that come with it.

No it isn't. The 64-bit capabilities of modern CPUs have almost nothing to do with memory. The address space is rarely 64 bits of physical address space anyways. A "64-bit" computer doesn't actually have the ability to deal with 64 bits of memory. If you double the size of numbers, sure it takes up twice the space. If the total size is still less that one page it isn't likely to make a big difference anyways. What re…

You misread my comment. I'm not saying that it limits the amount of memory, I'm saying that _using more memory has cost_.

> If the total size is still less that one page it isn't likely to make a big difference anyways

It makes a significant difference when you're optimizing around cache behavior and SIMD lanes.

Post reply on HN