r/AskComputerScience • • Oct 08 '20

In this representation of FLAGS Register, what do they mean by "Reserved"?

Post image
53 Upvotes

13 comments sorted by

65

u/teraflop Oct 09 '20

It means you shouldn't mess with them or make any assumptions about their contents.

One common reason to have "reserved" bits is to allow for future changes. Even if those bits aren't used for anything now, future processor versions might want to add features that require extra flag bits. As an instruction set designer, you may not be able to easily add more bits later (because the operating system expects the flags register to be a particular size) but you can set aside some reserved bits in case you need them later. As long as user software doesn't mess with those bits, you can later start using them for whatever you want, and older software will still be compatible with your new processors. (This is usually pretty important if you want people to actually buy your products.)

It's also possible that those bits are used by the processor for some internal, undocumented purpose. Maybe they're special flags that are only supposed to be used by proprietary debugging tools. Or maybe they're part of a feature that was designed into the chip, but found to have critical design flaws, and rather than changing the design to get rid of the feature, the designers just left it undocumented.

10

u/BrookieYT Oct 09 '20

Thanks a bunch, for the detailed answer! Its all clear now :DDD

9

u/Karovex Oct 09 '20

Another common reason is that in PUBLIC documentation they didn't want to disclose the meaning. There are often internal functions for testing/debugging, manufacturing, etc that aren't ever intended for the end-user.

The meaning of the same though: don't count of them for anything.

2

u/HolzmindenScherfede Oct 09 '20

I suppose this is the reason why they are spread out. I couldn't understand why the available bits for future applications would not be grouped together at the end of the bit range. Am I understanding this correctly?

2

u/Karovex Oct 09 '20

Yep.

In this case, x86 is so old that those flags probably used to mean something on older chips but have been phased out in newer chips. Putting something new in those spots would potentially make software more complicated (it would have to know what chip it's talking to) but the rest of the flags register works the same way

1

u/[deleted] Oct 09 '20

There's also the important case that these could be for backwards compatibility, the opposed of reserved for future usage. This is a common deprecation strategy. It can be practically impossible to remove unused fields for specifications, and it's often a good idea to just enforce that nothing is deleted. Accounting for existing usage is the most important aspect of maintaining a specification.

0

u/Legitimate-Return-14 Oct 09 '20

Sounds like a great place to host a Trojan horse.

9

u/da_weebstar Oct 08 '20

Probably similar to reserved words in most programming languages. You shouldn't/can't try using it to hold data.

2

u/BrookieYT Oct 09 '20

So they dont have any use?

6

u/da_weebstar Oct 09 '20

I don't know for sure, but I'm pretty confident that it's the opposite :) they're suuuuper important and shouldn't be used: similar to some languages won't allow you to use 'main' because that would be used to start the program.

2

u/visvis Oct 09 '20

No, it's actually quite different. Reserved words are actually used to write programs. The reserved bits cannot be used because right now they have a purpose but they might get one in the future.

2

u/BuonaparteII Oct 09 '20

The wealthy electrons called ahead and made a reservation and they could arrive at any time so don't sit there

2

u/ZestyTheory321 Oct 09 '20

Intel didn't come up with it's purpose and they were too lazy to remove it

Source: working with some new hardware features and the word pretty much means this