Subject: Re: Fixing Linux emulated brk()
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 03/15/2001 00:37:49
> I need some information about this ctob(vm->vm_dsize). What is it for?
> As I understood vm->vm_daddr is the current break value, why do we add
> something to it?
Ok, I understood how it works.
For NetBSD, the break is always page alligned, whatever the calling
process requests.
Here is the Linux emaulated trace on NetBSD:
brk(0) = 0x10011000
brk(0x10011021) = 0x10011021
Here the break was set at 0x10012000. brk() returned the value requested
by the user, but the break is page aligned. If we read it again, it is
hene not the previous value.
brk(0) = 0x10012000
brk(0x12012fdf) = 0x12012fdf
If we want to emulate Linux accurately, we need to keep track of the
break value the process requested. My suggestion is to add a mbreak
field in some structure of the process. linux_sys_brk would hence be
able to return the expected break value to the calling process when
called as brk(0).
p_emul is const, so it's not a very good candidate. choosing p_vmspace
is just adding an emulation specific stuff in uvm, it's not very clean.
There is p_emuldata, but I'm not sure about how to use it. On what
should it point?
Opinions, Ideas, suggestions?
--
Emmanuel Dreyfus.
Il ne suffit pas de crier l'iMac, l'iMac! en sautant comme un cabri...
p99dreyf@criens.u-psud.fr