Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814728/?format=api
{ "id": 814728, "url": "http://patchwork.ozlabs.org/api/patches/814728/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170917225927.117917-9-sjg@chromium.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170917225927.117917-9-sjg@chromium.org>", "list_archive_url": null, "date": "2017-09-17T22:59:19", "name": "[U-Boot,08/16] sandbox: Add a setjmp() implementation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "9b4afc719228a8188f13d858ee5bc62d06e1265f", "submitter": { "id": 6170, "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api", "name": "Simon Glass", "email": "sjg@chromium.org" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170917225927.117917-9-sjg@chromium.org/mbox/", "series": [ { "id": 3549, "url": "http://patchwork.ozlabs.org/api/series/3549/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3549", "date": "2017-09-17T22:59:11", "name": "efi: Enable basic sandbox support for EFI loader", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3549/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814728/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814728/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"E66QvQtQ\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xwRVY332vz9s7B\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 10:20:37 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 1EAFEC21EBB; Mon, 18 Sep 2017 00:20:36 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 20693C21EF4;\n\tSun, 17 Sep 2017 23:02:08 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 7C27FC21EA5; Sun, 17 Sep 2017 23:02:05 +0000 (UTC)", "from mail-io0-f182.google.com (mail-io0-f182.google.com\n\t[209.85.223.182])\n\tby lists.denx.de (Postfix) with ESMTPS id A756CC21EA5\n\tfor <u-boot@lists.denx.de>; Sun, 17 Sep 2017 22:59:40 +0000 (UTC)", "by mail-io0-f182.google.com with SMTP id z187so14796651ioz.12\n\tfor <u-boot@lists.denx.de>; Sun, 17 Sep 2017 15:59:40 -0700 (PDT)", "from kiwi.bld.corp.google.com ([100.101.164.89])\n\tby smtp.gmail.com with ESMTPSA id\n\tp62sm8201835oic.50.2017.09.17.15.59.36\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 17 Sep 2017 15:59:37 -0700 (PDT)", "by kiwi.bld.corp.google.com (Postfix, from userid 121222)\n\tid 156B714052F; Sun, 17 Sep 2017 16:59:36 -0600 (MDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no\n\tversion=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=+22QsbwNqUPdUgpwlwjUDI0EOMWpLb6GrmkNKE6ja+Q=;\n\tb=E66QvQtQbjDZ6unEF2dJjdrh2D2S4noi2/xM4FJjd58yeu5QxS9R3gqEhVk9HKtKTL\n\tnXbesSP4ePZh7MfO5A0HnRJRRM15iT0tJ1v/YgTQ1BU7HpxdfhV4yT6Wt3cNe2dy8/aH\n\tlpIycLNyA73YYeRxwTc04xU8FZKMJfqBivoIoGEKJKhpz37RbL5tuUa5IGJTe/nYwiIS\n\tu7nxDL2qaXKIypsfMc4gkss7a7N6b/g1Sq6c/qJqmhn9JfD7WiWNF8ZDyQj2BKBgT6V6\n\tuVpkmOpwHqAJ0Sw+JffOy5EEGnckDMWw3mD1dguL0VQeblH5ofmwCz5RWgK7mskYuFET\n\tQpcA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=+22QsbwNqUPdUgpwlwjUDI0EOMWpLb6GrmkNKE6ja+Q=;\n\tb=YtmvuV3ppLHVmUUAHbBzNkiDC0vMm0j2klI02q8/DiOJNsYhIg5K9+i8vVChc8HgQ7\n\t3L41ZCHALPy7wIwLnFXnDu4YY+wfJo5dgenb7UmakqxAMQyHy4u0SXEx9RupxWh+vUFu\n\tMB+Pu5MsnLhePWA06XiDXICy7gUBjZVQQ2dyP/bvYj8kVGTiXO/M/kvR4KIsDsqcd0Xg\n\tKJUAeEGVVNOHc/nvglvj8x3EzaeA5pKQQr3tQKDp4HZgf1xjLGbDZ6M8id4Y1AU9S3/q\n\tL0LincvgwOqf9cBL+b5dBk33yw6L/FnTRni7EpKLyj5IleJgNjdnOdVaCq7YD3aV033w\n\tDRug==", "X-Gm-Message-State": "AHPjjUhfi4QUlGpe8rbcX0n/qSXsSMnGfxV5V8Uc8KwrUBJuqIwbxM1C\n\tZC+Sk2qpEq5TjMw4", "X-Google-Smtp-Source": "AOwi7QCBAB5mr7rWzvfUE8jqkblshltzpJ9Rk73YV2rv26py56HDUA05FZ0pRhQblCf6tfX8PJMimA==", "X-Received": "by 10.202.79.13 with SMTP id d13mr32283148oib.141.1505689179218; \n\tSun, 17 Sep 2017 15:59:39 -0700 (PDT)", "From": "Simon Glass <sjg@chromium.org>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Sun, 17 Sep 2017 16:59:19 -0600", "Message-Id": "<20170917225927.117917-9-sjg@chromium.org>", "X-Mailer": "git-send-email 2.14.1.690.gbb1197296e-goog", "In-Reply-To": "<20170917225927.117917-1-sjg@chromium.org>", "References": "<20170917225927.117917-1-sjg@chromium.org>", "Cc": "Andy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>", "Subject": "[U-Boot] [PATCH 08/16] sandbox: Add a setjmp() implementation", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "Add an implementation of setjmp() and longjmp() which rely on the\nunderlying host C library. Since we cannot know how large the jump buffer\nneeds to be, pick something that should be suitable and check it at\nruntime. At present we need access to the underlying struct as well.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n arch/sandbox/cpu/cpu.c | 13 +++++++++++++\n arch/sandbox/cpu/os.c | 17 +++++++++++++++++\n arch/sandbox/include/asm/setjmp.h | 21 +++++++++++++++++++++\n include/os.h | 21 +++++++++++++++++++++\n 4 files changed, 72 insertions(+)\n create mode 100644 arch/sandbox/include/asm/setjmp.h", "diff": "diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c\nindex 01991049cc..de5862a53b 100644\n--- a/arch/sandbox/cpu/cpu.c\n+++ b/arch/sandbox/cpu/cpu.c\n@@ -9,6 +9,7 @@\n #include <libfdt.h>\n #include <os.h>\n #include <asm/io.h>\n+#include <asm/setjmp.h>\n #include <asm/state.h>\n #include <dm/root.h>\n \n@@ -154,3 +155,15 @@ ulong timer_get_boot_us(void)\n \n \treturn (count - base_count) / 1000;\n }\n+\n+int setjmp(jmp_buf jmp)\n+{\n+\treturn os_setjmp((ulong *)jmp, sizeof(jmp));\n+}\n+\n+void longjmp(jmp_buf jmp, int ret)\n+{\n+\tos_longjmp((ulong *)jmp, ret);\n+\twhile (1)\n+\t\t;\n+}\ndiff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c\nindex 22d6aab534..909034fa4b 100644\n--- a/arch/sandbox/cpu/os.c\n+++ b/arch/sandbox/cpu/os.c\n@@ -7,6 +7,7 @@\n #include <errno.h>\n #include <fcntl.h>\n #include <getopt.h>\n+#include <setjmp.h>\n #include <stdio.h>\n #include <stdint.h>\n #include <stdlib.h>\n@@ -609,3 +610,19 @@ void os_localtime(struct rtc_time *rt)\n \trt->tm_yday = tm->tm_yday;\n \trt->tm_isdst = tm->tm_isdst;\n }\n+\n+int os_setjmp(ulong *jmp, int size)\n+{\n+\tif (size < sizeof(jmp_buf)) {\n+\t\tprintf(\"setjmp: jmpbuf is too small (%d bytes, need %d)\\n\",\n+\t\t size, sizeof(jmp_buf));\n+\t\treturn -ENOSPC;\n+\t}\n+\n+\treturn setjmp((struct __jmp_buf_tag *)jmp);\n+}\n+\n+void os_longjmp(ulong *jmp, int ret)\n+{\n+\tlongjmp((struct __jmp_buf_tag *)jmp, ret);\n+}\ndiff --git a/arch/sandbox/include/asm/setjmp.h b/arch/sandbox/include/asm/setjmp.h\nnew file mode 100644\nindex 0000000000..e25f50107c\n--- /dev/null\n+++ b/arch/sandbox/include/asm/setjmp.h\n@@ -0,0 +1,21 @@\n+/*\n+ * (C) Copyright 2016\n+ * Alexander Graf <agraf@suse.de>\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#ifndef _SETJMP_H_\n+#define _SETJMP_H_\t1\n+\n+struct jmp_buf_data {\n+\t/* We're not sure how long this should be */\n+\tulong data[32];\n+};\n+\n+typedef struct jmp_buf_data jmp_buf[1];\n+\n+int setjmp(jmp_buf jmp);\n+__noreturn void longjmp(jmp_buf jmp, int ret);\n+\n+#endif /* _SETJMP_H_ */\ndiff --git a/include/os.h b/include/os.h\nindex 2bf4bdb1b8..ad1836ac9f 100644\n--- a/include/os.h\n+++ b/include/os.h\n@@ -310,4 +310,25 @@ int os_spl_to_uboot(const char *fname);\n */\n void os_localtime(struct rtc_time *rt);\n \n+/**\n+ * os_setjmp() - Call setjmp()\n+ *\n+ * Call the host system's setjmp() function.\n+ *\n+ * @jmp: Buffer to store current execution state\n+ * @size: Size of buffer\n+ * @return normal setjmp() value if OK, -ENOSPC if @size is too small\n+ */\n+int os_setjmp(ulong *jmp, int size);\n+\n+/**\n+ * os_longjmp() - Call longjmp()\n+ *\n+ * Call the host system's longjmp() function.\n+ *\n+ * @jmp: Buffer where previous execution state was stored\n+ * @ret: Value to pass to longjmp()\n+ */\n+void os_longjmp(ulong *jmp, int ret);\n+\n #endif\n", "prefixes": [ "U-Boot", "08/16" ] }