authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2022-02-24 10:27:24+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-24 16:08:37-05:00
log52a2aa11e2768a5d7881377ddb7a053d81e4cff4
tree368cba96a4e355c96d800741c40782a7faa2464c
parente06cb31659ff5afd1e0b846fbaa852df2f5a0af4

std: work around current packed struct situation

As of 6249a24, align() is not allowed on packed struct fields and as such the align(4) was removed from the first field of EdidOverrideProtocolAttributes. The endgame here is packed struct backed by explicit integers, in this case a u32, but until that is implemented put the align(4) on the pointer to avoid breaking someone's UEFI code in a hard to debug way.

1 files changed, 9 insertions(+), 1 deletions(-)

lib/std/os/uefi/protocols/edid_override_protocol.zig+9-1
......@@ -8,7 +8,15 @@ pub const EdidOverrideProtocol = extern struct {
88 _get_edid: fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) callconv(.C) Status,
99
1010 /// Returns policy information and potentially a replacement EDID for the specified video output device.
11 pub fn getEdid(self: *const EdidOverrideProtocol, handle: Handle, attributes: *EdidOverrideProtocolAttributes, edid_size: *usize, edid: *?[*]u8) Status {
11 pub fn getEdid(
12 self: *const EdidOverrideProtocol,
13 handle: Handle,
14 /// The align(4) here should really be part of the EdidOverrideProtocolAttributes type.
15 /// TODO remove this workaround when packed(u32) structs are implemented.
16 attributes: *align(4) EdidOverrideProtocolAttributes,
17 edid_size: *usize,
18 edid: *?[*]u8,
19 ) Status {
1220 return self._get_edid(self, handle, @ptrCast(*u32, attributes), edid_size, edid);
1321 }
1422