Commit Graph

41 Commits

Author SHA1 Message Date
Travis Geiselbrecht
30a334288f [lib][console] move the command block private stuff into lib/console
Pull some of the machinery of the lib/console stuff into a private
header that is only pulled in when lib/console is built.
2020-05-17 15:43:00 -07:00
Travis Geiselbrecht
f371fa246b [arch] move the atomic ops into a separate header
Now you need to include arch/atomic.h to get to the atomic routines.
This simplifies a recusion issue in the way arch/ops.h included
arch_ops. Also just generally makes things cleaner.
2020-05-16 15:05:34 -07:00
Travis Geiselbrecht
d3d22d68a5 [lib][console] switch the console commands to __start __stop style symbols 2020-05-15 00:03:14 -07:00
Travis Geiselbrecht
c6ee887e96 [init] switch the init hook system to __start __stop style symbols 2020-05-15 00:00:50 -07:00
Travis Geiselbrecht
95cf798c83 [console][panic] slight tweak to where the panic shell define is set
Tweak the default platform_halt to idle the core if fully wedged.
2020-05-10 20:03:31 -07:00
Travis Geiselbrecht
445283fd8c [lib][unittest] slight tidying of the unittest library
Added unittest lib to the test virtual project. Currently nothing uses
it.
2020-05-10 19:50:08 -07:00
Travis Geiselbrecht
7c9906a5ff [arch][riscv] Initial implementation of MMU for RISC-V
Implements both SV39 and SV48. No 32bit support yet.

Currently implements basic setup of paging in start.S by mapping a large
chunk of memory into both an identity map and to the bottom of the
kernel address space. Run the kernel out of this physical mapping.

Added basic arch mmu support for querying existing paging structures and
mapping 4K pages. No unmap support as of yet.

System boots with mmu on when running supervisor test on qemu. Untested
on real hardware as of yet.
2020-05-10 17:09:48 -07:00
Travis Geiselbrecht
83c2eb5b0e [debug][panic] remove the wrapper panic #define and read the caller inside panic itself
Was always this way for some reason, which would tend to print the
calling routine that called the routine that paniced, which was of
dubious use. Simplify the panic logic and just call it as a standard
varargs routine.
2020-04-30 01:00:45 -07:00
Travis Geiselbrecht
df32504748 [kernel] test run sorting some includes
No functional change.
2019-07-13 17:21:00 -07:00
Travis Geiselbrecht
6cb02526b7 [include][console] split lib/console.h into two
TL;DR most uses of lib/console.h -> lk/console_cmd.h

Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.

Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
2019-07-13 16:56:33 -07:00
Travis Geiselbrecht
35a8d555a3 [include] move almost all of the remainder of top level includes into a subdir
Examples are include/platform.h -> platform/include/platform.h
include/target.h -> target/include/target.h

The old model generally considered these to be Always There includes,
but they're starting to stick out more and more so may as well actually
follow the model that most of the rest of the system follows.
2019-07-13 16:09:27 -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
2937371c84 [include] move some high level lk includes into lk/ prefixed namespace
This moves a lot of simple headers out of the top level of the namespace
under lk/.

Will affect potentially a lot of downstream code, but the fixup is very
easy. Just prepend lk/ to the path of the few files that were moved
here.
2019-06-19 19:46:11 -07: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
Brian Swetland
1de5270d6e [kernel][smp] reduce impact of SMP code on UP builds
Hopefully to nothing...
- remove current/pinned cpu tracking in thread struct
- macroize access to current/pinned cpu tracking
- empty-inline/remove vestigial mp_* bits in UP builds
2016-01-17 18:46:51 -08:00
Travis Geiselbrecht
491e47fbc6 [linker] align special sections on native pointer bounary
This fixes a bug in x86-64 where it was trying to default align
input sections on 16 byte boundaries, which was screwing up the
padding between structures.
2015-11-06 12:00:04 -08:00
Travis Geiselbrecht
a79328fe97 [main] move the printf for heap after the pre-heap init hooks are run 2015-11-02 11:55:30 -08:00
Travis Geiselbrecht
114a350e55 [linker] align all the special sections on 8 byte boundaries, remove x86-64 hack
A bit overkill for 32bit machines, but aligning all the special data structures
on 8 byte boundaries removes any special case for 64bit machines.
2015-10-26 17:01:34 -07: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
e53bc45b5b [top] add missing license and reformat top/ module 2015-10-22 21:58:59 -07:00
Travis Geiselbrecht
7682dff72f [init] bump the earliest init trace level out to TARGET_EARLY
On STM32f7xx this is the earliest point that we can printf, and it
makes sense to be more conservative than before. This is probably
a pretty common spot to be able to finally printf.
2015-10-20 16:14:16 -07:00
Travis Geiselbrecht
fab92f3179 [lib][heap] have novm initialize itself, rename novm 'heap' to 'arena' to be less confusing 2015-10-15 18:15:45 -07:00
Travis Geiselbrecht
3bbc7ac101 WIP patch from erik 2015-10-15 15:30:49 -07:00
Will Lee
141e4ffaa5 [kernel] call static constructors after heap init
Avoids badness when a constructor needs to malloc() something, etc.
2015-07-07 15:56:45 -07:00
Travis Geiselbrecht
02b5def157 [init] don't print init trace messages earlier than a particular level
Really to work around an arch specific problem on a particular platform, but
potentially useful elsewhere.

