Skip to content

Commit

Permalink
Clean up ibmulator.h
Browse files Browse the repository at this point in the history
  • Loading branch information
barotto committed Aug 4, 2021
1 parent 6514533 commit 8b4b097
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/hardware/cpu/bus.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2016 Marco Bortolin
* Copyright (C) 2015-2021 Marco Bortolin
*
* This file is part of IBMulator.
*
Expand Down Expand Up @@ -130,7 +130,7 @@ void CPUBus::reset_pq()

void CPUBus::update(int _cycles)
{
#if USE_PREFETCH_QUEUE
#if CPU_USE_PQ
if(m_mem_r_cycles || (m_wq_idx>=0)) {
m_pmem_cycles += m_cycles_ahead;
m_cycles_ahead = 0;
Expand Down
7 changes: 4 additions & 3 deletions src/hardware/cpu/bus.h
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2016 Marco Bortolin
* Copyright (C) 2015-2021 Marco Bortolin
*
* This file is part of IBMulator.
*
Expand All @@ -24,6 +24,7 @@
#include "mmu.h"
#include "../memory.h"

#define CPU_USE_PQ true
#define CPU_PQ_MAX_SIZE 16
#define CPU_BUS_WQ_SIZE 50

Expand Down Expand Up @@ -94,7 +95,7 @@ class CPUBus
void enable_paging(bool _enabled);

//instruction fetching
#if USE_PREFETCH_QUEUE
#if CPU_USE_PQ
inline uint8_t fetchb() { return fetch<uint8_t, 1>(); }
inline uint16_t fetchw() { return fetch<uint16_t,2>(); }
inline uint32_t fetchdw() { return fetch<uint32_t,4>(); }
Expand All @@ -121,7 +122,7 @@ class CPUBus
}
template<unsigned S> inline void mem_write(uint32_t _addr, uint32_t _data)
{
#if USE_PREFETCH_QUEUE
#if CPU_USE_PQ
/* Memory writes need to be executed after a PQ update, because code
* prefetching is done after the instruction execution, in relation to
* the available cpu cycles. The executed instruction could be a mov
Expand Down
4 changes: 2 additions & 2 deletions src/hardware/cpu/logger.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2016 Marco Bortolin
* Copyright (C) 2015-2021 Marco Bortolin
*
* This file is part of IBMulator.
*
Expand Down Expand Up @@ -420,7 +420,7 @@ int CPULogger::write_entry(FILE *_dest, CPULogEntry &_entry)
return -1;
}

if(USE_PREFETCH_QUEUE && CPULOG_WRITE_PQ) {
if(CPU_USE_PQ && CPULOG_WRITE_PQ) {
if(fprintf(_dest, "pq=") < 0)
return -1;
if(_entry.bus.write_pq_to_logfile(_dest) < 0)
Expand Down
3 changes: 2 additions & 1 deletion src/hardware/devices/pit82c54.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2013 The Bochs Project
* Copyright (C) 2015, 2016 Marco Bortolin
* Copyright (C) 2015-2021 Marco Bortolin
*
* This file is part of IBMulator.
*
Expand Down Expand Up @@ -47,6 +47,7 @@
#include "machine.h"
#include "pit82c54.h"

#define PIT_CNT1_AUTO_UPDATE false

void PIT_82C54::init()
{
Expand Down
25 changes: 4 additions & 21 deletions src/ibmulator.h
Expand Up @@ -22,17 +22,8 @@

#define DEFAULT_HEARTBEAT 16683333
#define CHRONO_RDTSC false
#define USE_PREFETCH_QUEUE true
#define PIT_CNT1_AUTO_UPDATE false


/*
* For CPU logging options see hardware/cpu/logger.h
*/

#define PATHNAME_LEN 512
#define N_PARALLEL_PORTS 1

// For CPU logging options see hardware/cpu/logger.h

#include "config.h"
#include <cstdint>
Expand All @@ -42,22 +33,14 @@
#include <cstdio>
#include <stdexcept>

#if !defined(_MSC_VER)
#if defined(__GNUC__)
// both gcc and clang define __GNUC__
#define GCC_ATTRIBUTE(x) __attribute__ ((x))
#define LIKELY(x) __builtin_expect((x),1)
#define UNLIKELY(x) __builtin_expect((x),0)
#define ALWAYS_INLINE GCC_ATTRIBUTE(always_inline)
#else
#define GCC_ATTRIBUTE(x)
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#define ALWAYS_INLINE inline
#endif

#if defined(_MSC_VER) && (_MSC_VER>=1300)
#define MSC_ALIGN(x) __declspec(align(x))
#else
#define MSC_ALIGN(x)
#error unsupported compiler
#endif

#define UNUSED(x) ((void)x)
Expand Down

0 comments on commit 8b4b097

Please sign in to comment.