Hacker News new | ask | show | jobs
by dwattttt 341 days ago
> A whole separate register?

There are quite a few registers (in all the ISAs I'm familiar with) that are defined as not preserved across calls; kernels already have to wipe them in order to avoid leaking kernel-specific data to userland, one of them could easily hold additional information.

EDIT: additionally, it's been a long time since the register names we're familiar with in an ISA actually matched the physical registers in a chip.

1 comments

It is distinctly odd to watch people in the 2020s laboriously explaining how difficult all this stuff would be, when the reality was that the register scarcity that prompted this sort of double-duty in 1979 was already going away in mass-market computers in 1982.

By 1983, operating system vendors designing their APIs ab initio were already making APIs that just used separate registers for error and result returns. Sinclair QDOS was one well-known example. MS-DOS version 2 might have done things the PDP-11 way, but by the time of MS-DOS version 4 people were already inventing INT calls that used multiple registers to return things. OS/2 was always returning a separate error value in 1987. Windows NT's native API has always been returning a separate NTSTATUS, not doubled up with anything else, since the 1990s.

I was around then but never got that low level into things, so anecdotes like this always fascinate me.

Too, I'll read any post that mentions OS/2; I loved that OS so much as a user. Partially also because some of the REXX I learned in college could be put to use.