Mercurial > repos > blastem
comparison m68k_to_x86.c @ 102:bfaca67eeb78
allocate a new native code chunk when we run out of space
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 27 Dec 2012 22:41:28 -0800 |
parents | 45cd7d3e7918 |
children | a0fdaa134964 |
comparison
equal
deleted
inserted
replaced
101:d7789186ba5e | 102:bfaca67eeb78 |
---|---|
2160 exit(1); | 2160 exit(1); |
2161 } | 2161 } |
2162 do { | 2162 do { |
2163 do { | 2163 do { |
2164 if (dst_end-dst < 128) { | 2164 if (dst_end-dst < 128) { |
2165 puts("out of code memory"); | 2165 if (dst_end-dst < 5) { |
2166 exit(1); | 2166 puts("out of code memory, not enough space for jmp to next chunk"); |
2167 exit(1); | |
2168 } | |
2169 size_t size = 1024*1024; | |
2170 opts->cur_code = alloc_code(&size); | |
2171 opts->code_end = opts->cur_code + size; | |
2172 jmp(dst, opts->cur_code); | |
2173 dst = opts->cur_code; | |
2174 dst_end = opts->code_end; | |
2167 } | 2175 } |
2168 next = m68k_decode(encoded, &instbuf, address); | 2176 next = m68k_decode(encoded, &instbuf, address); |
2169 address += (next-encoded)*2; | 2177 address += (next-encoded)*2; |
2170 encoded = next; | 2178 encoded = next; |
2171 m68k_disasm(&instbuf, disbuf); | 2179 m68k_disasm(&instbuf, disbuf); |