Mercurial > repos > blastem
comparison gen_x86.c @ 1298:d5a47597b61f
Prevent blowing past our native translated instruction size of 255 bytes when translating movem with a large register list. Fixes bug in which Fantastic Dizzy was completely broken on 32-bit builds
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 25 Mar 2017 00:21:32 -0700 |
parents | 0649cd8ca097 |
children | 101b5ce682fe |
comparison
equal
deleted
inserted
replaced
1297:71b1a080b30c | 1298:d5a47597b61f |
---|---|
1997 fatal_error("call: %p - %p = %lX which is out of range for a 32-bit displacement\n", fun, out + 5, (long)disp); | 1997 fatal_error("call: %p - %p = %lX which is out of range for a 32-bit displacement\n", fun, out + 5, (long)disp); |
1998 } | 1998 } |
1999 code->cur = out; | 1999 code->cur = out; |
2000 } | 2000 } |
2001 | 2001 |
2002 | 2002 volatile int foo; |
2003 void call(code_info *code, code_ptr fun) | 2003 void call(code_info *code, code_ptr fun) |
2004 { | 2004 { |
2005 foo = *fun; | |
2005 code->stack_off += sizeof(void *); | 2006 code->stack_off += sizeof(void *); |
2006 int32_t adjust = 0; | 2007 int32_t adjust = 0; |
2007 if (code->stack_off & 0xF) { | 2008 if (code->stack_off & 0xF) { |
2008 adjust = 16 - (code->stack_off & 0xF); | 2009 adjust = 16 - (code->stack_off & 0xF); |
2009 code->stack_off += adjust; | 2010 code->stack_off += adjust; |
2060 { | 2061 { |
2061 check_alloc_code(code, 1); | 2062 check_alloc_code(code, 1); |
2062 code_ptr out = code->cur; | 2063 code_ptr out = code->cur; |
2063 *(out++) = OP_RETN; | 2064 *(out++) = OP_RETN; |
2064 code->cur = out; | 2065 code->cur = out; |
2066 } | |
2067 | |
2068 void rts(code_info *code) | |
2069 { | |
2070 retn(code); | |
2065 } | 2071 } |
2066 | 2072 |
2067 void cdq(code_info *code) | 2073 void cdq(code_info *code) |
2068 { | 2074 { |
2069 check_alloc_code(code, 1); | 2075 check_alloc_code(code, 1); |