zephyr/arch/x86/include/debug/gdb_arch.h
Benjamin Walsh f6ca7de09c kernel/arch: consolidate tTCS and TNANO definitions
There was a lot of duplication between architectures for the definition
of threads and the "nanokernel" guts. These have been consolidated.

Now, a common file kernel/unified/include/kernel_structs.h holds the
common definitions. Architectures provide two files to complement it:
kernel_arch_data.h and kernel_arch_func.h. The first one contains at
least the struct _thread_arch and struct _kernel_arch data structures,
as well as the struct _callee_saved and struct _caller_saved register
layouts. The second file contains anything that needs what is provided
by the common stuff in kernel_structs.h. Those two files are only meant
to be included in kernel_structs.h in very specific locations.

The thread data structure has been separated into three major parts:
common struct _thread_base and struct k_thread, and arch-specific struct
_thread_arch. The first and third ones are included in the second.

The struct s_NANO data structure has been split into two: common struct
_kernel and arch-specific struct _kernel_arch. The latter is included in
the former.

Offsets files have also changed: nano_offsets.h has been renamed
kernel_offsets.h and is still included by the arch-specific offsets.c.
Also, since the thread and kernel data structures are now made of
sub-structures, offsets have to be added to make up the full offset.
Some of these additions have been consolidated in shorter symbols,
available from kernel/unified/include/offsets_short.h, which includes an
arch-specific offsets_arch_short.h. Most of the code include
offsets_short.h now instead of offsets.h.

Change-Id: I084645cb7e6db8db69aeaaf162963fe157045d5a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-12 07:04:52 -05:00

123 lines
3.6 KiB
C

/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* Licensed 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.
*/
#ifndef _GDB_ARCH__H_
#define _GDB_ARCH__H_
#ifdef __cplusplus
extern "C" {
#endif
#include <kernel_structs.h>
#include <misc/debug/gdb_server.h>
#define GDB_ARCH_HAS_ALL_REGS
#ifndef CONFIG_GDB_SERVER_BOOTLOADER
#undef GDB_ARCH_HAS_HW_BP
#define GDB_ARCH_HAS_REMOTE_SERIAL_EXT_USING_NOTIF_PACKETS
#define GDB_ARCH_HAS_RUNCONTROL
#define GDB_ARCH_CAN_STEP gdb_arch_can_step
#endif
#ifndef CONFIG_GDB_RAM_SIZE
#define CONFIG_GDB_RAM_SIZE (CONFIG_RAM_SIZE * 1024)
#endif
#ifndef CONFIG_GDB_RAM_ADDRESS
#define CONFIG_GDB_RAM_ADDRESS 0x100000
#endif
/* Default GDB buffer size */
#ifdef CONFIG_GDB_SERVER_BOOTLOADER
#define GDB_BUF_SIZE 8192
#else
#define GDB_BUF_SIZE 600
#endif
#define GDB_TGT_ARCH "i386"
#define GDB_NUM_REGS 16
#define GDB_NUM_REG_BYTES (GDB_NUM_REGS * 4)
#define GDB_PC_REG 8
#define GDB_BREAK_INSTRUCTION 0xcc /* 'int3' opcode */
#ifndef _ASMLANGUAGE
typedef unsigned char gdb_instr_t;
struct gdb_reg_set {
NANO_ISF regs;
unsigned int pad1; /* padding for ss register */
unsigned int pad2; /* padding for ds register */
unsigned int pad3; /* padding for es register */
unsigned int pad4; /* padding for fs register */
unsigned int pad5; /* padding for gs register */
};
struct gdb_debug_regs {
unsigned int db0; /* debug register 0 */
unsigned int db1; /* debug register 1 */
unsigned int db2; /* debug register 2 */
unsigned int db3; /* debug register 3 */
unsigned int db6; /* debug register 6 */
unsigned int db7; /* debug register 7 */
};
#if defined(GDB_ARCH_HAS_RUNCONTROL) && defined(GDB_ARCH_HAS_HW_BP)
extern volatile int gdb_cpu_stop_bp_type;
extern long gdb_cpu_stop_hw_bp_addr;
#define GDB_SET_STOP_BP_TYPE_SOFT(x) \
do { gdb_cpu_stop_bp_type = (x); } while ((0))
#else
#define GDB_SET_STOP_BP_TYPE_SOFT(x)
#endif
extern void gdb_arch_init(void);
extern void gdb_arch_regs_from_esf(struct gdb_reg_set *regs,
NANO_ESF *esf);
extern void gdb_arch_regs_to_esf(struct gdb_reg_set *regs,
NANO_ESF *esf);
extern void gdb_arch_regs_from_isf(struct gdb_reg_set *regs,
NANO_ISF *esf);
extern void gdb_arch_regs_to_isf(struct gdb_reg_set *regs,
NANO_ISF *esf);
extern void gdb_arch_regs_get(struct gdb_reg_set *regs, char *buffer);
extern void gdb_arch_regs_set(struct gdb_reg_set *regs, char *buffer);
extern void gdb_arch_reg_info_get(int reg_id, int *size, int *offset);
extern void gdb_trace_mode_clear(struct gdb_reg_set *regs, int arg);
extern int gdb_trace_mode_set(struct gdb_reg_set *regs);
extern int gdb_arch_can_step(struct gdb_reg_set *regs);
#ifdef GDB_ARCH_HAS_HW_BP
extern int gdb_hw_bp_set(struct gdb_debug_regs *regs, long addr,
enum gdb_bp_type type, int length,
enum gdb_error_code *err);
extern int gdb_hw_bp_clear(struct gdb_debug_regs *regs, long addr,
enum gdb_bp_type type, int length,
enum gdb_error_code *err);
extern void gdb_dbg_regs_set(struct gdb_debug_regs *regs);
extern void gdb_dbg_regs_get(struct gdb_debug_regs *regs);
extern void gdb_dbg_regs_clear(void);
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _GDB_ARCH__H_ */