arch/x86: Add g_tcb_info

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-07-25 02:41:07 -07:00 committed by Alin Jerpelea
parent f3269a6caa
commit 8d46cfd8e5
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,75 @@
/****************************************************************************
* arch/x86/src/common/x86_tcbinfo.c
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/sched.h>
#include <arch/irq.h>
/****************************************************************************
* Private Data
****************************************************************************/
static const uint16_t g_reg_offs[] =
{
TCB_REG_OFF(REG_EAX), /* RAX */
TCB_REG_OFF(REG_ECX), /* RCX */
TCB_REG_OFF(REG_EDX), /* RDX */
TCB_REG_OFF(REG_EBP), /* RBX */
TCB_REG_OFF(REG_ESP), /* ESP */
TCB_REG_OFF(REG_EBP), /* EBP */
TCB_REG_OFF(REG_ESI), /* ESI */
TCB_REG_OFF(REG_EDI), /* EDI */
TCB_REG_OFF(REG_EIP), /* EIP */
TCB_REG_OFF(REG_EFLAGS), /* EFLAGS */
TCB_REG_OFF(REG_CS), /* CS */
TCB_REG_OFF(REG_SS), /* SS */
TCB_REG_OFF(REG_DS), /* DS */
UINT16_MAX, /* ES */
UINT16_MAX, /* FS */
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
.pid_off = TCB_PID_OFF,
.state_off = TCB_STATE_OFF,
.pri_off = TCB_PRI_OFF,
.name_off = TCB_NAME_OFF,
.stack_off = TCB_STACK_OFF,
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
{
.p = g_reg_offs,
},
};
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -30,7 +30,7 @@ CMN_CSRCS += i486_createstack.c i486_initialstate.c
CMN_CSRCS += x86_allocateheap.c x86_copystate.c x86_exit.c
CMN_CSRCS += x86_getintstack.c x86_initialize.c x86_mdelay.c
CMN_CSRCS += x86_modifyreg8.c x86_modifyreg16.c x86_modifyreg32.c
CMN_CSRCS += x86_nputs.c x86_switchcontext.c x86_udelay.c
CMN_CSRCS += x86_nputs.c x86_switchcontext.c x86_udelay.c x86_tcbinfo.c
CMN_CSRCS += i486_irq.c i486_regdump.c i486_releasestack.c
CMN_CSRCS += i486_savestate.c i486_sigdeliver.c i486_stackframe.c
CMN_CSRCS += i486_schedulesigaction.c i486_usestack.c