Skip to content

Commit

Permalink
Take one step for x86-64 dynamic core, at least to start it. Don't
Browse files Browse the repository at this point in the history
actually try to use it yet though.
  • Loading branch information
joncampbell123 committed Feb 20, 2018
1 parent 3d3c53d commit 0ca65b9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/cpu/core_dyn_x86/risc_x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class GenReg {
static BlockReturn gen_runcode(Bit8u * code) {
BlockReturn retval;
#if defined (_MSC_VER)
# if C_DYNAMIC_X86 == 64 // x86-64 64-bit
# error not implemented
# endif
__asm {
/* Prepare the flags */
mov eax,[code]
Expand All @@ -112,6 +115,9 @@ static BlockReturn gen_runcode(Bit8u * code) {
mov [retval],eax
}
#elif defined (MACOSX)
# if C_DYNAMIC_X86 == 64 // x86-64 64-bit
# error not implemented
# endif
register Bit32u tempflags=reg_flags & FMASK_TEST;
__asm__ volatile (
"pushl %%ebx \n"
Expand All @@ -128,6 +134,22 @@ static BlockReturn gen_runcode(Bit8u * code) {
);
reg_flags=(reg_flags & ~FMASK_TEST) | (tempflags & FMASK_TEST);
#else
# if C_DYNAMIC_X86 == 64 // x86-64 64-bit
register Bit64u tempflags=reg_flags & FMASK_TEST;

// WARNING: UNDER CONSTRUCTION!

__asm__ volatile (
"pushq $(run_return_adress) \n"
"pushq %2 \n"
"jmp *%3 \n"
"run_return_adress: \n"
:"=a" (retval), "=c" (tempflags)
:"r" (tempflags),"r" (code)
:"%rdx","%rbx","%rdi","%rsi","%rbp","%r8","cc","memory"
);
reg_flags=(reg_flags & ~FMASK_TEST) | (tempflags & FMASK_TEST);
# else // x86 32-bit
register Bit32u tempflags=reg_flags & FMASK_TEST;
__asm__ volatile (
"pushl $(run_return_adress) \n"
Expand All @@ -139,6 +161,7 @@ static BlockReturn gen_runcode(Bit8u * code) {
:"%edx","%ebx","%edi","%esi","%ebp","cc","memory"
);
reg_flags=(reg_flags & ~FMASK_TEST) | (tempflags & FMASK_TEST);
# endif
#endif
return retval;
}
Expand Down

0 comments on commit 0ca65b9

Please sign in to comment.