Changeset ccc362a1 in mainline for kernel/arch/riscv64/src/riscv64.c


Ignore:
Timestamp:
2017-08-21T18:46:34Z (7 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c742f5e
Parents:
c16479e
Message:

riscv64: memory management routines, reflecting the latest Privileged Architecture specification (1.10)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/riscv64/src/riscv64.c

    rc16479e rccc362a1  
    4949#include <console/console.h>
    5050#include <mem.h>
     51#include <str.h>
    5152
    5253char memcpy_from_uspace_failover_address;
    5354char memcpy_to_uspace_failover_address;
    5455
     56static void riscv64_post_mm_init(void);
     57
    5558arch_ops_t riscv64_ops = {
     59        .post_mm_init = riscv64_post_mm_init
    5660};
    5761
    5862arch_ops_t *arch_ops = &riscv64_ops;
     63
     64void riscv64_pre_main(bootinfo_t *bootinfo)
     65{
     66        physmem_start = bootinfo->physmem_start;
     67        htif_frame = bootinfo->htif_frame;
     68        pt_frame = bootinfo->pt_frame;
     69       
     70        htif_init(bootinfo->ucbinfo.tohost, bootinfo->ucbinfo.fromhost);
     71       
     72        /* Copy tasks map. */
     73        init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS,
     74            CONFIG_INIT_TASKS);
     75       
     76        for (size_t i = 0; i < init.cnt; i++) {
     77                init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
     78                init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
     79                str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
     80                    bootinfo->taskmap.tasks[i].name);
     81        }
     82       
     83        /* Copy physical memory map. */
     84        memmap.total = bootinfo->memmap.total;
     85        memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
     86        for (size_t i = 0; i < memmap.cnt; i++) {
     87                memmap.zones[i].start = bootinfo->memmap.zones[i].start;
     88                memmap.zones[i].size = bootinfo->memmap.zones[i].size;
     89        }
     90}
     91
     92void riscv64_post_mm_init(void)
     93{
     94        outdev_t *htifout = htifout_init();
     95        if (htifout)
     96                stdout_wire(htifout);
     97}
    5998
    6099void calibrate_delay_loop(void)
     
    90129}
    91130
    92 int context_save_arch(context_t *ctx)
    93 {
    94         return 1;
    95 }
    96 
    97 void context_restore_arch(context_t *ctx)
    98 {
    99         while (true);
    100 }
    101 
    102131void fpu_init(void)
    103132{
     
    122151}
    123152
    124 void early_putchar(wchar_t ch)
    125 {
    126 }
    127 
    128153/** @}
    129154 */
Note: See TracChangeset for help on using the changeset viewer.