Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aarch32 vm install #115

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1561d48
ref(make): refactor variable definition order
josecm Dec 1, 2023
79f170a
feat(make): add cloc rule
josecm Dec 1, 2023
6fe7356
ref(riscv): remove unused opcode definition header
josecm Nov 30, 2023
2851057
ref(riscv): centralize check for sstc extension
josecm Nov 17, 2023
fb9278b
fix(plat/drivers): add missing uart_putc function prototype
joaopeixoto13 Jan 29, 2024
1ac931a
update: add @joaopeixoto13 to contributors
josecm Jan 30, 2024
d4dc630
fix(gicd): fix calculation of gic's number of irqs
xioliu Apr 24, 2024
1cda032
fix(core/vmm): fixe use of fences on VMM install
josecm Dec 10, 2023
35d7342
fix(smmuv2): fix smmu_cntxt_hw struct
Diogo21Costa Mar 25, 2024
bb177f7
feat(c11): Change Makefile to use the standard C11
miguelafsilva5 Jan 26, 2024
9264189
ref(asm): Change asm keyword to __asm__
miguelafsilva5 Jan 26, 2024
3fd95b0
ref(constants): Change binary constants to hexadecimal
miguelafsilva5 Jan 26, 2024
5f73673
fix: Remove spinlock init val from a define
miguelafsilva5 Jan 26, 2024
a2f1545
fix(macros): remove ; from macro uses
miguelafsilva5 Jan 26, 2024
618974f
fix: Move the align attribute from an empty declaration
miguelafsilva5 Jan 26, 2024
088cf50
ref: Move expression away from a return
miguelafsilva5 Jan 26, 2024
1e7ca71
fix: Remove __VA_OPT__ from logging macros
miguelafsilva5 Jan 26, 2024
d42552d
fix(pointer_arith): Cast void* pointer to uintptr_t
miguelafsilva5 Jan 26, 2024
51f4665
fix(empty-structs): Add dummy byte to empty structs
miguelafsilva5 Jan 29, 2024
57771b8
fix: Add a dummy argument to DEFINED macro
miguelafsilva5 Jan 29, 2024
6fac282
fix(zero-element-arrays): Remove arrays with 0 elements
miguelafsilva5 Feb 6, 2024
6935959
ref(csr): Adapt csr access to be done through functions
miguelafsilva5 Feb 7, 2024
2a7e9c1
fix: Change the vmlist attribute from array to pointer
miguelafsilva5 Mar 15, 2024
b837593
fix: Add an entry to vmlist parameter in null config
miguelafsilva5 Mar 25, 2024
a032f52
ref: remove unused empty declaration
miguelafsilva5 May 17, 2024
79a10af
update: add @miguelafsilva5 to contributors
josecm May 22, 2024
0a6af87
feat(wextra): Added the flag wextra to compiler options
miguelafsilva5 Feb 19, 2024
e966aa9
feat(unused_arguments): mark unused arguments
miguelafsilva5 Feb 21, 2024
b12e168
ref: Add missing field initializer
miguelafsilva5 Feb 21, 2024
4c47afc
ref: Change old style declarations
miguelafsilva5 Mar 19, 2024
9e381d0
ref: Remove unused functions
miguelafsilva5 Mar 21, 2024
0721d51
fix(signedness): Change variables signedness to match the operation
miguelafsilva5 Mar 25, 2024
fe825e3
ref: Remove always true condition
miguelafsilva5 Mar 25, 2024
dea07f2
feat: Add additional warning flags
miguelafsilva5 Mar 26, 2024
eb64e58
fix: Remove implicit type and sign casts
miguelafsilva5 Mar 27, 2024
5fc2678
fix: Add missing prototypes
miguelafsilva5 Apr 2, 2024
bd11359
ref: Add missing default cases to switchs
miguelafsilva5 Apr 2, 2024
73fe72c
fix: Add a const qualifier to a cast from a const argument
miguelafsilva5 Apr 3, 2024
1e5fb8a
ref: Remove unused vm extern declaration
miguelafsilva5 Apr 3, 2024
c306b0f
ref: Rename shadowing variables
miguelafsilva5 Apr 4, 2024
0b5df84
ref: Remove unused local macros
miguelafsilva5 Apr 4, 2024
8883953
ref: Remove unused static functions
miguelafsilva5 Apr 4, 2024
d2d208f
fix: Align an element inside a packed struct
miguelafsilva5 Apr 5, 2024
2603780
fix(aarch32): use lvl 1 as the shared level for vm install
josecm Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ Clay Chang <[email protected]>
Manuel Rodríguez <[email protected]>
Diogo Costa <[email protected]>
Daniel Oliveira <[email protected]>
joaopeixoto13 <[email protected]>
Miguel Silva <[email protected]>
95 changes: 59 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ non_build_targets+=ci clean
build_targets:=$(strip $(foreach target, $(targets), \
$(if $(findstring $(target),$(non_build_targets)),,$(target))))

