Both. CMOS stores BIOS configuration information. When you "enter setup", you are running the BIOS's configuration program, which loads the settings defined in CMOS. You are "setting up" the CMOS, by providing configuration information the BIOS will use as it runs.
The BIOS is a program written as Firmware onto a ROM, so it cannot be written to (except by an all-or-nothing flash operation, which is dangerous, so not an everyday operation). The BIOS ROM stores its configuration info on to the CMOS when you hit F10. That's why clearing the CMOS restores your BIOS settings to default, and is why it doesn't delete the BIOS iteslf, leaving you with an expensive paperweight.
In example, the BIOS has a subroutine that will load the OS per the boot order. the boot order information however, (eg use first CD-ROM as first device) is stored in the CMOS. If you clear the CMOS, the BIOS will use a default, usually the first disk on the first disk controller that is populated.
You were right. – Lightness Races with Monica – 2015-05-04T22:49:09.073
5CMOS is hardware, BIOS is code – Ron – 2015-05-05T05:46:40.193
Now which piece of software is actually already running and reads the keyboard and decides to enter CMOS setup? :) – Hagen von Eitzen – 2015-05-05T18:32:15.623
Technically nobody uses BIOS anymore, it has been superseded by [tag:UEFI]. – None – 2015-05-06T01:34:19.933
like: when I start my pc, am I entering to windows(or any other os) or hard disk? – RogUE – 2015-05-06T09:30:00.357
@RogUE, you are entering a firmware program (BIOS or UEFI or Whatever) that initiates boot on a specific harddisk by locating and the boot sector (MBR or whatever), which, when executed, boots the OS. – Frank Thomas – 2015-05-06T11:31:10.547