mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-16 12:16:59 +02:00
Add initjm[() to sandbox, a non-standard extension to setjmp()/ longjmp() allowing to initialize a jump buffer with a function pointer and a stack pointer. This will be useful to later introduce threads. With this new function it becomes possible to longjmp() to a particular function pointer (rather than to a point previously reached during program execution as is the case with setjmp()), and with a custom stack. Both things are needed to spin off a new thread. Then the usual setjmp()/longjmp() pair is enough to save and restore a context, i.e., switch thread. The implementation is taken verbatim from barebox [1] with the exception of the additional stack_sz argument. It is quite complex because contrary to U-Boot platform code we don't know how the system's C library implements the jump buffer, so we can't just write the function and stack pointers into it. [1] https://github.com/barebox/barebox/blob/b2a15c383ddc/arch/sandbox/os/setjmp.c Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
47 lines
1.7 KiB
Makefile
47 lines
1.7 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0+
|
|
#
|
|
# Copyright (c) 2011 The Chromium OS Authors.
|
|
#
|
|
# (C) Copyright 2000-2003
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
obj-y := cache.o cpu.o state.o initjmp.o
|
|
extra-y := start.o os.o
|
|
extra-$(CONFIG_SANDBOX_SDL) += sdl.o
|
|
obj-$(CONFIG_XPL_BUILD) += spl.o
|
|
obj-$(CONFIG_ETH_SANDBOX_RAW) += eth-raw-os.o
|
|
|
|
# os.c is build in the system environment, so needs standard includes
|
|
# CFLAGS_REMOVE_os.o cannot be used to drop header include path
|
|
quiet_cmd_cc_os.o = CC $(quiet_modtag) $@
|
|
cmd_cc_os.o = $(CC) $(filter-out -nostdinc, \
|
|
$(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
|
|
|
|
$(obj)/os.o: $(src)/os.c FORCE
|
|
$(call if_changed_dep,cc_os.o)
|
|
|
|
# eth-raw-os.c is built in the system env, so needs standard includes
|
|
# CFLAGS_REMOVE_eth-raw-os.o cannot be used to drop header include path
|
|
quiet_cmd_cc_eth-raw-os.o = CC $(quiet_modtag) $@
|
|
cmd_cc_eth-raw-os.o = $(CC) $(filter-out -nostdinc, \
|
|
$(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
|
|
|
|
$(obj)/eth-raw-os.o: $(src)/eth-raw-os.c FORCE
|
|
$(call if_changed_dep,cc_eth-raw-os.o)
|
|
|
|
# initjmp.c is build in the system environment, so needs standard includes
|
|
# CFLAGS_REMOVE_initjmp.o cannot be used to drop header include path
|
|
quiet_cmd_cc_initjmp.o = CC $(quiet_modtag) $@
|
|
cmd_cc_initjmp.o = $(CC) $(filter-out -nostdinc, \
|
|
$(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
|
|
|
|
$(obj)/initjmp.o: $(src)/initjmp.c FORCE
|
|
$(call if_changed_dep,cc_initjmp.o)
|
|
|
|
# sdl.c fails to build with -fshort-wchar using musl
|
|
cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
|
|
$(patsubst -I%,-idirafter%,$(c_flags))) -fno-lto -c -o $@ $<
|
|
|
|
$(obj)/sdl.o: $(src)/sdl.c FORCE
|
|
$(call if_changed_dep,cc_sdl.o)
|