34 Commits

Author SHA1 Message Date
Travis Geiselbrecht
ad6ef65a5a [arch][ops.h] force all of the fast routines to be inline
Also make sure each arch_ops.h always includes arch/ops.h at the top, to
make sure the declaration always appears in front of the definition.
2025-10-01 20:56:07 -07:00
Travis Geiselbrecht
e739abc490 [kernel] tweak a few thread apis to to take a const pointer
A bit of reformatting on some ARM code while was touching it.
2025-10-01 20:56:06 -07:00
Lei Wen
145e9a0d27 [arch] fix link script not include global array init
Using wild match init_array* to include global array init ctor

Before:

 10 .ctors             00000040 ffff0000001e6b80 00000000401e6b80 DATA
 11 .dtors             00000000 ffff0000001e6bc0 00000000401e6bc0 DATA
 12 .got               00000060 ffff0000001e6bc0 00000000401e6bc0 DATA
 13 .init_array.1      00000470 ffff0000001e6c20 00000000401e6c20
 14 .fini_array.1      00000470 ffff0000001e7090 00000000401e7090
 15 .dummy_post_data   00000000 ffff0000001e7500 00000000401e7500 DATA
 16 .bss               00009460 ffff0000001e8000 00000000401e8000 BSS

After:

 10 .ctors             000004b0 ffff0000001e6b80 00000000401e6b80 DATA
 11 .dtors             00000470 ffff0000001e7030 00000000401e7030
 12 .got               00000060 ffff0000001e74a0 00000000401e74a0 DATA
 13 .dummy_post_data   00000000 ffff0000001e7500 00000000401e7500 DATA
 14 .bss               00009460 ffff0000001e8000 00000000401e8000 BSS

Signed-off-by: Lei Wen <leiwen@asrmicro.com>
2025-09-29 22:40:41 -07:00
Travis Geiselbrecht
cc9c3a053c [arch][mmu] clean up page size definitions in each arch's defines.h
No real functional change except how the smaller ARCH_DEFAULT_PAGE_SIZE
is now computed and set in defines.h instead of rules.mk for arch/arm to
be consistent with the other arch that has a large/small build (riscv).
2025-08-31 19:16:58 -07:00
Travis Geiselbrecht
86267ca23c [include][reg.h] define new mmio_read/write accessors
To work properly with some hypervisors on various architectures (ARM,
ARM64, x86), add global routines to allow access to MMIO registers via
architecturally defined accessors.

Add accessors for ARM, ARM64, and x86-32/64. Have the other arches
default to just using whatever the compiler emits.

Will need to generally move things off the legacy REG*() accessors
since they're really not safe going forward with what compilers emit.
2024-05-13 00:39:29 -07:00
Travis Geiselbrecht
339ff8995a [arch][barriers] add default memory barriers for all of the architectures
Most are pretty straightforward, but a few of the more esoteric
architectures just defaults are implemented.
2024-05-09 19:51:32 -07:00
Travis Geiselbrecht
479d989185 [make] default WITH_LINKER_GC to false at the place it is used
Also switch the test logic to the TOBOOL macro.
2022-04-18 01:15:45 -07:00
Travis Geiselbrecht
a6ddffd80b [arch][warnings] fix -Wmissing-declarations warnings 2021-10-21 23:08:38 -07:00
Travis Geiselbrecht
80967e78a6 [arch] tweak arch_cycle_count prototype to return a ulong
This lets some arches return a 64bit counter.

