From nobody Wed May 29 02:43:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=zx2c4.com ARC-Seal: i=1; a=rsa-sha256; t=1577915999; cv=none; d=zohomail.com; s=zohoarc; b=JXc5tjqYq7pqTzSPg4XswrfK2ORPVhwfdX41eINhseqAvOxFX0gBodBBda0h03LE9xDYFmxUFL63Am4vD36e4SNKeHi4VEA03+GYRyoOryiVPywYIZ8wzITelHz9Y5lFy4be6n/jDb5OOaw+kcXYA8kYIMj1B75O6nUkJ//RwYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577915999; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=NNm4Q5QZ0IrMXM/Vg6uMECoLYTiY2s6u68DZ9BrRu/4=; b=SKTHRDb87ZfbfVl/0rdNdxsR51V8o4VVCfDBRbpJNpl6hBxAUI8GIsk5zz0gtHGVkABYp11uWUIsF5K1Dc5Fnw6nyfuJX5mX7TFbtp7Xxy4fp/8DaxRE8XGsmZU37r7YUfrDwcq1eC6anVB1fFBidxPCqDw+ocxgigSEcZzYkm0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1577915999346615.3142223387127; Wed, 1 Jan 2020 13:59:59 -0800 (PST) Received: from localhost ([::1]:33704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imm21-0000iv-Cv for importer@patchew.org; Wed, 01 Jan 2020 16:59:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43863) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imm1M-0000DV-32 for qemu-devel@nongnu.org; Wed, 01 Jan 2020 16:59:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imm1L-0000sP-0E for qemu-devel@nongnu.org; Wed, 01 Jan 2020 16:59:16 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:42933) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imm1K-0000rr-PX for qemu-devel@nongnu.org; Wed, 01 Jan 2020 16:59:14 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 87978453; Wed, 1 Jan 2020 21:00:48 +0000 (UTC) Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 82aa3d3c (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Wed, 1 Jan 2020 21:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=mail; bh=auhmAWnYAPQMIKl+85pQj+CnBmw=; b=twsNE1tXdQdwd2Vipdav okbaYFrv5ZpLI1cgzIX5vEMUMhZ8rGPbY/T1SJao46TgIKJVkxbUkjowFQ+JVfSb kIuNkEufTL+7PS23thQmeRXzCC3bWEJ1bQP1JTp1/gs1dcJpPJnh1VElxgsxyYGZ SD0fP6Vy4u80S+X2bclgOlpfReKH0xcYJcevoHKzfsrmKNGG4C0XTeGyr6us+IVD CEEjlSvjeXS2L8s02oZnx5FQXYs03oLl4ZperYh+L4FV/FTWv+K5bDJU/7FO7aeo niVMUjrp1NUcfrOfuFp6rAjGZysxTvvyZeyegqg0cZe3cDmxxKD+oQcD/40v8Hl6 eQ== From: "Jason A. Donenfeld" To: laurent@vivier.eu, qemu-devel@nongnu.org Subject: [PATCH] q800: map reset function to poweroff of some random kernel Date: Wed, 1 Jan 2020 22:59:05 +0100 Message-Id: <20200101215905.121298-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.95.5.64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason A. Donenfeld" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @zx2c4.com) Content-Type: text/plain; charset="utf-8" This commit is intentionally ridiculous. Currently calling `reboot(RB_AUTOBOOT);` in Linux will result in arch/m68k/mac/misc.c's mac_reset function being called. That in turn looks at the rombase (or uses 0x40800000 is there's no rombase), adds 0xa, and jumps to that address. In the kernels I'm building for build.wireguard.com, I'm using -no-reboot, which means that reboot=3Dpoweroff for me. And on these kernels, the mac_poweroff function winds up being at 0x7252. So, this patch here hard codes 0x7252-0xa=3D0x7248 as the rombase, so that the reset function calls the poweroff function. The poweroff function then calls into the working via2 hook. Sorry if this absurd hack offended your sensibilities. Probably a better solution would be actually mapping in a real rom and providing something at the 0xa offset, perhaps adding some reset functionality to via2 and sticking some code there to tinker with it, or something else. Signed-off-by: Jason A. Donenfeld --- hw/m68k/q800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 4ca8678007..bd75dd3141 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -339,6 +339,7 @@ static void q800_init(MachineState *machine) BOOTINFO1(cs->as, parameters_base, BI_MAC_VROW, (graphic_width * graphic_depth + 7) / 8); BOOTINFO1(cs->as, parameters_base, BI_MAC_SCCBASE, SCC_BASE); + BOOTINFO1(cs->as, parameters_base, BI_MAC_ROMBASE, 0x7248); =20 if (kernel_cmdline) { BOOTINFOSTR(cs->as, parameters_base, BI_COMMAND_LINE, --=20 2.24.1