#ifndef _CPU_H_
#define _CPU_H_
#include "basics.h"
#include "registers.h"
#include "device.h"
#include "corefile.h"
#include "vm.h"
#include "events.h"
#include "interrupts.h"
#include "psim.h"
#include "idecode.h"
#include "itable.h"
#include "os_emul.h"
#include "mon.h"
#include "model.h"
#ifndef CONST_ATTRIBUTE
#define CONST_ATTRIBUTE __attribute__((__const__))
#endif
INLINE_CPU\
(cpu *) cpu_create
(psim *system,
core *memory,
cpu_mon *monitor,
os_emul *cpu_emulation,
int cpu_nr);
INLINE_CPU\
(void) cpu_init
(cpu *processor);
INLINE_CPU\
(psim *) cpu_system
(cpu *processor) CONST_ATTRIBUTE;
INLINE_CPU\
(cpu_mon *) cpu_monitor
(cpu *processor) CONST_ATTRIBUTE;
INLINE_CPU\
(os_emul *) cpu_os_emulation
(cpu *processor);
INLINE_CPU\
(int) cpu_nr
(cpu *processor) CONST_ATTRIBUTE;
INLINE_CPU\
(void) cpu_set_program_counter
(cpu *processor,
unsigned_word new_program_counter);
INLINE_CPU\
(unsigned_word) cpu_get_program_counter
(cpu *processor);
INLINE_CPU\
(void) cpu_restart
(cpu *processor,
unsigned_word nia);
INLINE_CPU\
(void) cpu_halt
(cpu *processor,
unsigned_word nia,
stop_reason reason,
int signal);
EXTERN_CPU\
(void) cpu_error
(cpu *processor,
unsigned_word cia,
const char *fmt,
...) __attribute__ ((format (printf, 3, 4)));
INLINE_CPU\
(signed64) cpu_get_time_base
(cpu *processor);
INLINE_CPU\
(void) cpu_set_time_base
(cpu *processor,
signed64 time_base);
INLINE_CPU\
(signed32) cpu_get_decrementer
(cpu *processor);
INLINE_CPU\
(void) cpu_set_decrementer
(cpu *processor,
signed32 decrementer);
#if WITH_IDECODE_CACHE_SIZE
INLINE_CPU\
(idecode_cache) *cpu_icache_entry
(cpu *processor,
unsigned_word cia);
INLINE_CPU\
(void) cpu_flush_icache
(cpu *processor);
#endif
INLINE_CPU\
(vm_data_map *) cpu_data_map
(cpu *processor);
INLINE_CPU\
(vm_instruction_map *) cpu_instruction_map
(cpu *processor);
INLINE_CPU\
(void) cpu_page_tlb_invalidate_entry
(cpu *processor,
unsigned_word ea);
INLINE_CPU\
(void) cpu_page_tlb_invalidate_all
(cpu *processor);
INLINE_CPU\
(interrupts *) cpu_interrupts
(cpu *processor);
typedef struct _memory_reservation {
int valid;
unsigned_word addr;
unsigned_word data;
} memory_reservation;
INLINE_CPU\
(memory_reservation *) cpu_reservation
(cpu *processor);
INLINE_CPU\
(registers *) cpu_registers
(cpu *processor) CONST_ATTRIBUTE;
INLINE_CPU\
(void) cpu_synchronize_context
(cpu *processor,
unsigned_word cia);
#define IS_PROBLEM_STATE(PROCESSOR) \
(CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
? (cpu_registers(PROCESSOR)->msr & msr_problem_state) \
: 1)
#define IS_64BIT_MODE(PROCESSOR) \
(WITH_TARGET_WORD_BITSIZE == 64 \
? (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
? (cpu_registers(PROCESSOR)->msr & msr_64bit_mode) \
: 1) \
: 0)
#define IS_FP_AVAILABLE(PROCESSOR) \
(CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
? (cpu_registers(PROCESSOR)->msr & msr_floating_point_available) \
: 1)
INLINE_CPU\
(void) cpu_print_info
(cpu *processor,
int verbose);
INLINE_CPU\
(model_data *) cpu_model
(cpu *processor) CONST_ATTRIBUTE;
#if (CPU_INLINE & INCLUDE_MODULE)
# include "cpu.c"
#endif
#endif