Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Oct 1999 21:07:44 +0200
From:      Oren Sarig <sarig@bezeqint.net>
To:        hackers@FreeBSD.ORG
Subject:   Re: Limitations in FreeBSD
Message-ID:  <3.0.6.32.19991029210744.007da290@mail.bezeqint.net>
In-Reply-To: <19991029095629.D48778@dan.emsphone.com>
References:  <XFMail.991029120555.kuehl@lgk.de> <199910290502.WAA03970@dingo.cdrom.com> <XFMail.991029120555.kuehl@lgk.de>

next in thread | previous in thread | raw e-mail | index | archive | help
At 09:56 29/10/99 -0500, Dan Nelson wrote:
>In the last episode (Oct 29), Lars Gerhard Kuehl said:
>> > Think about it for a second.  How big is a pointer?
>> 
>> The Intel architecture still supports segmented memory,
>> so the effective maximum pointer size is 48 bit.
>
>gcc doesn't handle segmented memory architectures, though, so you'll
>have to write your own low-level memory copying operations if you want
>to access other segments.


OK, I haven't messed with this stuff in a long time, but here goes.

In the Intel 32Bit architecture (IA32), when you enter protected mode you
may also turn on a feature called paging (I assume fbsd uses that...).
Basically, it lets you map addresses programs use (linear addresses) to
actual physical addresses, by using paging tables. Most of the addresses
are mapped outside of the actual memory, and so whenever somebody wants to
access them, a general protection fault occurs. The kernel taps the GPF,
gets the page from the swap, loads it into memory, remaps the linear
address, and gives the program back the control, but now the program has
the data in memory. IA32 supports up to 4Gb of physical memory with
protected mode, and a whole lot more virtual memory than that with paging.
For more info go to http://developer.intel.com/ and go into the Literature
Center and get Intel Architecture Developer's Guide: Volume III: System
Programmer's Guide (Or something along those lines).

About the segments, you need to understand the differences between a flat
memory model and a segmented memory model first. In a flat memory model,
all the program's data, code, the stack, the TSS, the LDT, and anything
else are all the same linear memory area. A program may use any of the
segment registers to access any of it's data... it can use ES:BP to access
the stack, or DS:BX to access some code. In a segmented memory model, the
data, code, stack, TSS, and LDT are in different segments: the stack is
accessed via SS:(E)SP/(E)BP, data via DS:SI or ES:DI, and code via CS:IP.
(G)CC is a compiler for the flat memory model.

A flat memory model is easy to acheive using paging. Basically, a proccess
always has a 4Gb address space available. Some of it is for his
code/data/stack... and some may be used for pipes or kernel message areas.
A proccess is not aware of other proccesses, and thinks he has complete
control of the system. The actual memory the proccess uses is determined
through paging. Segments have nothing to do here.

Hope this answers some of the questions on the memory limits, etc. :) I
haven't messed with this stuff in some time, so don't take my word for it.
Go read Intel's docs if this interests you.

--
Oren Sarig
sarig@isdn.net.il



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.6.32.19991029210744.007da290>