From e0e85ba6e358f9d5b757671e1a7d236f522f3bb4 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Wed, 25 Aug 2010 16:07:31 +0100 Subject: [PATCH] core: CALL/RET instructions fix Swap LSB and MSB of return address on the stack. Thanks to "Peter" on the simavr mailing list. Signed-off-by: Michel Pollet --- simavr/sim/sim_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index 06f4f45..ebb4646 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -230,14 +230,14 @@ static inline uint8_t _avr_pop8(avr_t * avr) inline void _avr_push16(avr_t * avr, uint16_t v) { - _avr_push8(avr, v >> 8); _avr_push8(avr, v); + _avr_push8(avr, v >> 8); } static inline uint16_t _avr_pop16(avr_t * avr) { - uint16_t res = _avr_pop8(avr); - res |= _avr_pop8(avr) << 8; + uint16_t res = _avr_pop8(avr) << 8; + res |= _avr_pop8(avr); return res; } -- 2.39.5