Commit Graph

152 Commits

Author SHA1 Message Date
Travis Geiselbrecht
bff17f7e99 [platform][riscv] add code to read the size of memory from the FDT
Tweak the novm allocator to let us more easily add a variable sized
arena at boot.

Also added code to trap secondary cpus and reenable the use of WFI
instruction.
2019-11-02 18:13:02 -07:00
Travis Geiselbrecht
fdc08a8446 [arch][riscv] port to riscv64
Very little needed to port except to conditionalize some assembly in the
context switch and exception code. Mostly needed to move build system
stuff around and add a new project.
2019-11-02 17:21:13 -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
3aecdda231 [includes] replace header guards with #pragma once 2019-07-13 15:46:16 -07:00
Travis Geiselbrecht
85a50ea3f4 [kernel][license] try out using a smaller version of the license header
Replace the body of the MIT license with a reference to the LICENSE file
and a URL with the MIT license. Replaces 20 something lines with 3.

No functional change.
2019-06-19 23:28:14 -07:00
Travis Geiselbrecht
3699e45942 [include][lib] move most of the dangling top level include/lib/.h files into their lib
Only remaining one is console.h which is a little funny and will need to
be dealt with separately.
2019-06-19 22:44:15 -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
4f2d4841d8 [kernel][includes] move the kernel includes into the kernel directory
No functional change, just moved some include files.
2019-06-19 19:46:11 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
leliang.zhang
dfc1159abb [novm] fix the bug which cause memory leak in novm 2019-06-19 18:38:05 -07:00
Travis Geiselbrecht
f98cef7992 [warnings] fix warnings across the entire code base
Fix or squelch all warnings in all code covered by buildall.
2018-12-16 17:33:22 -08:00
Travis Geiselbrecht
8cf28bbdcf [arch][riscv] Initial port to a riscv32 sifive target
Currently targets qemu's sifive_e machine, which is a split flash/ram
machine, much like the Sifive HiFive1. Untested as of yet on a real
HiFive1.

Basic support including interrupts and architectural timers in place.
2018-12-16 16:44:23 -08:00
Alex Elzenaar
86717f4a3b Minor documentation comment change to timer implementation. 2018-01-22 23:35:32 -08:00
Will Drewry
cf3b7a15df kernel/port.c: make make_buf() safe
make_buf() is a static function with two callers who pass in one of
two constants. The parameters allowed for any uint count to be
supplied and the arithmetic during memory allocation was unchecked

This change updates make_buf() to reflect its usage, which is
safe, while eliminating any future uses from accidentally becoming
unsafe.
2017-12-22 13:52:43 -08:00
James Zhong
089dce3a7d [kernel][vm][pmm] Bug fix in pmm
Bug fix of PAGE_ADDRESS_FROM_ARENA in pmm of vm module