As a result of fixing this, removed -Wno-format switch in the test app
which caused the need to fix a lot of printfs.
2020-05-16 17:55:50 -07:00
Travis Geiselbrecht
d0f1944038 [arch] define the atomic routines in arch-neutral headers and use builtins
Generally move most arches over to using the builtin atomics except for
the few that still require a little bit of work.
2020-05-16 14:29:21 -07:00
Travis Geiselbrecht
c57b661c93 [kernel][thread] change the way get_current_thread is inlined
Previously, was relying on a regular definition with the arch_ops.h code
overriding it with a static inline. This has been annoying for some
years since it forces the declarations to be in order. Change it to
simple declare an inline wrapper around an arch_ routine that does
whatever it needs to do.
2020-05-16 14:29:21 -07:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Travis Geiselbrecht
5d43aa25eb [arch][rules] create ARCH_LDFLAGS and clean up all the arch rules files to consistently use ARCH_* vars 2018-11-30 22:00:45 -08:00
klemens
d0b90c2d68 [spelling] spelling-fixes. (not external/) 2016-08-25 17:30:34 -07:00
Travis Geiselbrecht
d569c090ea [vim] remove vim expandtab comments on most of the files 2016-02-14 12:32:07 -08:00
Travis Geiselbrecht
2eb32a4369 [style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle
to generally follow K&R style.

Biggest non whitespace change is pulling brackets down on function
declarations, which I'm pretty ambivalent about, but astyle insists
on taking a stance
2016-02-14 12:24:01 -08:00
Travis Geiselbrecht
9c69b36411 [arch][microblaze] fix the microblaze port
Apparently stumbled into some sort of linker bug with gc-sections enabled.
Disable for now, and clean up the linker script a little bit.
2015-11-07 02:48:05 -08:00
Travis Geiselbrecht
0e1ce411ba [make] add ability to set EXTRA_LINKER_SCRIPTS in modules
This allows for individual modules to extend the main linker script,
primarily to add their own sections to interate over.
Remove the main shared_* linker scripts.
2015-10-26 16:47:18 -07:00
Travis Geiselbrecht
35ebee0e40 [merge] branch 'heapswitch'
This picks up the major work of allowing multiple heap implementations
and enable dlmalloc as an alternate heap to the simple existing one
(now called 'miniheap').

Also added a novm page allocator for memory management on systems too small
or missing an mmu to have a vm. Not much more than a simple bitmap allocator
that the heap pulls from. Allows for other heaps and/or users of physical
memory to coexist and span multiple banks of memory.
2015-10-20 16:53:00 -07:00
Travis Geiselbrecht
e58d0759ec [arch][multiple] finally solve the linker-script-not-updated problem
If a make variable was modified in a way that would cause the linker
script to need to be regenerated on arches that use generated linker
scripts, make sure we get a fresh copy.

Reuse the same generate-then-replace logic that goes into config.h
files.
2015-10-19 19:43:31 -07:00
Travis Geiselbrecht
3b2d7a268b [make] remove the need for a module to manually add $(LOCAL_DIR)/include to the global include path
Pretty much every module in the system was already doing it, so do it
automatically.
2015-10-19 19:07:16 -07:00
Travis Geiselbrecht
7c09e82033 [make] make sure MEMBASE and MEMSIZE are always set exactly once 2015-10-15 17:22:16 -07:00
Travis Geiselbrecht
3d3998eb58 [lib][console] move the panic shell test into console.h and fix a few missing debug.h includes 2015-10-12 18:26:48 -07:00
Travis Geiselbrecht
56e5680943 [arch][microblaze] stub out cache routines to get it compiling again 2015-09-20 13:19:40 -07:00
Arve Hjønnevåg
2c9c5959e7 Merge branch 'master' of https://github.com/travisg/lk into smp
Change-Id: Iecb11d57b6f089234c0826932bdb229588939750
2015-05-18 16:49:37 -07:00
Travis Geiselbrecht
518a04eef3 [arch][microblaze] a bit of bugfixing and refactoring to get running on real hardware
Punched out a version of the microblaze on a ZYBO dev board, which required
a few tweaks an additions to run on real hardware.
Refactored the qemu and zybo microblaze target.
2015-04-19 01:34:18 -07:00
Travis Geiselbrecht
b5943c329d [arch][microblaze] get working after SMP changes 2015-03-10 16:43:55 -07:00
Travis Geiselbrecht
c061e2d21c [arch][microblaze] add full interrupt, timer, and interrupt driven uart support 2015-01-31 19:55:23 -08:00
Travis Geiselbrecht
4cd280c7fa [arch][microblaze] add atomic routines and tests to the build 2015-01-31 19:55:23 -08:00
Travis Geiselbrecht
6f4183bc9a [arch][microblaze] change linker script to support having a different LMA for the vector table
The qemu target has 128KB of ram at 0 and the rest at 0x90000000.
Split the binary so that the vector table lives at 0 and everything else in
the high address.
2015-01-31 19:55:23 -08:00
Travis Geiselbrecht
0816848c82 [arch][microblaze] first semi functional context switch implementation 2015-01-31 19:55:23 -08:00
Travis Geiselbrecht
436c5a885f [arch][microblaze] initial stab at getting a nulled out microblaze port compiling 2015-01-29 21:06:04 -08:00