Date: Thu, 14 Nov 1996 00:20:36 -0500 (EST) From: "John S. Dyson" <toor@dyson.iquest.net> To: cskim@cslsun10.sogang.ac.kr (Kim Chang Seob) Cc: freebsd-hackers@FreeBSD.org, cskim@cslsun10.sogang.ac.kr Subject: Re: data segment Message-ID: <199611140520.AAA02018@dyson.iquest.net> In-Reply-To: <9611140440.AA05620@cslsun10.sogang.ac.kr> from "Kim Chang Seob" at Nov 14, 96 01:40:24 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > hello there. > i major in computer science in sogang Univ. Korea. > and i enjor to know about FreeBSD kernel source's memory management > but i don't know below > 1. if process reference his virtual memory, > how to distinguish the text segment and data sehment. > i don't how to know > FreeBSD (internally) distinguishes between .text, .data, .bss by mechanisms that are not named ".text" handler, ".data" handler, and ".bss" handler :-). It does so by the attributes of the segments. Take a look at the code in /sys/kern/imgact_aout.c for how the segments are set-up. I understand that it can be confusing, but the names ".text", ".data", and ".bss" are historical, and mostly imply certain segment attributes. Internally, FreeBSD can handle almost any reasonable arbitrary mapping of a file into memory, and then run it. FreeBSD has the appropriate mechanisms for copy on write also. When .data is mapped into memory, there is a special flag set that says that pages in that segment should copied if modified. The copied page is placed into the process address space, and the system leaves the original page in .data unmodified. Actually, the .text segment is mapped copy on write also, but there is no write access allowed normally. This allows debuggers to set breakpoints in the process image without destroying the file that contains the executable. John dyson@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611140520.AAA02018>