#Plataform must be defined excpet for non-build-targets
# Check platform target and set platform, driver and arch dirs based on it
ifeq ($(PLATFORM),)
ifneq ($(build_targets),)
$(error Target platform argument (PLATFORM) not specified)
Expand All @@ -78,6 +78,23 @@ ifneq ($(MAKECMDGOALS), clean)
core_mem_prot_dir:=$(core_dir)/$(arch_mem_prot)
endif

# Check configuration exists and set configurtion sources based on it
config_dir:=$(CONFIG_REPO)
config_src:=$(wildcard $(config_dir)/$(CONFIG).c)
ifeq ($(config_src),)
config_dir:=$(CONFIG_REPO)/$(CONFIG)
config_src:=$(wildcard $(config_dir)/config.c)
endif

ifneq ($(build_targets),)
ifeq ($(CONFIG),)
$(error Configuration (CONFIG) not defined.)
endif
ifeq ($(config_src),)
$(error Cant find file for $(CONFIG) config!)
endif
endif


build_dir:=$(cur_dir)/build/$(PLATFORM)/$(CONFIG)
bin_dir:=$(cur_dir)/bin/$(PLATFORM)/$(CONFIG)
Expand All @@ -87,19 +104,6 @@ src_dirs+=$(cpu_arch_dir) $(lib_dir) $(core_dir) $(core_mem_prot_dir) \
$(platform_dir) $(addprefix $(drivers_dir)/, $(drivers))
inc_dirs:=$(addsuffix /inc, $(src_dirs))

# Setup list of objects for compilation
-include $(addsuffix /objects.mk, $(src_dirs))

objs-y:=
objs-y+=$(addprefix $(cpu_arch_dir)/, $(cpu-objs-y))
objs-y+=$(addprefix $(lib_dir)/, $(lib-objs-y))
objs-y+=$(addprefix $(core_dir)/, $(core-objs-y))
objs-y+=$(addprefix $(platform_dir)/, $(boards-objs-y))
objs-y+=$(addprefix $(drivers_dir)/, $(drivers-objs-y))

deps+=$(patsubst %.o,%.d,$(objs-y))
objs-y:=$(patsubst $(src_dir)%, $(build_dir)%, $(objs-y))

build_dirs:=$(patsubst $(src_dir)%, $(build_dir)%, $(src_dirs) $(inc_dirs))
directories+=$(build_dirs)

Expand All @@ -123,14 +127,6 @@ deps+=$(asm_defs_hdr).d
gens:=
gens+=$(asm_defs_hdr)


config_dir:=$(CONFIG_REPO)
config_src:=$(wildcard $(config_dir)/$(CONFIG).c)
ifeq ($(config_src),)
config_dir:=$(CONFIG_REPO)/$(CONFIG)
config_src:=$(wildcard $(config_dir)/config.c)
endif

config_build_dir:=$(build_dir)/config
platform_build_dir:=$(build_dir)/platform
scripts_build_dir:=$(build_dir)/scripts
Expand All @@ -151,15 +147,22 @@ platform_description:=$(platform_dir)/$(platform_description)
gens+=$(platform_defs) $(platform_def_generator)
inc_dirs+=$(platform_build_dir)

# Setup list of objects for compilation
-include $(addsuffix /objects.mk, $(src_dirs))

ifneq ($(build_targets),)
ifeq ($(CONFIG),)
$(error Configuration (CONFIG) not defined.)
endif
ifeq ($(config_src),)
$(error Cant find file for $(CONFIG) config!)
endif
endif
objs-y:=
objs-y+=$(addprefix $(cpu_arch_dir)/, $(cpu-objs-y))
objs-y+=$(addprefix $(lib_dir)/, $(lib-objs-y))
objs-y+=$(addprefix $(core_dir)/, $(core-objs-y))
objs-y+=$(addprefix $(platform_dir)/, $(boards-objs-y))
objs-y+=$(addprefix $(drivers_dir)/, $(drivers-objs-y))

