From patchwork Sun Jan 29 02:19:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 138428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 18A4BB6F68 for ; Sun, 29 Jan 2012 14:05:20 +1100 (EST) Received: from localhost ([::1]:34751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrKNZ-0007cz-MN for incoming@patchwork.ozlabs.org; Sat, 28 Jan 2012 21:20:29 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrKNC-0006t1-3X for qemu-devel@nongnu.org; Sat, 28 Jan 2012 21:20:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrKN7-0001SD-Vs for qemu-devel@nongnu.org; Sat, 28 Jan 2012 21:20:04 -0500 Received: from mail-bk0-f45.google.com ([209.85.214.45]:55149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrKN7-0001QV-Mv for qemu-devel@nongnu.org; Sat, 28 Jan 2012 21:20:01 -0500 Received: by mail-bk0-f45.google.com with SMTP id zu17so2552595bkb.4 for ; Sat, 28 Jan 2012 18:20:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=xepj2s1DlPe7H+oP9dH02UhXZNCOGJymQCzKwZsxOB8=; b=I3J+onhKoeAsTJdMp6Yr1hHBq8s3vD6OClo7oI9GkJwnoG13Dl4iNZBvBxExMkILU9 vNKdagUoUkyMrNibG2AyzsIJjJmNs6jPbXnp4j5NO9UX8wQPT92jNOx6e2TWq4QCYFfh R9UyU8dncMvPtSsfKR5jSbQ8vynyBfdWb2/H4= Received: by 10.204.145.82 with SMTP id c18mr5707169bkv.121.1327803601252; Sat, 28 Jan 2012 18:20:01 -0800 (PST) Received: from octofox.metropolis ([188.134.19.124]) by mx.google.com with ESMTPS id x20sm11857569bka.9.2012.01.28.18.19.59 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 28 Jan 2012 18:20:00 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Sun, 29 Jan 2012 06:19:28 +0400 Message-Id: <1327803571-30553-7-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1327803571-30553-1-git-send-email-jcmvbkbc@gmail.com> References: <1327803571-30553-1-git-send-email-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.45 Cc: jcmvbkbc@gmail.com Subject: [Qemu-devel] [RFC 6/9] exec: let cpu_watchpoint_insert accept larger watchpoints X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make cpu_watchpoint_insert accept watchpoints of any power-of-two size up to the target page size. Signed-off-by: Max Filippov --- exec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/exec.c b/exec.c index bc6c185..39a5497 100644 --- a/exec.c +++ b/exec.c @@ -1443,7 +1443,8 @@ int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len, CPUWatchpoint *wp; /* sanity checks: allow power-of-2 lengths, deny unaligned watchpoints */ - if ((len != 1 && len != 2 && len != 4 && len != 8) || (addr & ~len_mask)) { + if ((len & (len - 1)) || (addr & ~len_mask) || + len == 0 || len > TARGET_PAGE_SIZE) { fprintf(stderr, "qemu: tried to set invalid watchpoint at " TARGET_FMT_lx ", len=" TARGET_FMT_lu "\n", addr, len); return -EINVAL;