Motherboard chipsets and the memory map

Source: Internet
Author: User
Motherboard chipsets and the memory map

I'm going to write a few posts about computer internals with the goal of explaining how modern kernels work. I hope to make them useful to enthusiasts and programmers who are interested in this stuff but don't have experience with it. the focus is on Linux, windows, and Intel processors. internals are a holobby for me, I have written a fair bit of kernel-mode code but haven't done so in a while. this first post describes the layout of modern intel-based motherboards, how the CPU accesses memory and the system memory map.

To start off let's take a look at how an Intel computer is wired up nowadays. The dimo-below shows the main components in a motherboard and dubious color taste:


Distrifor modern motherboard. the Northbridge and Southbridge make up the chipset.

as you look at this, the crucial thing to keep in mind is that the CPU doesn't really know anything about what it's connected. it talks to the outside world through its pins but it doesn't care what that outside world is. it might be a motherboard in a computer but it cocould be a toaster, network router, brain implant, or CPU test failed. there are three main ways by which the CPU and the outside communicate: memory address space, I/O address space, and interrupts. we only worry about motherboards and memory for now.

In a motherboard the CPU's gateway to the world is the front-side bus connecting it to the Northbridge. whenever the CPU needs to read or write memory it does so via this bus. it uses some pins to transmit the physical memory address it wants to write or read, while other pins send the value to be written or receive the value being read. an Intel Core 2 qx6600 has 33 pins to transmit the physical memory address (so there are 233 choices of memory locations) and 64 pins to send or receive data (so data is transmitted in a 64-bit data path, or 8-byte chunks ). this allows the CPU to physically address 64 gigabytes of memory (233 locations * 8 bytes) Although most chipsets only handle up to 8 gigs of RAM.

now comes the Rub. we're re used to thinking of memory only in terms of RAM, the stuff programs read from and write to all the time. and indeed most of the memory requests from the processor are routed to ram modules by the Northbridge. but not all of them. physical memory addresses are also used for communication with assorted devices on the motherboard (this communication is calledmemory-mapped I/O ). these devices include video cards, most PCI cards (say, a pair or SCSI card), and also the flash memory that stores the BIOS.

When the Northbridge between es a physical memory request it decides where to route it: shocould it go to ram? Video Card maybe? This routing is decided via the memory address map. for each region of physical memory addresses, the memory map knows the device that owns that region. the bulk of the addresses are mapped to ram, but when they aren't the memory map tells the chipset Which device shocould service requests for those addresses. this mapping of memory addresses away from Ram modules causes the classic hole in PC memory between 640kb and 1 MB. a bigger hole arises when memory addresses are reserved for video cards and PCI devices. this is why 32-bit OSes haveproblems using 4 gigs of RAM. in Linux the file/Proc/iomemNeatly lists these address range mappings. The dimo-below shows a typical memory map for the first 4 gigs of physical memory addresses in an Intel PC:


Memory layout for the first 4 gigabytes in an Intel System.

Actual addresses and ranges depend on the specific motherboard and devices present in the computer, but most core 2 systems are pretty close to the above. all of the brown regions are mapped away from Ram. remember that these arePhysicalAddresses that are used on the motherboard buses.InsideThe CPU (for example, in the programs we run and write), the memory addresses areLogicalAnd they must be translated by the CPU into a physical address before memory is accessed on the bus.

The rules for translation of logical addresses into physical addresses are complex and they depend on Mode In which the CPU is running (real mode, 32-bit protected mode, and 64-bit protected mode ). regardless of the translation mechanism, the CPU mode determines how much physical memory can be accessed. for example, if the CPU is running in 32-Bit mode, then it is only capable of physically addressing 4 GB (well, there is an exception called physical address extension, but ignore it for now ). since Top 1 GB or so of physical addresses are mapped to motherboard devices the CPU can contain tively use only ~ 3 GB of RAM (sometimes less-I have a Vista machine where only 2.4 GB are usable). If the CPU is in real mode, then it can only address 1 Mega Byte of physical RAM (this is the only mode early Intel processors were capable ). on the other hand, a CPU running in 64-Bit mode can physically access 64 GB (few chipsets support that much RAM though ). in 64-Bit mode it is possible to use physical addresses above the total RAM in the system to access the ram regions that correspond to physical addresses stolen by motherboard devices. this is called Reclaiming Memory and it's done with help from the chipset.

That's all the memory we need for the next post, which describes the boot process from power up until the boot loader is about to jump into the kernel. if you 'd like to learn more about this stuff, I highly recommend the Intel manuals. i'm big into primary sources overall, but the intel manuals in particle are well written and accurate. here are some:

    • datasheet for Intel g35 chipset documents a representative chipset for Core 2 processors. This is the main source for this post.
    • datasheet for Intel Core 2 quad-core q6000 sequence is a processor datasheet. it depends ents each pin in the processor (there aren't that was actually, and after you group them there's really not a lot to it ). fascinating stuff, though some bits are arcane.
    • the Intel software developer's manuals are outstanding. far from arcane, they explain beautifully all sorts of things about the architecture. volumes 1 and 3A have the good stuff (Don't be put off by the name, the "volumes" are small and you can read selectively ).
    • Pádraig Brady suggested that I link to Ulrich drepper's excellent paper on memory. it's great stuff. I was waiting to link to it in a post about memory, but the more the merrier.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.