2012-12-19 18:54:26 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* binfmt/libnxflat/libnxflat.h
|
|
|
|
*
|
2021-02-03 14:47:23 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2012-12-19 18:54:26 +01:00
|
|
|
*
|
2021-02-03 14:47:23 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-12-19 18:54:26 +01:00
|
|
|
*
|
2021-02-03 14:47:23 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2012-12-19 18:54:26 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __BINFMT_LIBNXFLAT_LIBNXFLAT_H
|
|
|
|
#define __BINFMT_LIBNXFLAT_LIBNXFLAT_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/binfmt/nxflat.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2023-07-02 18:11:02 +02:00
|
|
|
* Public Function Definitions
|
2012-12-19 18:54:26 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
2023-07-02 18:11:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxflat_verifyheader
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Given the header from a possible NXFLAT executable, verify that it is
|
|
|
|
* an NXFLAT executable.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* 0 (OK) is returned on success and a negated errno is returned on
|
|
|
|
* failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nxflat_verifyheader(FAR const struct nxflat_hdr_s *header);
|
|
|
|
|
2012-12-19 18:54:26 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxflat_addrenv_alloc
|
|
|
|
*
|
|
|
|
* Description:
|
2014-08-24 19:54:14 +02:00
|
|
|
* Allocate data memory for the NXFLAT image. If CONFIG_ARCH_ADDRENV=n,
|
2014-09-01 01:34:44 +02:00
|
|
|
* memory will be allocated using kmm_zalloc(). If CONFIG_ARCH_ADDRENV-y,
|
2014-08-24 19:54:14 +02:00
|
|
|
* then memory will be allocated using up_addrenv_create().
|
2012-12-19 18:54:26 +01:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* loadinfo - Load state information
|
|
|
|
* envsize - The size (in bytes) of the address environment needed for the
|
|
|
|
* ELF image.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-04 13:51:09 +01:00
|
|
|
int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo,
|
|
|
|
size_t envsize);
|
2012-12-19 18:54:26 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxflat_addrenv_select
|
|
|
|
*
|
|
|
|
* Description:
|
2020-02-23 09:50:23 +01:00
|
|
|
* Temporarity select the task's address environment.
|
2012-12-19 18:54:26 +01:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* loadinfo - Load state information
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-08-24 14:42:11 +02:00
|
|
|
#ifdef CONFIG_ARCH_ADDRENV
|
2023-01-27 12:45:03 +01:00
|
|
|
# define nxflat_addrenv_select(l) addrenv_select(&(l)->addrenv)
|
2012-12-19 18:54:26 +01:00
|
|
|
#endif
|
|
|
|
|
2023-04-13 12:37:20 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxflat_addrenv_restore
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Restore the address environment before nxflat_addrenv_select() was
|
|
|
|
* called..
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* loadinfo - Load state information
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_ADDRENV
|
|
|
|
# define nxflat_addrenv_restore(l) addrenv_restore()
|
|
|
|
#endif
|
|
|
|
|
2012-12-19 18:54:26 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxflat_addrenv_free
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Release the address environment previously created by
|
2014-09-10 23:55:36 +02:00
|
|
|
* nxflat_addrenv_alloc(). This function is called only under certain
|
2013-08-27 17:40:19 +02:00
|
|
|
* error conditions after the module has been loaded but not yet
|
2012-12-19 18:54:26 +01:00
|
|
|
* started. After the module has been started, the address environment
|
|
|
|
* will automatically be freed when the module exits.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* loadinfo - Load state information
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo);
|
|
|
|
|
|
|
|
#endif /* __BINFMT_LIBNXFLAT_LIBNXFLAT_H */
|