Signed-off-by: James Zhong <sha8312@gmail.com>
2017-04-21 17:14:45 -07:00
circl0
6782ea9af6 [kernel] fix get top thread error if NUM_PRIORITIES < 32 2016-09-30 10:39:58 -07:00
John Grossman
0c782aa381 [spelling] signalling --> signaling (#162)
Switch from the UK spelling of signalling (also, signalled and
signaller) to the American spelling.
2016-09-07 15:29:56 -07:00
Erik Gilling
c01adc6e0d [kernel] Add debug tracking of stack memory usage.
On thread creation, initializes the stack to a known value.  When
thread state is dumped, this value is uses to intuit max stack
usage.
2016-06-03 12:25:01 -07:00
Erik Corry
6d0122b98e [heap] Add API used by Dartino to get arena list 2016-03-23 21:22:39 +01:00
Travis Geiselbrecht
2a51111387 [kernel] add more controlled way to switch vmm address spaces 2016-02-23 21:07:22 -08:00
Gurjant Kalsi
42e76b1fc7 [ports] Add an API to dynamically add/remove ports from a port group. 2016-02-23 14:23:25 -08:00
Travis Geiselbrecht
14a4c60172 [kernel][vm] get rid of external declaration of address_to_page 2016-02-16 15:25:31 -08:00
Travis Geiselbrecht
9a5cd5c529 [kernel][vm] add support for multiple user address spaces
Generically add support for more than one user address space,
attach to a thread, and context switch as thread swaps happen.

Add support for ARM and ARM64, and stub out support for x86 platforms.
2016-02-16 15:24:25 -08:00
Travis Geiselbrecht
a4ca0a6e00 [vmm] move most users of arch_mmu_query directly to vaddr_to_paddr() 2016-02-14 12:45:53 -08: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
Gurjant Kalsi
52f4728c44 [magic][constants] Convert all of LK's multichar character kernel magic constants to hex. 2016-02-09 15:02:05 -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
ec69e5f881 [kernel] properly set the target debug led when inside non-idle thread context 2015-12-14 15:20:25 -08:00
Travis Geiselbrecht
4ab14424bd [cppcheck] clean up a few suggestions from cppcheck 2015-11-24 15:08:38 -08:00
Carlos Pizano
6cdc5cd1da [kernel][port] Fix memory leak on port_open() 2015-11-23 12:38:40 -08:00
Carlos Pizano
614eaf166a [kernel][ports] Add basic ports functionality
Missing mostly more tests, specifically group tests.

BUG=none
R=travisg@google.com

Review URL: https://codereview.chromium.org/1437453002 .
2015-11-20 14:43:27 -08:00
Travis Geiselbrecht
7c1b8a0b66 [kernel] add a #define to set to enable tracing 2015-11-06 15:51:29 -08:00
Travis Geiselbrecht
814ca4e8a5 [kernel] add code to check some overrun padding placed on the bottom of each threads' stack
-Should impact context switch performance a bit
-Only enabled at LK_DEBUGLEVEL > 1
2015-11-04 18:35:20 -08:00
Travis Geiselbrecht
2d1e01cdd4 [kernel] remove THREAD_CHECKS which was always just the equivalent of DEBUG_ASSERT 2015-11-04 18:35:20 -08:00
Travis Geiselbrecht
c8c923ecbf [kernel][novm] change the novm alloc routine to take a bitmap instead of arena index 2015-10-23 09:48:28 -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
8d49a21989 [kernel][novm] refactor the novm code to handle multiple installable arenas
Only initialize the first arena, and allow installing more from platform code
as more memory banks are brought up.
Move novm into a separate module.
2015-10-20 16:18:57 -07:00
Travis Geiselbrecht
35b2f85f6a [kernel][novm] fix bug in big block allocs, add some prettier debug
Patch courtesy Erik Corry
2015-10-19 12:49:35 -07:00
Travis Geiselbrecht
16b1b594f4 [kernel][vm] fix error handling in vmm_alloc in case it can't allocate enough physical memory 2015-10-16 16:09:08 -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
e9a6bd0ea1 WIP get the heap code pointing at the new page allocator 2015-10-15 16:52:02 -07:00
Travis Geiselbrecht
80bf0a48b4 [lib][heap] fix some formatting and a bug or two in the novm and page alloc stuff 2015-10-15 15:46:35 -07:00
Travis Geiselbrecht
3bbc7ac101 WIP patch from erik 2015-10-15 15:30:49 -07:00
Travis Geiselbrecht
1193213dfd WIP get dlmalloc working with a mmap() style allocator out of the heap wrapper 2015-10-14 19:56:24 -07:00
Travis Geiselbrecht
742876db0c [kernel][debug] add the threads and evlog commands to crash time shell 2015-10-14 14:13:26 -07:00
Gurjant Kalsi
dc079d7327 [console][uart][shell] Created a crash-time shell and a polling based UART driver to use on panic. 2015-10-12 16:38:51 -07:00
Travis Geiselbrecht
6df1116275 [kernel][vmm] fix logic bug in vmm_free_aspace() 2015-09-23 18:03:29 -07:00
Travis Geiselbrecht
294ded0d57 [kernel][vmm] add support for user address spaces
Still doesn't switch between them, but allows for a separate container
of regions to be created and destroyed.
2015-09-23 17:43:37 -07:00