exec: Fix watchpoint implementation
PATCH 1/1 exec: Fix watchpoint implementation
Fix a bug introduced by commit 1ec9b909ff207a44d5ef2609cb4a2e3d449d485f where 'watch_mem_write' was modified to fall-through to 'abort' on every input.
--- exec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
exec.c +3 -3
@@ -3289,9 +3289,9 @@ static void watch_mem_write(void *opaque, target_phys_addr_t addr, {check_watchpoint (addr & ~TARGET_PAGE_MASK , ~(size -1 ),BP_MEM_WRITE );switch (size) { -case 1 :stb_phys (addr, val); -case 2 :stw_phys (addr, val); -case 4 :stl_phys (addr, val); +case 1 :return stb_phys (addr, val); +case 2 :return stw_phys (addr, val); +case 4 :return stl_phys (addr, val);default :abort (); } }
Signature · 1 line
1.7.7.6
Quoted 16 lines · Meador Inge
Fix a bug introduced by commit
1ec9b909ff207a44d5ef2609cb4a2e3d449d485fwhere 'watch_mem_write' was modified to fall-through to 'abort' on every input.Signed-off-by Meador Inge <[email protected]>--- exec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)exec.c +0
-0@@ -3289,9 +3289,9 @@ static void watch_mem_write(void *opaque, target_phys_addr_t addr, {check_watchpoint (addr & ~TARGET_PAGE_MASK , ~(size -1 ),BP_MEM_WRITE );
exec.c static void watch_mem_write(void *opaque, target_phys_addr_t addr, · line 3297
Quoted 10 lines
exec.c +3
-3switch (size) { -case 1 :stb_phys (addr, val); -case 2 :stw_phys (addr, val); -case 4 :stl_phys (addr, val); +case 1 :return stb_phys (addr, val); +case 2 :return stw_phys (addr, val); +case 4 :return stl_phys (addr, val);default :abort (); } }
You likely wanted to introduce breaks here, no...?
At this chance, please indent the code properly according to our coding style:
switch ...
case ...
xxx;
break;Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Meador Inge
Fix a bug introduced by commit
1ec9b909ff207a44d5ef2609cb4a2e3d449d485fwhere 'watch_mem_write' was modified to fall-through to 'abort' on every input.Signed-off-by Meador Inge <[email protected]>--- exec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)exec.c +0
-3@@ -3289,9 +3289,9 @@ static void watch_mem_write(void *opaque, target_phys_addr_t addr, {check_watchpoint (addr & ~TARGET_PAGE_MASK , ~(size -1 ),BP_MEM_WRITE );switch (size) { -case 1 :stb_phys (addr, val); -case 2 :stw_phys (addr, val); -case 4 :stl_phys (addr, val);
Quoted 8 lines
exec.c static void watch_mem_write(void *opaque, target_phys_addr_t addr, · line 3297
Quoted 6 lines
exec.c +3
-0+case 1 :return stb_phys (addr, val); +case 2 :return stw_phys (addr, val); +case 4 :return stl_phys (addr, val);default :abort (); } }You likely wanted to introduce breaks here, no...?
I see both styles in 'exec.c'. An example similar to the above is:
static void subpage_ram_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
ram_addr_t raddr = addr;
void *ptr = qemu_get_ram_ptr(raddr);
switch (size) {
case 1: return stb_p(ptr, value);
case 2: return stw_p(ptr, value);
case 4: return stl_p(ptr, value);
default: abort();
}
}I will switch to the 'break' style if that is more consistent with the general coding convention.
Signature · 3 lines
Meador Inge CodeSourcery / Mentor Embedded http://www.mentor.com/embedded-software
Quoted 32 lines · Meador Inge
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Meador Inge
Fix a bug introduced by commit
1ec9b909ff207a44d5ef2609cb4a2e3d449d485fwhere 'watch_mem_write' was modified to fall-through to 'abort' on every input.Signed-off-by Meador Inge <[email protected]>--- exec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)exec.c +0
-3@@ -3289,9 +3289,9 @@ static void watch_mem_write(void *opaque, target_phys_addr_t addr, {check_watchpoint (addr & ~TARGET_PAGE_MASK , ~(size -1 ),BP_MEM_WRITE );switch (size) { -case 1 :stb_phys (addr, val); -case 2 :stw_phys (addr, val); -case 4 :stl_phys (addr, val);Quoted 8 lines
exec.c static void watch_mem_write(void *opaque, target_phys_addr_t addr, · line 3297
Quoted 6 lines
exec.c +3
-0+case 1 :return stb_phys (addr, val); +case 2 :return stw_phys (addr, val); +case 4 :return stl_phys (addr, val);default :abort (); } }You likely wanted to introduce breaks here, no...?
Quoted 1 line
I see both styles in '
exec.c'. An example similar to the above is:
There is a lot of legacy code in QEMU. Better look at CODING_STYLE when in doubt.
Quoted 14 lines
static void subpage_ram_write(void *opaque,
target_phys_addr_taddr,
uint64_tvalue, unsigned size){ ram_addr_t raddr = addr; void *ptr = qemu_get_ram_ptr(raddr); switch (size) { case 1: return stb_p(ptr, value); case 2: return stw_p(ptr, value); case 4: return stl_p(ptr, value); default: abort(); } }
Quoted 2 lines
I will switch to the 'break' style if that is more consistent with the general coding convention.
That's also nonsense: neither st*_p nor st*_phys return anything else than void.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux