From b3317239749d1907ec95e7aa2057d7ea29d3c638 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 28 Feb 2023 22:34:20 -0500 Subject: Avoid undefined behavior: load of misaligned address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this change we see the following UBSAN stack trace in Fuchsia: #0 0x000020c1f68c9959 in AcpiRsConvertAmlToResource(ACPI_RESOURCE*, AML_RESOURCE*, ACPI_RSCONVERT_INFO*) ../../third_party/acpica/source/components/resources/rsmisc.c:244 +0x2d0959 #1.2 0x000020e5d259f77f in ubsan_GetStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 +0x3d77f #1.1 0x000020e5d259f77f in MaybePrintStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 +0x3d77f #1 0x000020e5d259f77f in ~ScopedReport() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 +0x3d77f #2 0x000020e5d25a0385 in handleTypeMismatchImpl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 +0x3e385 #3 0x000020e5d259fead in compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 +0x3dead #4 0x000020c1f68c9959 in AcpiRsConvertAmlToResource(ACPI_RESOURCE*, AML_RESOURCE*, ACPI_RSCONVERT_INFO*) ../../third_party/acpica/source/components/resources/rsmisc.c:244 +0x2d0959 #5 0x000020c1f68c65a9 in AcpiRsConvertAmlToResources(UINT8*, UINT32, UINT32, UINT8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 +0x2cd5a9 #6 0x000020c1f68efda9 in AcpiUtWalkAmlResources(ACPI_WALK_STATE*, UINT8*, ACPI_SIZE, ACPI_WALK_AML_CALLBACK, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:234 +0x2f6da9 #7 0x000020c1f68c1806 in AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT*, ACPI_BUFFER*) ../../third_party/acpica/source/components/resources/rscreate.c:199 +0x2c8806 #8 0x000020c1f68ccef2 in AcpiRsGetMethodData(ACPI_HANDLE, const char*, ACPI_BUFFER*) ../../third_party/acpica/source/components/resources/rsutils.c:770 +0x2d3ef2 #9 0x000020c1f68cd26d in AcpiWalkResources(ACPI_HANDLE, char*, ACPI_WALK_RESOURCE_CALLBACK, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 +0x2d426d #10 0x000020c1f66e4d48 in acpi::AcpiImpl::WalkResources(acpi::AcpiImpl*, ACPI_HANDLE, const char*, acpi::Acpi::ResourcesCallable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 +0xebd48 #11 0x000020c1f66ea94d in acpi::DeviceBuilder::GatherResources(acpi::DeviceBuilder*, acpi::Acpi*, fidl::AnyArena&, acpi::Manager*, acpi::DeviceBuilder::GatherResourcesCallback) ../../src/devices/board/lib/acpi/device-builder.cc:52 +0xf194d #12 0x000020c1f6776af2 in acpi::Manager::ConfigureDiscoveredDevices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 +0x17daf2 #13 0x000020c1f669eb44 in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:102 +0xa5b44 #14 0x000020c1f66b06f7 in x86::X86::DoInit(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:65 +0xb76f7 #15.1 0x000020c1f66ba8ea in λ(x86::X86::DdkInit::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:82 +0xc18ea #15 0x000020c1f66ba8ea in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:81:19), false, false, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:181 +0xc18ea #16.2 0x000020c1f68ff86c in fit::internal::function_base<16UL, false, void()>::invoke(const fit::internal::function_base<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x30686c #16.1 0x000020c1f68ff86c in fit::function_impl<16UL, false, void()>::operator()(const fit::function_impl<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/function.h:300 +0x30686c #16 0x000020c1f68ff86c in async::internal::RetainedTask::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async/task.cc:25 +0x30686c #17.1 0x000022d99b37bd91 in λ(const driver_runtime::Dispatcher::PostTask::(anon class)*, std::__2::unique_ptr >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:715 +0x4bd91 #17 0x000022d99b37bd91 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:714:7), true, false, void, std::__2::unique_ptr>, int>::invoke(void*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 +0x4bd91 #18 0x000022d99b374bc9 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr>, int)>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr >, int)>*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x44bc9 #19 0x000022d99b3748dd in fit::callback_impl<24UL, true, void(std::__2::unique_ptr>, int)>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr >, int)>*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/function.h:451 +0x448dd #20 0x000022d99b3656a6 in driver_runtime::CallbackRequest::Call(driver_runtime::CallbackRequest*, std::__2::unique_ptr >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:67 +0x356a6 #21 0x000022d99b36c4c8 in driver_runtime::Dispatcher::DispatchCallback(driver_runtime::Dispatcher*, std::__2::unique_ptr >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1093 +0x3c4c8 #22 0x000022d99b36d2c1 in driver_runtime::Dispatcher::DispatchCallbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr >, fbl::RefPtr) ../../src/devices/bin/driver_runtime/dispatcher.cc:1169 +0x3d2c1 #23.1 0x000022d99b37881e in λ(std::__2::unique_ptr >, fbl::RefPtr, const driver_runtime::Dispatcher::CreateWithAdder::(anon class)*) ../../src/devices/bin/driver_runtime/dispatcher.cc:338 +0x4881e #23 0x000022d99b37881e in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:337:7), true, false, void, std::__2::unique_ptr>, fbl::RefPtr>::invoke(void*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 +0x4881e #24 0x000022d99b374e7e in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr>, fbl::RefPtr)>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr >, fbl::RefPtr)>*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x44e7e #25.1 0x000022d99b36e964 in fit::function_impl<8UL, true, void(std::__2::unique_ptr>, fbl::RefPtr)>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr >, fbl::RefPtr)>*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/function.h:300 +0x3e964 #25 0x000022d99b36e964 in driver_runtime::Dispatcher::EventWaiter::InvokeCallback(driver_runtime::Dispatcher::EventWaiter*, std::__2::unique_ptr >, fbl::RefPtr) ../../src/devices/bin/driver_runtime/dispatcher.h:299 +0x3e964 #26 0x000022d99b36e35d in driver_runtime::Dispatcher::EventWaiter::HandleEvent(std::__2::unique_ptr >, async_dispatcher_t*, async::WaitBase*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1259 +0x3e35d #27.1 0x000022d99b378c00 in AsyncLoopOwnedEventHandler::HandleEvent(AsyncLoopOwnedEventHandler*, zx_status_t, zx_packet_signal_t const*, async_dispatcher_t*, async::WaitBase*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 +0x48c00 #27 0x000022d99b378c00 in async::WaitMethod, &AsyncLoopOwnedEventHandler::HandleEvent>::CallHandler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../zircon/system/ulib/async/include/lib/async/cpp/wait.h:201 +0x48c00 #28.1 0x000022d99b39aead in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:415 +0x6aead #28 0x000022d99b39aead in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 +0x6aead #29 0x000022d99b39c78f in async_loop_run_thread(void*) ../../zircon/system/ulib/async-loop/loop.c:840 +0x6c78f #30 0x00004230f4a33edc in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:55 +0xd7edc #31 0x00004230f4b6496d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 +0x20896d and #0 0x00002357f60edb6d in AcpiRsConvertAmlToResource(ACPI_RESOURCE*, AML_RESOURCE*, ACPI_RSCONVERT_INFO*) ../../third_party/acpica/source/components/resources/rsmisc.c:257 +0x2d0b6d #1.2 0x0000212756f4777f in ubsan_GetStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 +0x3d77f #1.1 0x0000212756f4777f in MaybePrintStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 +0x3d77f #1 0x0000212756f4777f in ~ScopedReport() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 +0x3d77f #2 0x0000212756f48385 in handleTypeMismatchImpl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 +0x3e385 #3 0x0000212756f47ead in compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 +0x3dead #4 0x00002357f60edb6d in AcpiRsConvertAmlToResource(ACPI_RESOURCE*, AML_RESOURCE*, ACPI_RSCONVERT_INFO*) ../../third_party/acpica/source/components/resources/rsmisc.c:257 +0x2d0b6d #5 0x00002357f60ea5a9 in AcpiRsConvertAmlToResources(UINT8*, UINT32, UINT32, UINT8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 +0x2cd5a9 #6 0x00002357f6113d09 in AcpiUtWalkAmlResources(ACPI_WALK_STATE*, UINT8*, ACPI_SIZE, ACPI_WALK_AML_CALLBACK, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:234 +0x2f6d09 #7 0x00002357f60e5806 in AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT*, ACPI_BUFFER*) ../../third_party/acpica/source/components/resources/rscreate.c:199 +0x2c8806 #8 0x00002357f60f0e52 in AcpiRsGetMethodData(ACPI_HANDLE, const char*, ACPI_BUFFER*) ../../third_party/acpica/source/components/resources/rsutils.c:770 +0x2d3e52 #9 0x00002357f60f11cd in AcpiWalkResources(ACPI_HANDLE, char*, ACPI_WALK_RESOURCE_CALLBACK, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 +0x2d41cd #10 0x00002357f5f08d48 in acpi::AcpiImpl::WalkResources(acpi::AcpiImpl*, ACPI_HANDLE, const char*, acpi::Acpi::ResourcesCallable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 +0xebd48 #11 0x00002357f5f0e94d in acpi::DeviceBuilder::GatherResources(acpi::DeviceBuilder*, acpi::Acpi*, fidl::AnyArena&, acpi::Manager*, acpi::DeviceBuilder::GatherResourcesCallback) ../../src/devices/board/lib/acpi/device-builder.cc:52 +0xf194d #12 0x00002357f5f9aaf2 in acpi::Manager::ConfigureDiscoveredDevices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 +0x17daf2 #13 0x00002357f5ec2b44 in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:102 +0xa5b44 #14 0x00002357f5ed46f7 in x86::X86::DoInit(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:65 +0xb76f7 #15.1 0x00002357f5ede8ea in λ(x86::X86::DdkInit::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:82 +0xc18ea #15 0x00002357f5ede8ea in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:81:19), false, false, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:181 +0xc18ea #16.2 0x00002357f61237cc in fit::internal::function_base<16UL, false, void()>::invoke(const fit::internal::function_base<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x3067cc #16.1 0x00002357f61237cc in fit::function_impl<16UL, false, void()>::operator()(const fit::function_impl<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/function.h:300 +0x3067cc #16 0x00002357f61237cc in async::internal::RetainedTask::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async/task.cc:25 +0x3067cc #17.1 0x000023df096b1d91 in λ(const driver_runtime::Dispatcher::PostTask::(anon class)*, std::__2::unique_ptr >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:715 +0x4bd91 #17 0x000023df096b1d91 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:714:7), true, false, void, std::__2::unique_ptr>, int>::invoke(void*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 +0x4bd91 #18 0x000023df096aabc9 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr>, int)>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr >, int)>*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x44bc9 #19 0x000023df096aa8dd in fit::callback_impl<24UL, true, void(std::__2::unique_ptr>, int)>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr >, int)>*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/function.h:451 +0x448dd #20 0x000023df0969b6a6 in driver_runtime::CallbackRequest::Call(driver_runtime::CallbackRequest*, std::__2::unique_ptr >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:67 +0x356a6 #21 0x000023df096a24c8 in driver_runtime::Dispatcher::DispatchCallback(driver_runtime::Dispatcher*, std::__2::unique_ptr >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1093 +0x3c4c8 #22 0x000023df096a32c1 in driver_runtime::Dispatcher::DispatchCallbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr >, fbl::RefPtr) ../../src/devices/bin/driver_runtime/dispatcher.cc:1169 +0x3d2c1 #23.1 0x000023df096ae81e in λ(std::__2::unique_ptr >, fbl::RefPtr, const driver_runtime::Dispatcher::CreateWithAdder::(anon class)*) ../../src/devices/bin/driver_runtime/dispatcher.cc:338 +0x4881e #23 0x000023df096ae81e in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:337:7), true, false, void, std::__2::unique_ptr>, fbl::RefPtr>::invoke(void*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 +0x4881e #24 0x000023df096aae7e in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr>, fbl::RefPtr)>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr >, fbl::RefPtr)>*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x44e7e #25.1 0x000023df096a4964 in fit::function_impl<8UL, true, void(std::__2::unique_ptr>, fbl::RefPtr)>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr >, fbl::RefPtr)>*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/function.h:300 +0x3e964 #25 0x000023df096a4964 in driver_runtime::Dispatcher::EventWaiter::InvokeCallback(driver_runtime::Dispatcher::EventWaiter*, std::__2::unique_ptr >, fbl::RefPtr) ../../src/devices/bin/driver_runtime/dispatcher.h:299 +0x3e964 #26 0x000023df096a435d in driver_runtime::Dispatcher::EventWaiter::HandleEvent(std::__2::unique_ptr >, async_dispatcher_t*, async::WaitBase*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1259 +0x3e35d #27.1 0x000023df096aec00 in AsyncLoopOwnedEventHandler::HandleEvent(AsyncLoopOwnedEventHandler*, zx_status_t, zx_packet_signal_t const*, async_dispatcher_t*, async::WaitBase*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 +0x48c00 #27 0x000023df096aec00 in async::WaitMethod, &AsyncLoopOwnedEventHandler::HandleEvent>::CallHandler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../zircon/system/ulib/async/include/lib/async/cpp/wait.h:201 +0x48c00 #28.1 0x000023df096d0ead in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:415 +0x6aead #28 0x000023df096d0ead in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 +0x6aead #29 0x000023df096d278f in async_loop_run_thread(void*) ../../zircon/system/ulib/async-loop/loop.c:840 +0x6c78f #30 0x0000424c7690eedc in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:55 +0xd7edc #31 0x0000424c76a3f96d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 +0x20896d and #0 0x000020883e0b9c01 in AcpiRsConvertAmlToResource(ACPI_RESOURCE*, AML_RESOURCE*, ACPI_RSCONVERT_INFO*) ../../third_party/acpica/source/components/resources/rsmisc.c:334 +0x2d0c01 #1.2 0x000022cae2d8677f in ubsan_GetStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 +0x3d77f #1.1 0x000022cae2d8677f in MaybePrintStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 +0x3d77f #1 0x000022cae2d8677f in ~ScopedReport() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 +0x3d77f #2 0x000022cae2d87385 in handleTypeMismatchImpl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 +0x3e385 #3 0x000022cae2d86ead in compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 +0x3dead #4 0x000020883e0b9c01 in AcpiRsConvertAmlToResource(ACPI_RESOURCE*, AML_RESOURCE*, ACPI_RSCONVERT_INFO*) ../../third_party/acpica/source/components/resources/rsmisc.c:334 +0x2d0c01 #5 0x000020883e0b65a9 in AcpiRsConvertAmlToResources(UINT8*, UINT32, UINT32, UINT8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 +0x2cd5a9 #6 0x000020883e0dfd89 in AcpiUtWalkAmlResources(ACPI_WALK_STATE*, UINT8*, ACPI_SIZE, ACPI_WALK_AML_CALLBACK, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:234 +0x2f6d89 #7 0x000020883e0b1806 in AcpiRsCreateResourceList(ACPI_OPERAND_OBJECT*, ACPI_BUFFER*) ../../third_party/acpica/source/components/resources/rscreate.c:199 +0x2c8806 #8 0x000020883e0bced2 in AcpiRsGetMethodData(ACPI_HANDLE, const char*, ACPI_BUFFER*) ../../third_party/acpica/source/components/resources/rsutils.c:770 +0x2d3ed2 #9 0x000020883e0bd24d in AcpiWalkResources(ACPI_HANDLE, char*, ACPI_WALK_RESOURCE_CALLBACK, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 +0x2d424d #10 0x000020883ded4d48 in acpi::AcpiImpl::WalkResources(acpi::AcpiImpl*, ACPI_HANDLE, const char*, acpi::Acpi::ResourcesCallable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 +0xebd48 #11 0x000020883deda94d in acpi::DeviceBuilder::GatherResources(acpi::DeviceBuilder*, acpi::Acpi*, fidl::AnyArena&, acpi::Manager*, acpi::DeviceBuilder::GatherResourcesCallback) ../../src/devices/board/lib/acpi/device-builder.cc:52 +0xf194d #12 0x000020883df66af2 in acpi::Manager::ConfigureDiscoveredDevices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 +0x17daf2 #13 0x000020883de8eb44 in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:102 +0xa5b44 #14 0x000020883dea06f7 in x86::X86::DoInit(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:65 +0xb76f7 #15.1 0x000020883deaa8ea in λ(x86::X86::DdkInit::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:82 +0xc18ea #15 0x000020883deaa8ea in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:81:19), false, false, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:181 +0xc18ea #16.2 0x000020883e0ef84c in fit::internal::function_base<16UL, false, void()>::invoke(const fit::internal::function_base<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x30684c #16.1 0x000020883e0ef84c in fit::function_impl<16UL, false, void()>::operator()(const fit::function_impl<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/function.h:300 +0x30684c #16 0x000020883e0ef84c in async::internal::RetainedTask::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async/task.cc:25 +0x30684c #17.1 0x000021ae7c20cd91 in λ(const driver_runtime::Dispatcher::PostTask::(anon class)*, std::__2::unique_ptr >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:715 +0x4bd91 #17 0x000021ae7c20cd91 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:714:7), true, false, void, std::__2::unique_ptr>, int>::invoke(void*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 +0x4bd91 #18 0x000021ae7c205bc9 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr>, int)>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr >, int)>*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x44bc9 #19 0x000021ae7c2058dd in fit::callback_impl<24UL, true, void(std::__2::unique_ptr>, int)>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr >, int)>*, std::__2::unique_ptr >, int) ../../sdk/lib/fit/include/lib/fit/function.h:451 +0x448dd #20 0x000021ae7c1f66a6 in driver_runtime::CallbackRequest::Call(driver_runtime::CallbackRequest*, std::__2::unique_ptr >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:67 +0x356a6 #21 0x000021ae7c1fd4c8 in driver_runtime::Dispatcher::DispatchCallback(driver_runtime::Dispatcher*, std::__2::unique_ptr >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1093 +0x3c4c8 #22 0x000021ae7c1fe2c1 in driver_runtime::Dispatcher::DispatchCallbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr >, fbl::RefPtr) ../../src/devices/bin/driver_runtime/dispatcher.cc:1169 +0x3d2c1 #23.1 0x000021ae7c20981e in λ(std::__2::unique_ptr >, fbl::RefPtr, const driver_runtime::Dispatcher::CreateWithAdder::(anon class)*) ../../src/devices/bin/driver_runtime/dispatcher.cc:338 +0x4881e #23 0x000021ae7c20981e in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:337:7), true, false, void, std::__2::unique_ptr>, fbl::RefPtr>::invoke(void*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 +0x4881e #24 0x000021ae7c205e7e in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr>, fbl::RefPtr)>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr >, fbl::RefPtr)>*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 +0x44e7e #25.1 0x000021ae7c1ff964 in fit::function_impl<8UL, true, void(std::__2::unique_ptr>, fbl::RefPtr)>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr >, fbl::RefPtr)>*, std::__2::unique_ptr >, fbl::RefPtr) ../../sdk/lib/fit/include/lib/fit/function.h:300 +0x3e964 #25 0x000021ae7c1ff964 in driver_runtime::Dispatcher::EventWaiter::InvokeCallback(driver_runtime::Dispatcher::EventWaiter*, std::__2::unique_ptr >, fbl::RefPtr) ../../src/devices/bin/driver_runtime/dispatcher.h:299 +0x3e964 #26 0x000021ae7c1ff35d in driver_runtime::Dispatcher::EventWaiter::HandleEvent(std::__2::unique_ptr >, async_dispatcher_t*, async::WaitBase*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1259 +0x3e35d #27.1 0x000021ae7c209c00 in AsyncLoopOwnedEventHandler::HandleEvent(AsyncLoopOwnedEventHandler*, zx_status_t, zx_packet_signal_t const*, async_dispatcher_t*, async::WaitBase*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 +0x48c00 #27 0x000021ae7c209c00 in async::WaitMethod, &AsyncLoopOwnedEventHandler::HandleEvent>::CallHandler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../zircon/system/ulib/async/include/lib/async/cpp/wait.h:201 +0x48c00 #28.1 0x000021ae7c22bead in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:415 +0x6aead #28 0x000021ae7c22bead in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 +0x6aead #29 0x000021ae7c22d78f in async_loop_run_thread(void*) ../../zircon/system/ulib/async-loop/loop.c:840 +0x6c78f #30 0x000042b2518e3edc in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:55 +0xd7edc #31 0x000042b251a1496d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 +0x20896d --- source/components/resources/rsmisc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 52358421c..6d11442d9 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -349,7 +349,8 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_COUNT_SERIAL_VEN: - ItemCount = ACPI_GET16 (Source) - Info->Value; + ACPI_MOVE_16_TO_16(&Temp16, Source); + ItemCount = Temp16 - Info->Value; Resource->Length = Resource->Length + ItemCount; ACPI_SET16 (Destination, ItemCount); @@ -357,9 +358,10 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_COUNT_SERIAL_RES: + ACPI_MOVE_16_TO_16(&Temp16, Source); ItemCount = (AmlResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER)) - - ACPI_GET16 (Source) - Info->Value; + Temp16 - Info->Value; Resource->Length = Resource->Length + ItemCount; ACPI_SET16 (Destination, ItemCount); @@ -437,8 +439,9 @@ AcpiRsConvertAmlToResource ( /* Copy the ResourceSource string */ + ACPI_MOVE_16_TO_16 (&Temp16, Source); Source = ACPI_ADD_PTR ( - void, Aml, (ACPI_GET16 (Source) + Info->Value)); + void, Aml, (Temp16 + Info->Value)); AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); break; -- cgit v1.2.1