1996-05-16 23:18:28 +00:00
|
|
|
<!-- $Id: memoryuse.sgml,v 1.6 1996/01/31 19:02:59 mpp Exp $ -->
|
1995-05-18 03:05:22 +00:00
|
|
|
<!-- The FreeBSD Documentation Project -->
|
|
|
|
|
1995-09-25 04:53:33 +00:00
|
|
|
<sect><heading>PC memory utilization<label id="memoryuse"></heading>
|
1995-05-18 03:05:22 +00:00
|
|
|
|
|
|
|
<p><em>Contributed by &a.joerg;.<newline>
|
|
|
|
16 Apr 1995.</em>
|
|
|
|
|
1995-12-19 10:21:07 +00:00
|
|
|
<em>A short description of how FreeBSD uses the memory on the i386
|
|
|
|
platform</em>
|
1995-05-18 03:05:22 +00:00
|
|
|
|
1995-10-22 00:42:14 +00:00
|
|
|
The boot sector will be loaded at <tt>0:0x7c00</tt>, and relocates itself
|
|
|
|
immediately to <tt>0x7c0:0</tt>. (This is nothing magic, just an adjustment
|
|
|
|
for the <tt>%cs</tt> selector, done by an <tt>ljmp</tt>.)
|
1995-05-18 03:05:22 +00:00
|
|
|
|
1995-10-22 00:42:14 +00:00
|
|
|
It then loads the first 15 sectors at <tt>0x10000</tt> (segment BOOTSEG in the
|
|
|
|
biosboot Makefile), and sets up the stack to work below <tt>0x1fff0</tt>.
|
1995-05-18 03:05:22 +00:00
|
|
|
After this, it jumps to the entry of boot2 within that code. I.e., it
|
1996-05-16 23:18:28 +00:00
|
|
|
jumps over itself and the (dummy) partition table, and it is going to
|
1995-05-18 03:05:22 +00:00
|
|
|
adjust the %cs selector---we are still in 16-bit mode there.
|
|
|
|
|
1995-10-22 00:42:14 +00:00
|
|
|
boot2 asks for the boot file, and examines the <tt>a.out</tt> header. It masks
|
|
|
|
the file entry point (usually <tt>0xf0100000</tt>) by <tt>0x00ffffff</tt>, and loads the
|
|
|
|
file there. Hence the usual load point is 1 MB (<tt>0x00100000</tt>). During
|
1995-05-18 03:05:22 +00:00
|
|
|
load, the boot code toggles back and forth between real and protected
|
|
|
|
mode, to use the BIOS in real mode.
|
|
|
|
|
1995-10-22 00:42:14 +00:00
|
|
|
The boot code itself uses segment selectors <tt>0x18</tt> and <tt>0x20</tt> for <tt>%cs</tt> and
|
|
|
|
<tt>%ds/%es</tt> in protected mode, and <tt>0x28</tt> to jump back into real mode. The
|
|
|
|
kernel is finally started with <tt>%cs</tt> <tt>0x08</tt> and <tt>%ds/%es/%ss</tt> <tt>0x10</tt>, which
|
|
|
|
refer to dummy descriptors covering the entire address space.
|
1995-05-18 03:05:22 +00:00
|
|
|
|
1996-01-31 19:03:02 +00:00
|
|
|
The kernel will be started at its load point. Since it has been linked
|
1995-05-18 03:05:22 +00:00
|
|
|
for another (high) address, it will have to execute PIC until the page
|
|
|
|
table and page directory stuff is setup properly, at which point
|
|
|
|
paging will be enabled and the kernel will finally run at the address
|
|
|
|
for which it was linked.
|
|
|
|
|
|
|
|
|
|
|
|
<em>Contributed by &a.davidg;.<newline>
|
|
|
|
16 Apr 1995.</em>
|
|
|
|
|
|
|
|
The physical pages immediately following the kernel BSS contain
|
|
|
|
proc0's page directory, page tables, and upages. Some time later
|
|
|
|
when the VM system is initialized, the physical memory between
|
1995-10-22 00:42:14 +00:00
|
|
|
<tt>0x1000-0x9ffff</tt> and the physical memory after the kernel
|
1995-05-18 03:05:22 +00:00
|
|
|
(text+data+bss+proc0 stuff+other misc) is made available in the
|
|
|
|
form of general VM pages and added to the global free page list.
|
|
|
|
|
|
|
|
|