From owner-freebsd-hackers Fri Oct 29 12: 8:36 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.bezeqint.net (mail-a.bezeqint.net [192.115.106.23]) by hub.freebsd.org (Postfix) with ESMTP id DD31715571 for ; Fri, 29 Oct 1999 12:08:31 -0700 (PDT) (envelope-from sarig@bezeqint.net) Received: from default (pt119-75.nas.bezeqint.net) by mail.bezeqint.net (Sun Internet Mail Server sims.3.5.1999.07.30.00.05.p8) with SMTP id <0FKD0044CP5FMX@mail.bezeqint.net> for hackers@FreeBSD.ORG; Fri, 29 Oct 1999 21:08:03 +0200 (IST) Date: Fri, 29 Oct 1999 21:07:44 +0200 From: Oren Sarig Subject: Re: Limitations in FreeBSD In-reply-to: <19991029095629.D48778@dan.emsphone.com> X-Sender: sarig@mail.bezeqint.net To: hackers@FreeBSD.ORG Message-id: <3.0.6.32.19991029210744.007da290@mail.bezeqint.net> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Content-type: text/plain; charset="us-ascii" References: <199910290502.WAA03970@dingo.cdrom.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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