Changing BIOS Settings Using C

I was wondering if I have the opportunity to write a program in C to change the amount of memory that is shared with RAM and the GFX card, or even how can I contact the BIOS settings?

+7
c
source share
2 answers

Short answer: None.

Long answer: don't bother with the custom BIOS. There is a reason there are no APIs or the like. My computer, my settings.

+10
source share

You can access BIOS settings through I / O port 70h and 71h. (Some chipsets also have an extended CMOS of 72/73 or similar.)

What OS are you using? If you use Windows, you will not be able to do port I / O directly from the application, you will have to write a kernel mode driver or use a third-party toolkit such as WinIO. On Linux, you can use / dev / nvram to get CMOS settings. (Suppose the nvram driver for Linux supports your chipset. Otherwise, use / dev / port.)

Once you get the CMOS bit, the next task will determine which location in the CMOS matches the video memory setting.

Here is a (extremely incomplete) map of CMOS memory locations: http://ivs.cs.uni-magdeburg.de/~zbrog/asm/cmos.html

The CMOS location map is extremely specific to the motherboard, BIOS, and BIOS rev. (The CMOS card may change between BIOS versions, as new menu options are added / removed.) Perhaps your motherboard provider may provide you with a CMOS card. They have tools to create such a card (it is part of the BIOS compilation process), but they may not want to share it.

Without a card, there are other ways to determine which bits in CMOS represent the size of the video memory. Try resetting CMOS settings with different memory sizes and finding out which bits are changing.

Some other details:

  • Outside of a few β€œstandard” CMOS bits, most of them are extremely platform dependent, I hope you do not plan to make a universal application out of this.

  • There are checksums at certain offsets in CMOS. After changing the CMOS value, you will need to correct the checksum to reflect the changes.

  • After changing the setting, it will not take effect for the next reboot (when the BIOS reads the CMOS settings and initializes the chipset).

  • Is this an Intel chipset? Intel's graphics cores have a magical feature called Dynamic Video Memory Technology (DVMT), which improves the use of video memory depending on how graphically the running application works. http://www.intel.com/support/graphics/sb/cs-010488.htm I'm not sure that other chipset manufacturers have similar technology.

  • Throw it all out of the window on a modern UEFI system, which usually uses the non-volatile memory section in the BIOS chip for settings. (Some CMOS locations are populated for compatibility with legacy UEFI systems.)

+13
source share

All Articles