mirror of
https://github.com/apache/nuttx.git
synced 2026-10-10 07:40:27 +00:00
arch: Let pgalloc() extend the selected address environment.
pgalloc() grows a process heap for sbrk(). It extended the address environment of the running task (addrenv_own). While exec() sets up a new process, the caller selects the new address environment and allocates the new process's stack from its heap. When that stack does not fit in the initial heap, the heap must grow, but the running task is the caller. For the kernel thread that starts init this was an assertion; for a user task it would have grown the caller's heap. Use the selected address environment (addrenv_curr). For a normal sbrk() it is the same as addrenv_own. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
This commit is contained in:
parent
156fb83007
commit
a7e83c7fb5
3 changed files with 7 additions and 7 deletions
|
|
@ -183,10 +183,10 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages)
|
|||
uintptr_t paddr;
|
||||
unsigned int index;
|
||||
|
||||
binfo("tcb->pid=%d tcb->group=%p\n", tcb->pid, tcb->addrenv_own);
|
||||
binfo("tcb->pid=%d addrenv=%p\n", tcb->pid, tcb->addrenv_curr);
|
||||
binfo("brkaddr=%x npages=%d\n", brkaddr, npages);
|
||||
DEBUGASSERT(tcb && tcb->addrenv_own);
|
||||
addrenv = &tcb->addrenv_own->addrenv;
|
||||
DEBUGASSERT(tcb && tcb->addrenv_curr);
|
||||
addrenv = &tcb->addrenv_curr->addrenv;
|
||||
|
||||
/* The current implementation only supports extending the user heap
|
||||
* region as part of the implementation of user sbrk(). This function
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages)
|
|||
uintptr_t paddr;
|
||||
uintptr_t vaddr;
|
||||
|
||||
DEBUGASSERT(tcb && tcb->addrenv_own);
|
||||
addrenv = &tcb->addrenv_own->addrenv;
|
||||
DEBUGASSERT(tcb && tcb->addrenv_curr);
|
||||
addrenv = &tcb->addrenv_curr->addrenv;
|
||||
|
||||
/* The current implementation only supports extending the user heap
|
||||
* region as part of the implementation of user sbrk(). This function
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages)
|
|||
uintptr_t paddr;
|
||||
uintptr_t vaddr;
|
||||
|
||||
DEBUGASSERT(tcb && tcb->addrenv_own);
|
||||
addrenv = &tcb->addrenv_own->addrenv;
|
||||
DEBUGASSERT(tcb && tcb->addrenv_curr);
|
||||
addrenv = &tcb->addrenv_curr->addrenv;
|
||||
|
||||
/* The current implementation only supports extending the user heap
|
||||
* region as part of the implementation of user sbrk(). This function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue