xiaoxiang781216 edited a comment on pull request #3626: URL: https://github.com/apache/incubator-nuttx/pull/3626#issuecomment-853531956
> > After more thinking, there is a structure like userspace_s for kernel mode, but name it as addrenv_reserve_s: > > [incubator-nuttx/include/nuttx/addrenv.h](https://github.com/apache/incubator-nuttx/blob/a8a1308240b7f631e44d78c3ef1582562c507a8a/include/nuttx/addrenv.h#L248-L254) > > I am unsure if addrenv_reserve_s can be used for this purpose or not. A KERNEL mode process is basically an ELF module with an address environment. addrenv_reserve_s currently only exists if the module has an address environment and it is located only via the fixed virtual address of .data in all processes. > > What about other uses of ELF modules that don't have address environments, addrenv_reserve_s will not be avilable for them and even if it were, the OS could not locate them because the physical .data address is not easily known. If the pthread and task startup and exit functions are linked into the ELF module, then there is not way to access them externally. I think there are other complexities and corner cases that you are not addressing. For ELF binary, we have three case: 1. ELF binary in FLAT build, it simplify to the direct function call 2. ELF binary in PROTECTED build, switch to userspace by userspace_s 3. ELF binary in KERNEL build, switch to userspace by addrenv_reserve_s There isn't difference between ELF binary(posix_spawn) and builtin binary(task_spawn) after binfmt finish load and parse ELF file. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
