source: mainline/kernel/arch/riscv64/src/riscv64.c@ a35b458

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since a35b458 was a35b458, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 8 years ago

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2016 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup riscv64
30 * @{
31 */
32/** @file
33 */
34
35#include <arch.h>
36#include <stddef.h>
37#include <arch/arch.h>
38#include <arch/interrupt.h>
39#include <arch/asm.h>
40#include <arch/drivers/ucb.h>
41
42#include <halt.h>
43#include <config.h>
44#include <errno.h>
45#include <context.h>
46#include <fpu_context.h>
47#include <interrupt.h>
48#include <syscall/copy.h>
49#include <ddi/irq.h>
50#include <proc/thread.h>
51#include <console/console.h>
52#include <mem.h>
53#include <str.h>
54
55char memcpy_from_uspace_failover_address;
56char memcpy_to_uspace_failover_address;
57
58static void riscv64_post_mm_init(void);
59
60arch_ops_t riscv64_ops = {
61 .post_mm_init = riscv64_post_mm_init
62};
63
64arch_ops_t *arch_ops = &riscv64_ops;
65
66void riscv64_pre_main(bootinfo_t *bootinfo)
67{
68 physmem_start = bootinfo->physmem_start;
69 htif_frame = bootinfo->htif_frame;
70 pt_frame = bootinfo->pt_frame;
71
72 htif_init(bootinfo->ucbinfo.tohost, bootinfo->ucbinfo.fromhost);
73
74 /* Copy tasks map. */
75 init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS,
76 CONFIG_INIT_TASKS);
77
78 for (size_t i = 0; i < init.cnt; i++) {
79 init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
80 init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
81 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
82 bootinfo->taskmap.tasks[i].name);
83 }
84
85 /* Copy physical memory map. */
86 memmap.total = bootinfo->memmap.total;
87 memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
88 for (size_t i = 0; i < memmap.cnt; i++) {
89 memmap.zones[i].start = bootinfo->memmap.zones[i].start;
90 memmap.zones[i].size = bootinfo->memmap.zones[i].size;
91 }
92}
93
94void riscv64_post_mm_init(void)
95{
96 outdev_t *htifout = htifout_init();
97 if (htifout)
98 stdout_wire(htifout);
99}
100
101void calibrate_delay_loop(void)
102{
103}
104
105/** Construct function pointer
106 *
107 * @param fptr function pointer structure
108 * @param addr function address
109 * @param caller calling function address
110 *
111 * @return address of the function pointer
112 *
113 */
114void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
115{
116 return addr;
117}
118
119void arch_reboot(void)
120{
121}
122
123void irq_initialize_arch(irq_t *irq)
124{
125 (void) irq;
126}
127
128void istate_decode(istate_t *istate)
129{
130 (void) istate;
131}
132
133void fpu_init(void)
134{
135}
136
137void fpu_context_save(fpu_context_t *ctx)
138{
139}
140
141void fpu_context_restore(fpu_context_t *ctx)
142{
143}
144
145errno_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
146{
147 return EOK;
148}
149
150errno_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
151{
152 return EOK;
153}
154
155/** @}
156 */
Note: See TracBrowser for help on using the repository browser.