c_src_files:=$(wildcard $(patsubst %.o,%.c, $(objs-y)))
asm_src_files:=$(wildcard $(patsubst %.o,%.S, $(objs-y)))
c_hdr_files=$(shell cat $(deps) | grep -o "$(src_dir)/\S*\.h" | sort | uniq)

deps+=$(patsubst %.o,%.d,$(objs-y))
objs-y:=$(patsubst $(src_dir)%, $(build_dir)%, $(objs-y))

config_obj:=$(config_src:$(config_dir)/%.c=$(config_build_dir)/%.o)
config_dep:=$(config_src:$(config_dir)/%.c=$(config_build_dir)/%.d)
Expand All @@ -186,8 +189,22 @@ ifeq ($(DEBUG), y)
OPTIMIZATIONS:=g
endif

override CFLAGS+=-O$(OPTIMIZATIONS) -Wall -Werror -ffreestanding -std=gnu11 \
-fno-pic $(arch-cflags) $(platform-cflags) $(CPPFLAGS) $(debug_flags)
cflags_warns:= \
-Warith-conversion -Wbuiltin-declaration-mismatch \
-Wcomments -Wdiscarded-qualifiers \
-Wimplicit-fallthrough \
-Wswitch-unreachable -Wreturn-local-addr \
-Wshift-count-negative -Wuninitialized \
-Wunused -Wunused-local-typedefs -Wunused-parameter \
-Wunused-result -Wvla \
-Wconversion -Wsign-conversion \
-Wmissing-prototypes -Wmissing-declarations \
-Wswitch-default -Wshadow -Wshadow=global \
-Wcast-qual -Wunused-macros

override CFLAGS+=-O$(OPTIMIZATIONS) -Wall -Werror -Wextra $(cflags_warns) \
-ffreestanding -std=c11 -pedantic -pedantic-errors -fno-pic \
$(arch-cflags) $(platform-cflags) $(CPPFLAGS) $(debug_flags)

override ASFLAGS+=$(CFLAGS) $(arch-asflags) $(platform-asflags)

Expand Down Expand Up @@ -294,6 +311,12 @@ $(directories):

endif

# Count lines of code for the exact target platform and configuration

.PHONY: cloc
cloc: | $(deps)
@cloc --by-file-by-lang $(c_src_files) $(asm_src_files) $(c_hdr_files)

#Clean all object, dependency and generated files

.PHONY: clean
Expand All @@ -310,12 +333,12 @@ all_files= $(realpath \
$(call list_dir_files_recursive, $(scripts_dir), *) \
$(call list_dir_files_recursive, $(config_dir)/example, *) \
)
c_src_files=$(realpath $(call list_dir_files_recursive, src, *.c))
c_hdr_files=$(realpath $(call list_dir_files_recursive, src, *.h))
c_files=$(c_src_files) $(c_hdr_files)
all_c_src_files=$(realpath $(call list_dir_files_recursive, src, *.c))
all_c_hdr_files=$(realpath $(call list_dir_files_recursive, src, *.h))
all_c_files=$(all_c_src_files) $(all_c_hdr_files)

$(call ci, license, "Apache-2.0", $(all_files))
$(call ci, format, $(c_files))
$(call ci, format, $(all_c_files))

.PHONY: ci
ci: license-check format-check
2 changes: 2 additions & 0 deletions configs/null/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ struct config config = {
*/
.vmlist_size = 1,

.vmlist = (struct vm_config[]){ {.entry = 0 } },

};
2 changes: 1 addition & 1 deletion src/arch/armv8/aarch32/aborts.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) Bao Project and Contributors. All rights reserved.
*/

#include <bao.h>
#include <arch/aborts.h>
#include <arch/sysregs.h>
#include <cpu.h>

Expand Down
2 changes: 0 additions & 2 deletions src/arch/armv8/aarch32/exceptions.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <asm_defs.h>
#include <arch/sysregs.h>

#define ENTRY_SIZE (0x4)

.text

.macro SAVE_HYP_GPRS
Expand Down
2 changes: 1 addition & 1 deletion src/arch/armv8/aarch32/inc/arch/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct {
uint32_t next;
} spinlock_t;

#define SPINLOCK_INITVAL ((spinlock_t){ 0, 0 })
static const spinlock_t SPINLOCK_INITVAL = { 0, 0 };

static inline void spinlock_init(spinlock_t* lock)
{
Expand Down
Loading
Loading