From nobody Fri Feb 16 04:00:24 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TbdWD67Kvz59ZDR; Fri, 16 Feb 2024 04:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TbdWD48lxz4H6b; Fri, 16 Feb 2024 04:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708056024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TQ17omXinxVTKXbU9hVPgZxnG/4LAgiEaUt/mUWFqAU=; b=gVVY/tu6FfSCr9XBw4H/xiO+HP11XT/SmW+sx25Kldi2JEF+GEHtZQm/SMivgyLl+NxIi3 Fg312gyHj16oqFrGw+GjFMqiTPr1Wv8m2oqmkficllk5iW5mq30KmkIdWcBwhRYq65qfUF +VgS5A9fhfaREGuWqoLz56APm/9DEMXUwLyxuN7D7WdJjFDPr3GnP33nituO0jh/hPuxHz wE98cDzGH+fEWg9cGpfdK895g5SW6vEqoKj7TUzNEvOVi3WkGaTTTU7bmFQJH27b94L4OR URIY3nnQ1Q+QseVku2Gsp4GWMZexEbZ8I1AMJxRhYd3BF7P1FtfzHn9m8ZHTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708056024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TQ17omXinxVTKXbU9hVPgZxnG/4LAgiEaUt/mUWFqAU=; b=jSmL/algHCoV9bviQzUhSdXYXnWDeemLbJuR01GGLzrIatXQyEqswOW9ldmzWYisMN9nfz 1ejjqPIunHuOpLH9OPS/fV8MLqE1xNOJcWV8XxQcUeiGhF585NEt7rvlqm7iq2a4ZAcuS8 D+3k0fhZ2ALC/i/SxlAd5mQUzlh2mAejSOueNHYi2pP48waZXAoH14KNXPsrBI42LyDVdt QXuF+KyBbBRoRV7jocCdlO57DeRhToZUw4zOwUPWQHMwgQ3j2Z08h/GwUJq9ao06VIj3H1 OrQCAddZ+5Gz4NIracFZsZxBtbK5cAMBNPycHAATKgPUIFDPU4chKcAFQi1YzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708056024; a=rsa-sha256; cv=none; b=XhiKHnZ38QE3dSiu/QPFC/w5g4Wa5bfRaX/vfbzDNJK9yx49AEZg3yh9fe5M3Y8kG+J3TI /bdH0Yn52itfWF05bqj95cQlGEsreG6l+FRB3GbrOPf0z5j6QYd+3KlJ3kNdmW6jB9aW8t k6kQDC9lik/wv673Cuk/pomTXVJRdFRtUZqr3Nty8mUuk5X3Snlyetr8LD1KGFsAJ8Rfie /3PgBAp9Q2dBexbZTdLecHAES1o4wHT5oJF/9hFQDtjLKdYV8wjkCygMXF5CkBgCDdYUNl U+tJZCoWCpDuXhhlvAWAxdRz4MI5tMuFG0wDZHz4vCnLhY0o8aduKEuXqHkA5Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TbdWD3FLZz18Xd; Fri, 16 Feb 2024 04:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41G40OhA018906; Fri, 16 Feb 2024 04:00:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41G40OI7018903; Fri, 16 Feb 2024 04:00:24 GMT (envelope-from git) Date: Fri, 16 Feb 2024 04:00:24 GMT Message-Id: <202402160400.41G40OI7018903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9b16231032dd - main - loader: Create new gfx table List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b16231032ddb40be282d76ec0d82b3a0ec96d60 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9b16231032ddb40be282d76ec0d82b3a0ec96d60 commit 9b16231032ddb40be282d76ec0d82b3a0ec96d60 Author: Warner Losh AuthorDate: 2024-02-16 03:53:07 +0000 Commit: Warner Losh CommitDate: 2024-02-16 03:59:22 +0000 loader: Create new gfx table Create a new gfx global table. Put into it all the graphics bindings that we have in loader today. For now, have compatability binding for loader. Remove them from loader. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43902 --- stand/common/interp_lua.c | 27 +++++++++++++++++++++++++++ stand/liblua/lutils.c | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/stand/common/interp_lua.c b/stand/common/interp_lua.c index 3f758baebc2d..a347526b67c9 100644 --- a/stand/common/interp_lua.c +++ b/stand/common/interp_lua.c @@ -97,6 +97,31 @@ static const luaL_Reg loadedlibs[] = { {NULL, NULL} }; +static void +interp_init_md(lua_State *L) +{ + luaL_requiref(L, "gfx", luaopen_gfx, 1); + lua_pop(L, 1); /* Remove lib */ + + /* + * Add in the comparability references in the loader table. Doing it with + * a pseudo-embedded script is easier than the raw calls. + */ + if (luaL_dostring(L, + "loader.fb_bezier = gfx.fb_bezier\n" + "loader.fb_drawrect = gfx.fb_drawrect\n" + "loader.fb_line = gfx.fb_line\n" + "loader.fb_putimage = gfx.fb_putimage\n" + "loader.fb_setpixel = gfx.fb_setpixel\n" + "loader.term_drawrect = gfx.term_drawrect\n" + "loader.term_putimage = gfx.term_putimage") != 0) { + lua_pop(L, 1); + const char *errstr = lua_tostring(L, -1); + errstr = errstr == NULL ? "unknown" : errstr; + printf("Error adding compat loader bindings: %s.\n", errstr); + } +} + void interp_init(void) { @@ -123,6 +148,8 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } + interp_init_md(luap); + filename = getenv("loader_lua"); if (filename == NULL) filename = LOADER_LUA; diff --git a/stand/liblua/lutils.c b/stand/liblua/lutils.c index 20876f965f0c..0be9f5f28ac3 100644 --- a/stand/liblua/lutils.c +++ b/stand/liblua/lutils.c @@ -439,7 +439,6 @@ int luaopen_loader(lua_State *L) { luaL_newlib(L, loaderlib); - luaopen_gfx(L); /* Add loader.machine and loader.machine_arch properties */ lua_pushstring(L, MACHINE); lua_setfield(L, -2, "machine");