Change-Id: Ifae6f11cc78be8623eb0746338e18383863a4827
2015-05-29 15:37:25 -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
f3e20b4e4c [init] print init routines at high debug levels 2015-05-02 22:48:57 -07:00
Travis Geiselbrecht
89e69bbd50 [top] change the welcome message if compiled with SMP enabled 2015-03-31 15:30:52 -07:00
Travis Geiselbrecht
f0fad1590b [init][smp] have secondary init run in arch code up to threading, and complete in secondary thread
-move the per-cpu initialization of the gic and cortex-a9 timer into an init hook.
  This removes the hard coded call in arm/arch.c
-make sure the timer initialization happens in the pre-threading callback, in case
  a secondary init hook needs the timer.
2015-03-27 14:14:12 -07:00
Arve Hjønnevåg
2ff3f126e2 [init] Make lk_init_level re-entrant
Change api to pass in a range of levels to call, instead of just the
last level.
Allows secondary init hooks to run in parallel on multiple cpus.

Change-Id: I7447547818a35d475631b3e7fa8315ff7f80ba4f
2015-03-18 20:43:13 -07:00
Arve Hjønnevåg
fd51c054b6 [kernel] Add secondary cpu init and entry point
Call lk_init_secondary_cpus on the main cpu to create bootstrap
threads for secondary cpus. Call lk_secondary_cpu_entry on secondary
cpus to boot them. It is not safe to call into the heap on secondary
cpus before getting to the bootstrap thread.

Change-Id: Id9ee72a96cdc894dc8089527bde8468f36a25eac
2015-03-11 19:57:17 -07:00
Arve Hjønnevåg
58dca3d216 [init] Print cpu that init hook runs on
Change-Id: I75e38a72034ad6ac9d1e7d9930e86b32db8c95ce
2015-03-11 19:57:17 -07:00
Arve Hjønnevåg
0688393516 [init] Add LK_INIT_HOOK_FLAGS
The new LK_INIT_HOOK_FLAGS macro can be used with a LK_INIT_FLAG_ALL_CPUS
flag to run an init hook on all cpus or with LK_INIT_FLAG_SECONDARY_CPUS
to run a hook on secondary cpus.

Change-Id: If866e287271de11082e61eeaf10be3a396e85950
Signed-off-by: Arve Hjønnevåg <arve@android.com>
2015-03-11 19:57:17 -07:00
Arve Hjønnevåg
794d304599 [kernel][thread] Allow pinning threads to a specific cpu
The existing runqueues are scanned on resched until a thread that is
not pinned to another cpu is found.

Per-pu runqueues can be added later to avoid this scan.

Change-Id: Idd7dbddb4b79ef38a0ccd0c42b53f8867020e6cd

Conflicts:
	kernel/thread.c
2015-03-10 17:49:32 -07:00
Travis Geiselbrecht
8fb2c54304 [kernel] remove critical_section, move everything to spinlocks 2015-03-10 16:43:54 -07:00
Travis Geiselbrecht
ee9d2927ad [arm] add ability to pass and generically read up to 4 boot args from whoever loaded lk
-Extend arch_chain_load() to pass 4 args
2014-11-21 15:50:18 -08:00
Dima Zavin
e8a9b4b7a4 [libc] move tracing out of debug into separate trace.h
Change-Id: I7476fc17b587a0ea2a42cbe3d49b72063e4c5dc8
Signed-off-by: Dima Zavin <dima@android.com>
2013-08-05 10:04:29 -07:00
Travis Geiselbrecht
a40b543556 [init] new init hook system
Allows code anywhere in the system to define an init hook which is
called at the run level specified.
Hooks are guaranteed to be called in order of init level. Within an init
level the order of the hooks is not guaranteed.
2013-08-03 15:35:16 -07:00
Travis Geiselbrecht
702d168927 [kernel] move the top level kmain() out of kernel/ into top/
The kernel shouldn't really own most of the bringup of all
the modules. Generally speaking the kernel can and should be treated
like any other module in the system.
2013-06-20 20:40:11 -07:00