Building Dosbox With Dynrec


pupnik

Member
Joined
Jul 17, 2007
Messages
107
Building dosbox 0.74 with dynrec
./configure --enable-core-inline --disable-dynamic-x86 --enable-dynrec --disable-fpu-x86 CXXFLAGS="-O2 -ffast-math -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -mthumb-interwork

then edit

config.h

/* Define to 1 to use x86 dynamic cpu core */
#undef C_DYNAMIC_X86

/* Define to 1 to use recompiling cpu core. Can not be used together with the
dynamic-x86 core */
#define C_DYNREC 1

Code:
make[4]: Entering directory `/home/pupnik/dev/dosbox-0.74/src/cpu'
g++ -DHAVE_CONFIG_H -I. -I../..  -I../../include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -O2 -ffast-math -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -mthumb-interwork  -MT core_dynrec.o -MD -MP -MF .deps/core_dynrec.Tpo -c -o core_dynrec.o core_dynrec.cpp
In file included from core_dynrec/decoder.h:22,
                 from core_dynrec.cpp:157:
core_dynrec/decoder_basic.h: In function 'void dyn_reduce_cycles()':
core_dynrec/decoder_basic.h:470: error: 'gen_sub_direct_word' was not declared in this scope
core_dynrec/decoder_basic.h: At global scope:
core_dynrec/decoder_basic.h:476: error: variable or field 'dyn_set_eip_last_end' declared void
core_dynrec/decoder_basic.h:476: error: 'HostReg' was not declared in this scope
core_dynrec/decoder_basic.h: In function 'void dyn_set_eip_last()':
core_dynrec/decoder_basic.h:484: error: 'gen_add_direct_word' was not declared in this scope
core_dynrec/decoder_basic.h: In function 'void dyn_set_eip_end()':
core_dynrec/decoder_basic.h:489: error: 'gen_add_direct_word' was not declared in this scope
core_dynrec/decoder_basic.h: At global scope:
core_dynrec/decoder_basic.h:493: error: variable or field 'dyn_set_eip_end' declared void
core_dynrec/decoder_basic.h:493: error: 'HostReg' was not declared in this scope
core_dynrec/decoder_basic.h:493: error: expected primary-expression before 'imm'
core_dynrec/decoder_basic.h:506: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:511: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:516: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:522: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:528: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:534: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:540: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:545: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:551: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:558: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:564: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:571: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:579: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:587: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:592: error: expected initializer before 'inline'
core_dynrec/decoder_basic.h:617: error: 'DRC_PTR_SIZE_IM' does not name a type
core_dynrec/decoder_basic.h: In function 'void dyn_return(BlockReturn, bool)':
core_dynrec/decoder_basic.h:628: error: 'FC_RETOP' was not declared in this scope
core_dynrec/decoder_basic.h:628: error: 'gen_mov_dword_to_reg_imm' was not declared in this scope
core_dynrec/decoder_basic.h:630: error: 'gen_return_function' was not declared in this scope
core_dynrec/decoder_basic.h: In function 'void dyn_run_code()':
core_dynrec/decoder_basic.h:634: error: 'gen_run_code' was not declared in this scope
core_dynrec/decoder_basic.h:635: error: 'gen_return_function' was not declared in this scope
core_dynrec/decoder_basic.h: In function 'void dyn_fill_blocks()':
core_dynrec/decoder_basic.h:642: error: 'struct<anonymous>' has no member named 'branch_pos'
core_dynrec/decoder_basic.h:642: error: 'gen_fill_branch_long' was not declared in this scope
core_dynrec/decoder_basic.h:647: error: 'gen_call_function_II' was not declared in this scope
core_dynrec/decoder_basic.h:648: error: 'gen_call_function_II' was not declared in this scope
core_dynrec/decoder_basic.h:657: error: 'gen_add_direct_word' was not declared in this scope
core_dynrec/decoder_basic.h: In function 'void dyn_closeblock()':
core_dynrec/decoder_basic.h:669: error: 'cache_block_before_close' was not declared in this scope
core_dynrec/decoder_basic.h:671: error: 'cache_block_closing' was not declared in this scope
core_dynrec/decoder_basic.h: At global scope:
core_dynrec/decoder_basic.h:676: error: variable or field 'dyn_check_exception' declared void
core_dynrec/decoder_basic.h:676: error: 'HostReg' was not declared in this scope
core_dynrec/decoder_basic.h:689: error: expected initializer before 'mem_readb_checked_drc'
core_dynrec/decoder_basic.h:690: error: expected initializer before 'mem_readb_checked_drc'
In file included from /usr/include/c++/4.3.3/new:45,
                 from /usr/include/c++/4.3.3/ext/new_allocator.h:37,
                 from /usr/include/c++/4.3.3/arm-angstrom-linux-gnueabi/bits/c++allocator.h:39,
                 from /usr/include/c++/4.3.3/bits/allocator.h:53,
                 from /usr/include/c++/4.3.3/string:48,
                 from ../../include/cross.h:31,
                 from core_dynrec/dyn_fpu.h:27,
                 from core_dynrec/decoder.h:26,
                 from core_dynrec.cpp:157:
/usr/include/c++/4.3.3/exception:40: error: expected declaration before end of line
make[4]: *** [core_dynrec.o] Error 1
make[4]: Leaving directory `/home/pupnik/dev/dosbox-0.74/src/cpu'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/pupnik/dev/dosbox-0.74/src/cpu'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/pupnik/dev/dosbox-0.74/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/pupnik/dev/dosbox-0.74'
make: *** [all] Error 2

what am i doing wrong? pickle? can U show me your recipe for building with dynrec?

with the standard angstrom 0.74 i'm limited to about 3000 cycles
 
In config.h you need to change this

/* The type of cpu this target has */
#define C_TARGETCPU ARMV4LE

Also in src/cpu/core_dynrec/risc_armv4le.h you can comment/uncomment various versions of the dynarec.
risc_armv4le-thumb-iw.h is the fastest one using thumb instructions (requires -mthumb-interwork switch when compiling dosbox), on GP2X it's also the fastest one overall.
 
M-HT said:
In config.h you need to change this

/* The type of cpu this target has */
#define C_TARGETCPU ARMV4LE

Also in src/cpu/core_dynrec/risc_armv4le.h you can comment/uncomment various versions of the dynarec.
risc_armv4le-thumb-iw.h is the fastest one using thumb instructions (requires -mthumb-interwork switch when compiling dosbox), on GP2X it's also the fastest one overall.

great speed improvement - 3000 to ~4000-5000 cycles! Pretty awesome; Wing Commander and Ultima Underworld now playable. Looks like pretty much every DOS game up to 1992 is solid.

so far i've tried
CXXFLAGS = -O3 -ffast-math -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -mthumb-interwork
as well as -O2

the auto-vectorizing is pretty useless though... and core_normal.cpp sometimes crashed g++ while building

I set sound emulation to 24000 hz to make it a fixed multiple of alsa's 48khz output.. Using advmame2x scaler for several games (Beautiful in underworld)

i see the mem_* stuff is really often called... any 'easy' optimizations for arm there?
 
Last edited by a moderator:
Back
Top