From: Forrest Y. Y. <for...@gm...> - 2008-07-31 04:51:22
|
Sorry I forgot to attach the patch file. On Thu, Jul 31, 2008 at 12:11 PM, Forrest Y. Yu <for...@gm...>wrote: > > > On Thu, Jul 31, 2008 at 1:57 AM, Sebastian Herbszt <he...@gm...> wrote: > >> Forrest Y. Yu wrote: >> >> The attachment is the patch file. >>> $ patch cpu.cc < cpu.cc.patch >>> >>> --- cpu.cc 2008-05-11 04:35:03.000000000 +0800 >>> +++ new.cpu.cc 2008-07-30 10:57:25.000000000 +0800 >>> >> >> calling the old file cpu.cc.orig and the new one cpu.cc produces >> a more common patch header > > > Thank you. I have made a new patch file with modified code and names. See > the attachment please. > > >> >> >> @@ -88,8 +88,29 @@ >>> #define CHECK_MAX_INSTRUCTIONS(count) >>> #endif >>> +// Forrest (YYu) added >>> +#if BX_SUPPORT_SMP || BX_DEBUGGER >>> + #define CHECK_MAX_INSTRUCTIONS_1(count) \ >>> + int check_max_flag = 0; >>> >> >> Why does this need "count" ? >> The name is kind of misleading too, since it does not check anything. >> Maybe moving this down into BX_CPU_C::cpu_loop would be better. > > > My modification uses no macros any more. I just put everything into > cpu_loop(). I also renamed the local var, which is initialized to 0 and will > be 1 once max_instr_count reachs 0. I'm sorry that I cannot give the var a > very good name (short and graceful). I feel myself stupid when I try to name > a variable. > > >> >> >> + #define CHECK_MAX_INSTRUCTIONS_2(count) \ >>> + if (check_max_flag) { \ >>> + if ((count) == 0) return; \ >>> + } >>> + #define CHECK_MAX_INSTRUCTIONS_3(count) \ >>> + if ((count) > 0) { \ >>> + (count)--; \ >>> + if ((count) == 0) \ >>> + check_max_flag = 1; \ >>> + } >>> +#else >>> + #define CHECK_MAX_INSTRUCTIONS_1(count) >>> + #define CHECK_MAX_INSTRUCTIONS_2(count) >>> + #define CHECK_MAX_INSTRUCTIONS_3(count) >>> +#endif >>> + >>> void BX_CPU_C::cpu_loop(Bit32u max_instr_count) >>> { >>> + CHECK_MAX_INSTRUCTIONS_1(count); >>> #if BX_DEBUGGER >>> BX_CPU_THIS_PTR break_point = 0; >>> BX_CPU_THIS_PTR magic_break = 0; >>> @@ -188,6 +209,7 @@ >>> #if BX_DEBUGGER || BX_EXTERNAL_DEBUGGER || BX_GDBSTUB >>> if (dbg_instruction_prolog()) return; >>> #endif >>> + CHECK_MAX_INSTRUCTIONS_2(max_instr_count); >>> #if BX_DISASM >>> if (BX_CPU_THIS_PTR trace) { >>> @@ -212,7 +234,9 @@ >>> if (dbg_instruction_epilog()) return; >>> #endif >>> - CHECK_MAX_INSTRUCTIONS(max_instr_count); >>> + // Forrest (YYu) modified: >>> + //CHECK_MAX_INSTRUCTIONS(max_instr_count); >>> + CHECK_MAX_INSTRUCTIONS_3(max_instr_count); >>> #if BX_SUPPORT_TRACE_CACHE >>> if (BX_CPU_THIS_PTR async_event) { >>> >> >> - Sebastian >> >> > Regards, > Forrest > > -- > Stupid is as stupid does. > -- Stupid is as stupid does. |