forked from xuos/xiuos
Support rk3568.(TODO: fix userland)
This commit is contained in:
parent
872a2df6ff
commit
148b422006
|
@ -79,15 +79,6 @@ __attribute__((always_inline)) static inline uint64_t EL0_mode() // Set ARM mode
|
||||||
{
|
{
|
||||||
uint64_t val = 0;
|
uint64_t val = 0;
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"mrs %0, spsr_el1"
|
|
||||||
: "=r"(val)
|
|
||||||
:
|
|
||||||
:);
|
|
||||||
val &= ~DIS_INT;
|
|
||||||
val &= ~SPSR_MODE_MASK;
|
|
||||||
val |= ARM_MODE_EL0_t;
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@ _boot_start:
|
||||||
mov x5, x2
|
mov x5, x2
|
||||||
mul x3, x2, x1
|
mul x3, x2, x1
|
||||||
sub x0, x0, x3
|
sub x0, x0, x3
|
||||||
|
mov sp, x0
|
||||||
|
|
||||||
mov x2, #ARM_MODE_EL1_h | DIS_INT
|
mov x2, #ARM_MODE_EL1_h | DIS_INT
|
||||||
msr spsr_el1, x2
|
msr spsr_el1, x2
|
||||||
mov sp, x0
|
|
||||||
|
|
||||||
// bl el2_setup
|
// bl el2_setup
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ el2_setup:
|
||||||
|
|
||||||
mrs x0, sctlr_el1
|
mrs x0, sctlr_el1
|
||||||
orr x0, x0, #(1 << 0)
|
orr x0, x0, #(1 << 0)
|
||||||
|
bic x0, x0, #(1 << 1)
|
||||||
orr x0, x0, #(1 << 2)
|
orr x0, x0, #(1 << 2)
|
||||||
msr sctlr_el1, x0
|
msr sctlr_el1, x0
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export CROSS_COMPILE ?= aarch64-none-elf-
|
export CROSS_COMPILE ?= aarch64-none-elf-
|
||||||
export DEVICE = -mtune=cortex-a55 -ffreestanding -fno-common -fno-stack-protector -fno-pie -no-pie
|
export DEVICE = -mtune=cortex-a55 -ffreestanding -fno-common -fno-stack-protector -fno-pie -no-pie
|
||||||
export CFLAGS := $(DEVICE) -Wall -Werror -O0 -g -fno-omit-frame-pointer -fPIC
|
export CFLAGS := $(DEVICE) -Wall -Werror -O0 -g -fno-omit-frame-pointer -fPIC
|
||||||
# export AFLAGS := -c $(DEVICE) -x assembler-with-cpp -D__ASSEMBLY__ -gdwarf-2
|
# export AFLAGS := -c $(DEVICE) -x assembler-with-cpp -D__ASSEMBLY__ -gdwarf-2
|
||||||
export LFLAGS := $(DEVICE) -Wl,-T -Wl,$(KERNEL_ROOT)/hardkernel/arch/arm/armv8-a/cortex-a72/preboot_for_ok1028a-c/nxp_ls1028.lds -Wl,--start-group,-lgcc,-lc,--end-group
|
export LFLAGS := $(DEVICE) -Wl,-T -Wl,$(KERNEL_ROOT)/hardkernel/arch/arm/armv8-a/cortex-a72/preboot_for_ok1028a-c/nxp_ls1028.lds -Wl,--start-group,-lgcc,-lc,--end-group
|
||||||
export CXXFLAGS :=
|
export CXXFLAGS :=
|
||||||
|
|
|
@ -114,14 +114,14 @@ SECTIONS
|
||||||
} > vir_ddr3
|
} > vir_ddr3
|
||||||
|
|
||||||
. = ALIGN(0x1000);
|
. = ALIGN(0x1000);
|
||||||
PROVIDE(kernel_data_begin = .);
|
|
||||||
|
|
||||||
_image_size = . - 0x0000006010000000;
|
_image_size = . - 0x0000006010000000;
|
||||||
|
|
||||||
.bss : {
|
.bss : {
|
||||||
|
PROVIDE(kernel_data_begin = .);
|
||||||
PROVIDE(__bss_start__ = .);
|
PROVIDE(__bss_start__ = .);
|
||||||
*(.bss .bss.* COMMON)
|
*(.bss .bss.* COMMON)
|
||||||
|
. = ALIGN(0x1000);
|
||||||
PROVIDE(__bss_end__ = .);
|
PROVIDE(__bss_end__ = .);
|
||||||
|
PROVIDE(kernel_data_end = .);
|
||||||
} > vir_ddr3
|
} > vir_ddr3
|
||||||
. = ALIGN(0x1000);
|
|
||||||
PROVIDE(kernel_data_end = .);
|
|
||||||
}
|
}
|
|
@ -22,27 +22,27 @@
|
||||||
|
|
||||||
static void enable_timer()
|
static void enable_timer()
|
||||||
{
|
{
|
||||||
uint32_t c = r_cntv_ctl_el0();
|
uint32_t c = r_cntp_ctl_el0();
|
||||||
c |= CNTV_CTL_ENABLE;
|
c |= CNTV_CTL_ENABLE;
|
||||||
c &= ~CNTV_CTL_IMASK;
|
c &= ~CNTV_CTL_IMASK;
|
||||||
w_cntv_ctl_el0(c);
|
w_cntp_ctl_el0(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disable_timer()
|
static void disable_timer()
|
||||||
{
|
{
|
||||||
uint32_t c = r_cntv_ctl_el0();
|
uint32_t c = r_cntp_ctl_el0();
|
||||||
c |= CNTV_CTL_IMASK;
|
c |= CNTV_CTL_IMASK;
|
||||||
c &= ~CNTV_CTL_ENABLE;
|
c &= ~CNTV_CTL_ENABLE;
|
||||||
w_cntv_ctl_el0(c);
|
w_cntp_ctl_el0(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reload_timer()
|
static void reload_timer()
|
||||||
{
|
{
|
||||||
// interval 100ms
|
// interval 1ms
|
||||||
static uint32_t ms = 10;
|
static uint32_t ms = 1;
|
||||||
uint32_t interval = ms * 1000;
|
uint32_t interval = ms * 1000;
|
||||||
uint32_t interval_clk = interval * (r_cntfrq_el0() / 1000000);
|
uint32_t interval_clk = interval * (r_cntfrq_el0() / 1000000);
|
||||||
w_cntv_tval_el0(interval_clk);
|
w_cntp_tval_el0(interval_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sys_clock_init()
|
void _sys_clock_init()
|
||||||
|
@ -54,7 +54,7 @@ void _sys_clock_init()
|
||||||
|
|
||||||
static uint32_t _get_clock_int()
|
static uint32_t _get_clock_int()
|
||||||
{
|
{
|
||||||
return 27;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t _get_tick()
|
static uint64_t _get_tick()
|
||||||
|
|
|
@ -15,28 +15,28 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// armv8 generic timer
|
// armv8 generic timer
|
||||||
static inline uint32_t r_cntv_ctl_el0()
|
static inline uint32_t r_cntp_ctl_el0()
|
||||||
{
|
{
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
__asm__ volatile("mrs %0, cntv_ctl_el0" : "=r"(x));
|
__asm__ volatile("mrs %0, cntp_ctl_el0" : "=r"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void w_cntv_ctl_el0(uint32_t x)
|
static inline void w_cntp_ctl_el0(uint32_t x)
|
||||||
{
|
{
|
||||||
__asm__ volatile("msr cntv_ctl_el0, %0" : : "r"(x));
|
__asm__ volatile("msr cntp_ctl_el0, %0" : : "r"(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t r_cntv_tval_el0()
|
static inline uint32_t r_cntp_tval_el0()
|
||||||
{
|
{
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
__asm__ volatile("mrs %0, cntv_tval_el0" : "=r"(x));
|
__asm__ volatile("mrs %0, cntp_tval_el0" : "=r"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void w_cntv_tval_el0(uint32_t x)
|
static inline void w_cntp_tval_el0(uint32_t x)
|
||||||
{
|
{
|
||||||
__asm__ volatile("msr cntv_tval_el0, %0" : : "r"(x));
|
__asm__ volatile("msr cntp_tval_el0, %0" : : "r"(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t r_cntvct_el0()
|
static inline uint64_t r_cntvct_el0()
|
||||||
|
|
|
@ -39,12 +39,14 @@ Modification:
|
||||||
2. Modify iabort and dabort handler(in dabort_handler() and iabort_handler())
|
2. Modify iabort and dabort handler(in dabort_handler() and iabort_handler())
|
||||||
*************************************************/
|
*************************************************/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "exception_registers.h"
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "multicores.h"
|
#include "multicores.h"
|
||||||
#include "spinlock.h"
|
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "trap_common.h"
|
#include "trap_common.h"
|
||||||
|
|
||||||
|
@ -91,6 +93,7 @@ void dabort_reason(struct trapframe* r)
|
||||||
uint32_t fault_status, fault_address;
|
uint32_t fault_status, fault_address;
|
||||||
__asm__ __volatile__("mrs %0, esr_el1" : "=r"(fault_status));
|
__asm__ __volatile__("mrs %0, esr_el1" : "=r"(fault_status));
|
||||||
__asm__ __volatile__("mrs %0, far_el1" : "=r"(fault_address));
|
__asm__ __volatile__("mrs %0, far_el1" : "=r"(fault_address));
|
||||||
|
w_esr_el1(0);
|
||||||
LOG("program counter: 0x%016lx caused\n", r->pc);
|
LOG("program counter: 0x%016lx caused\n", r->pc);
|
||||||
LOG("data abort at 0x%016lx, status 0x%016lx\n", fault_address, fault_status);
|
LOG("data abort at 0x%016lx, status 0x%016lx\n", fault_address, fault_status);
|
||||||
if ((fault_status & 0x3f) == 0x21) // Alignment failure
|
if ((fault_status & 0x3f) == 0x21) // Alignment failure
|
||||||
|
@ -133,6 +136,7 @@ void iabort_reason(struct trapframe* r)
|
||||||
__asm__ __volatile__("mrs %0, far_el1" : "=r"(fault_address));
|
__asm__ __volatile__("mrs %0, far_el1" : "=r"(fault_address));
|
||||||
LOG("program counter: 0x%016lx caused\n", r->pc);
|
LOG("program counter: 0x%016lx caused\n", r->pc);
|
||||||
LOG("data abort at 0x%016lx, status 0x%016lx\n", fault_address, fault_status);
|
LOG("data abort at 0x%016lx, status 0x%016lx\n", fault_address, fault_status);
|
||||||
|
w_esr_el1(0);
|
||||||
if ((fault_status & 0x3f) == 0x21) // Alignment failure
|
if ((fault_status & 0x3f) == 0x21) // Alignment failure
|
||||||
KPrintf("reason: alignment\n");
|
KPrintf("reason: alignment\n");
|
||||||
else if ((fault_status & 0x3f) == 0x4) // Translation fault, level 0
|
else if ((fault_status & 0x3f) == 0x4) // Translation fault, level 0
|
||||||
|
|
|
@ -28,13 +28,16 @@ Modification:
|
||||||
*************************************************/
|
*************************************************/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "exception_registers.h"
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "exception_registers.h"
|
|
||||||
#include "multicores.h"
|
#include "multicores.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
|
#include "mmu.h"
|
||||||
|
|
||||||
extern void dabort_handler(struct trapframe* r);
|
extern void dabort_handler(struct trapframe* r);
|
||||||
extern void iabort_handler(struct trapframe* r);
|
extern void iabort_handler(struct trapframe* r);
|
||||||
|
|
||||||
|
@ -73,7 +76,6 @@ void syscall_arch_handler(struct trapframe* tf)
|
||||||
|
|
||||||
uint64_t esr = r_esr_el1();
|
uint64_t esr = r_esr_el1();
|
||||||
uint64_t ec = (esr >> 0x1A) & 0x3F;
|
uint64_t ec = (esr >> 0x1A) & 0x3F;
|
||||||
w_esr_el1(0);
|
|
||||||
switch (ec) {
|
switch (ec) {
|
||||||
case 0B010101:
|
case 0B010101:
|
||||||
software_irq_dispatch(tf);
|
software_irq_dispatch(tf);
|
||||||
|
@ -87,11 +89,30 @@ void syscall_arch_handler(struct trapframe* tf)
|
||||||
iabort_handler(tf);
|
iabort_handler(tf);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
ERROR("USYSCALL: unexpected ec: %016lx\n", esr);
|
ERROR("USYSCALL: unexpected\n");
|
||||||
|
ERROR(" esr: %016lx\n", esr);
|
||||||
ERROR(" elr = %016lx far = %016lx\n", r_elr_el1(), r_far_el1());
|
ERROR(" elr = %016lx far = %016lx\n", r_elr_el1(), r_far_el1());
|
||||||
|
w_esr_el1(0);
|
||||||
|
extern void dump_tf(struct trapframe * tf);
|
||||||
|
dump_tf(tf);
|
||||||
|
|
||||||
|
uint32_t sctlr = 0;
|
||||||
|
SCTLR_R(sctlr);
|
||||||
|
DEBUG("SCTLR: %x\n", sctlr);
|
||||||
|
uint32_t spsr = 0;
|
||||||
|
__asm__ volatile("mrs %0, spsr_el1" : "=r"(spsr)::"memory");
|
||||||
|
DEBUG("SPSR: %x\n", spsr);
|
||||||
|
uint64_t tcr = 0;
|
||||||
|
__asm__ volatile("mrs %0, tcr_el1" : "=r"(tcr)::"memory");
|
||||||
|
DEBUG("TCR: %x\n", tcr);
|
||||||
|
uint64_t mair = 0;
|
||||||
|
__asm__ volatile("mrs %0, mair_el1" : "=r"(mair)::"memory");
|
||||||
|
DEBUG("MAIR: %x\n", mair);
|
||||||
|
|
||||||
// kill error task
|
// kill error task
|
||||||
xizi_enter_kernel();
|
xizi_enter_kernel();
|
||||||
assert(cur_cpu()->task != NULL);
|
assert(cur_cpu()->task != NULL);
|
||||||
|
ERROR("Error Task: %s\n", cur_cpu()->task->name);
|
||||||
sys_exit(cur_cpu()->task);
|
sys_exit(cur_cpu()->task);
|
||||||
context_switch(&cur_cpu()->task->thread_context.context, cur_cpu()->scheduler);
|
context_switch(&cur_cpu()->task->thread_context.context, cur_cpu()->scheduler);
|
||||||
panic("dabort end should never be reashed.\n");
|
panic("dabort end should never be reashed.\n");
|
||||||
|
|
|
@ -143,13 +143,13 @@ Modification:
|
||||||
.balign 0x800
|
.balign 0x800
|
||||||
alltraps:
|
alltraps:
|
||||||
// Current EL with sp0
|
// Current EL with sp0
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
|
|
||||||
// Current EL with spx
|
// Current EL with spx
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
|
@ -157,9 +157,9 @@ alltraps:
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b el1irq
|
b el1irq
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
|
|
||||||
// Lower EL using aarch64
|
// Lower EL using aarch64
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
|
@ -167,19 +167,27 @@ alltraps:
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b el0irq
|
b el0irq
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
|
|
||||||
// Lower EL using aarch32
|
// Lower EL using aarch32
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
b .
|
b badtrap
|
||||||
|
|
||||||
|
badtrap:
|
||||||
|
msr daifset, #0xf
|
||||||
|
savereg
|
||||||
|
|
||||||
|
mov x0, sp
|
||||||
|
bl kernel_intr_handler
|
||||||
|
b .
|
||||||
|
|
||||||
el1sync:
|
el1sync:
|
||||||
msr daifset, #0xf
|
msr daifset, #0xf
|
||||||
|
|
|
@ -33,8 +33,6 @@ Modification:
|
||||||
#include "pagetable.h"
|
#include "pagetable.h"
|
||||||
#include "registers.h"
|
#include "registers.h"
|
||||||
|
|
||||||
#include "ns16550.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -69,15 +67,6 @@ uint64_t boot_kern_l3pgdir[NUM_LEVEL3_PDE] __attribute__((aligned(0x1000))) = {
|
||||||
uint64_t boot_dev_l4pgdirs[NUM_LEVEL3_PDE][NUM_LEVEL4_PTE] __attribute__((aligned(0x1000))) = { 0 };
|
uint64_t boot_dev_l4pgdirs[NUM_LEVEL3_PDE][NUM_LEVEL4_PTE] __attribute__((aligned(0x1000))) = { 0 };
|
||||||
uint64_t boot_kern_l4pgdirs[NUM_LEVEL3_PDE][NUM_LEVEL4_PTE] __attribute__((aligned(0x1000))) = { 0 };
|
uint64_t boot_kern_l4pgdirs[NUM_LEVEL3_PDE][NUM_LEVEL4_PTE] __attribute__((aligned(0x1000))) = { 0 };
|
||||||
|
|
||||||
static inline int cpu_id()
|
|
||||||
{
|
|
||||||
int x = -1;
|
|
||||||
__asm__ volatile("mrs %0, mpidr_el1" : "=r"(x));
|
|
||||||
return x & 0x3;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int debug_printf_(const char* format, ...);
|
|
||||||
|
|
||||||
static void build_boot_pgdir()
|
static void build_boot_pgdir()
|
||||||
{
|
{
|
||||||
static bool built = false;
|
static bool built = false;
|
||||||
|
@ -86,9 +75,7 @@ static void build_boot_pgdir()
|
||||||
|
|
||||||
// dev mem
|
// dev mem
|
||||||
boot_l2pgdir[(dev_phy_mem_base >> LEVEL2_PDE_SHIFT) & IDX_MASK] = (uint64_t)boot_dev_l3pgdir | L2_TYPE_TAB | L2_PTE_VALID;
|
boot_l2pgdir[(dev_phy_mem_base >> LEVEL2_PDE_SHIFT) & IDX_MASK] = (uint64_t)boot_dev_l3pgdir | L2_TYPE_TAB | L2_PTE_VALID;
|
||||||
// boot_l2pgdir[(dev_phy_mem_base >> LEVEL2_PDE_SHIFT) & IDX_MASK] = (uint64_t)0xEFFF1000ULL | L2_TYPE_TAB | L2_PTE_VALID;
|
|
||||||
boot_l2pgdir[(MMIO_P2V_WO(dev_phy_mem_base) >> LEVEL2_PDE_SHIFT) & IDX_MASK] = (uint64_t)boot_dev_l3pgdir | L2_TYPE_TAB | L2_PTE_VALID;
|
boot_l2pgdir[(MMIO_P2V_WO(dev_phy_mem_base) >> LEVEL2_PDE_SHIFT) & IDX_MASK] = (uint64_t)boot_dev_l3pgdir | L2_TYPE_TAB | L2_PTE_VALID;
|
||||||
// boot_l2pgdir[(MMIO_P2V_WO(dev_phy_mem_base) >> LEVEL2_PDE_SHIFT) & IDX_MASK] = (uint64_t)0xEFFF1000ULL | L2_TYPE_TAB | L2_PTE_VALID;
|
|
||||||
|
|
||||||
uint64_t cur_mem_paddr = ALIGNDOWN((uint64_t)DEV_PHYMEM_BASE, LEVEL2_PDE_SIZE);
|
uint64_t cur_mem_paddr = ALIGNDOWN((uint64_t)DEV_PHYMEM_BASE, LEVEL2_PDE_SIZE);
|
||||||
for (size_t i = 0; i < NUM_LEVEL3_PDE; i++) {
|
for (size_t i = 0; i < NUM_LEVEL3_PDE; i++) {
|
||||||
|
@ -134,28 +121,22 @@ static void build_boot_pgdir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void el2_setup(void);
|
#include "log.h"
|
||||||
|
|
||||||
static void load_boot_pgdir()
|
static void load_boot_pgdir()
|
||||||
{
|
{
|
||||||
|
|
||||||
// debug_printf_("Loading TTBR0 %x.\r\n", boot_l2pgdir);
|
|
||||||
TTBR0_W((uintptr_t)boot_l2pgdir);
|
TTBR0_W((uintptr_t)boot_l2pgdir);
|
||||||
// TTBR0_W((uintptr_t)0xEFFF0000);
|
TTBR1_W(0);
|
||||||
// TTBR1_W(0);
|
|
||||||
|
|
||||||
#define TCR_TRUE_VALUE (0x0000000080813519ULL)
|
#define TCR_TRUE_VALUE (0x0000000080813519ULL)
|
||||||
uint64_t tcr = 0;
|
uint64_t tcr = 0;
|
||||||
TCR_W(TCR_TRUE_VALUE);
|
|
||||||
TCR_R(tcr);
|
TCR_R(tcr);
|
||||||
uint64_t mair = 0;
|
tcr &= (uint64_t)~0xFF;
|
||||||
MAIR_R(mair);
|
tcr |= 0x19;
|
||||||
// MAIR_W((MT_DEVICE_nGnRnE << (8 * AI_DEVICE_nGnRnE_IDX)) | (MT_NORMAL_NC << (8 * AI_NORMAL_NC_IDX)));
|
TCR_W(tcr);
|
||||||
// debug_printf_("TCR: %016lx(0x%016lx)\r\n", tcr, TCR_VALUE);
|
|
||||||
// debug_printf_("MAIR: %016lx\r\n", mair);
|
|
||||||
|
|
||||||
// Enable paging using read/modify/write
|
// Enable paging using read/modify/write
|
||||||
// debug_printf_("Loading SCTLR.\r\n");
|
|
||||||
// uint32_t val = 0;
|
// uint32_t val = 0;
|
||||||
// SCTLR_R(val);
|
// SCTLR_R(val);
|
||||||
// debug_printf_("Old SCTLR: %016lx\r\n", val);
|
// debug_printf_("Old SCTLR: %016lx\r\n", val);
|
||||||
|
@ -177,8 +158,6 @@ static void load_boot_pgdir()
|
||||||
DSB();
|
DSB();
|
||||||
CLEARTLB(0);
|
CLEARTLB(0);
|
||||||
ISB();
|
ISB();
|
||||||
|
|
||||||
// debug_printf_("Alive after TLB.\r\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int current_el(void)
|
static inline unsigned int current_el(void)
|
||||||
|
@ -192,27 +171,12 @@ extern void main(void);
|
||||||
static bool _bss_inited = false;
|
static bool _bss_inited = false;
|
||||||
void bootmain()
|
void bootmain()
|
||||||
{
|
{
|
||||||
// debug_printf_("building pgdir.\r\n");
|
|
||||||
build_boot_pgdir();
|
build_boot_pgdir();
|
||||||
// debug_printf_("l2[0]: %p\r\n", boot_l2pgdir[0]);
|
|
||||||
// debug_printf_("l2[1]: %p\r\n", boot_l2pgdir[1]);
|
|
||||||
// debug_printf_("l2[2]: %p\r\n", boot_l2pgdir[2]);
|
|
||||||
// debug_printf_("l2[3]: %p\r\n", boot_l2pgdir[3]);
|
|
||||||
// debug_printf_("loading pgdir, current el: %d\r\n", current_el());
|
|
||||||
load_boot_pgdir();
|
load_boot_pgdir();
|
||||||
// debug_printf_("loading pgdir, current el: %d\r\n", current_el());
|
|
||||||
// debug_printf_("test upper address: %x\r\n", *(uintptr_t*)P2V(boot_l2pgdir));
|
|
||||||
// el2_setup();
|
|
||||||
// unsigned int el = current_el();
|
|
||||||
// debug_printf_("loading pgdir, current el: %d\r\n", el);
|
|
||||||
// debug_printf_("Fix stack.\r\n");
|
|
||||||
__asm__ __volatile__("add sp, sp, %0" ::"r"(KERN_OFFSET));
|
__asm__ __volatile__("add sp, sp, %0" ::"r"(KERN_OFFSET));
|
||||||
// debug_printf_("Alive after fix stack.\r\n");
|
|
||||||
if (!_bss_inited) {
|
if (!_bss_inited) {
|
||||||
// debug_printf_("Clear bss.\r\n");
|
|
||||||
memset(&kernel_data_begin, 0x00, (size_t)((uint64_t)kernel_data_end - (uint64_t)kernel_data_begin));
|
memset(&kernel_data_begin, 0x00, (size_t)((uint64_t)kernel_data_end - (uint64_t)kernel_data_begin));
|
||||||
_bss_inited = true;
|
_bss_inited = true;
|
||||||
}
|
}
|
||||||
// debug_printf_("Going main.\r\n");
|
|
||||||
main();
|
main();
|
||||||
}
|
}
|
|
@ -35,8 +35,6 @@ Modification:
|
||||||
#include "mmu_common.h"
|
#include "mmu_common.h"
|
||||||
#include "trap_common.h"
|
#include "trap_common.h"
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
// extern struct MmuCommonDone mmu_common_done;
|
// extern struct MmuCommonDone mmu_common_done;
|
||||||
static struct MmuDriverRightGroup right_group;
|
static struct MmuDriverRightGroup right_group;
|
||||||
|
|
||||||
|
|
|
@ -61,14 +61,14 @@ Modification:
|
||||||
#define MAX_NR_FREE_PAGES ((PHY_MEM_STOP - PHY_MEM_BASE) >> LEVEL4_PTE_SHIFT)
|
#define MAX_NR_FREE_PAGES ((PHY_MEM_STOP - PHY_MEM_BASE) >> LEVEL4_PTE_SHIFT)
|
||||||
|
|
||||||
/* Deivce memory layout */
|
/* Deivce memory layout */
|
||||||
#define DEV_PHYMEM_BASE (0x00000000C0000000ULL)
|
#define DEV_PHYMEM_BASE (0x00000000F0000000ULL)
|
||||||
#define DEV_VRTMEM_BASE (0x00000040C0000000ULL)
|
#define DEV_VRTMEM_BASE (0x00000040F0000000ULL)
|
||||||
#define DEV_MEM_SIZE (0x0000000040000000ULL)
|
#define DEV_MEM_SIZE (0x0000000010000000ULL)
|
||||||
|
|
||||||
/* User memory layout */
|
/* User memory layout */
|
||||||
#define USER_STACK_SIZE PAGE_SIZE
|
#define USER_STACK_SIZE PAGE_SIZE
|
||||||
#define USER_MEM_BASE (0x0000000000000000ULL)
|
#define USER_MEM_BASE (0x0000000000000000ULL)
|
||||||
#define USER_MEM_TOP DEV_VRTMEM_BASE
|
#define USER_MEM_TOP (0x0000004000000000ULL)
|
||||||
#define USER_IPC_SPACE_BASE (0x0000003000000000ULL)
|
#define USER_IPC_SPACE_BASE (0x0000003000000000ULL)
|
||||||
#define USER_IPC_USE_ALLOCATOR_WATERMARK (0x0000003000010000ULL)
|
#define USER_IPC_USE_ALLOCATOR_WATERMARK (0x0000003000010000ULL)
|
||||||
#define USER_IPC_SPACE_TOP (USER_IPC_SPACE_BASE + 0x10000000ULL)
|
#define USER_IPC_SPACE_TOP (USER_IPC_SPACE_BASE + 0x10000000ULL)
|
||||||
|
|
|
@ -53,20 +53,19 @@ Modification:
|
||||||
void GetUsrPteAttr(uintptr_t* attr)
|
void GetUsrPteAttr(uintptr_t* attr)
|
||||||
{
|
{
|
||||||
// *attr = ARMV8_PTE_AP_U | ARMV8_PTE_AP_RW | ARMV8_PTE_AF | ARMV8_PTE_NORMAL | ARMV8_PTE_VALID;
|
// *attr = ARMV8_PTE_AP_U | ARMV8_PTE_AP_RW | ARMV8_PTE_AF | ARMV8_PTE_NORMAL | ARMV8_PTE_VALID;
|
||||||
*attr = 0x753;
|
*attr = 0x713 | ARMV8_PTE_AP_U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetUsrDevPteAttr(uintptr_t* attr)
|
void GetUsrDevPteAttr(uintptr_t* attr)
|
||||||
{
|
{
|
||||||
// *attr = ARMV8_PTE_AP_U | ARMV8_PTE_AP_RW | ARMV8_PTE_AF | ARMV8_PTE_DEVICE | ARMV8_PTE_XN | ARMV8_PTE_VALID;
|
// *attr = ARMV8_PTE_AP_U | ARMV8_PTE_AP_RW | ARMV8_PTE_AF | ARMV8_PTE_DEVICE | ARMV8_PTE_XN | ARMV8_PTE_VALID;
|
||||||
*attr = 0x443;
|
*attr = 0x403 | ARMV8_PTE_AP_U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetDevPteAttr(uintptr_t* attr)
|
void GetDevPteAttr(uintptr_t* attr)
|
||||||
{
|
{
|
||||||
// *attr = ARMV8_PTE_AP_K | ARMV8_PTE_AP_RW | ARMV8_PTE_AF | ARMV8_PTE_DEVICE | ARMV8_PTE_XN | ARMV8_PTE_VALID;
|
// *attr = ARMV8_PTE_AP_K | ARMV8_PTE_AP_RW | ARMV8_PTE_AF | ARMV8_PTE_DEVICE | ARMV8_PTE_XN | ARMV8_PTE_VALID;
|
||||||
*attr = 0x403ULL;
|
*attr = 0x403ULL;
|
||||||
// *attr = 0x711;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetKernPteAttr(uintptr_t* attr)
|
void GetKernPteAttr(uintptr_t* attr)
|
||||||
|
|
|
@ -13,7 +13,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
board_specs = stub.o
|
board_specs = stub.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,9 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
struct Session session;
|
struct Session session;
|
||||||
printf("init: connecting MemFS\n");
|
printf("init: connecting MemFS\n");
|
||||||
while (connect_session(&session, "MemFS", 8092) < 0)
|
while (connect_session(&session, "MemFS", 8092) < 0) {
|
||||||
;
|
yield(SYS_TASK_YIELD_NO_REASON);
|
||||||
|
}
|
||||||
printf("init: connect MemFS success\n");
|
printf("init: connect MemFS success\n");
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -12,7 +12,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
ld = ${toolchain}g++
|
ld = ${toolchain}g++
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -12,7 +12,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -349,6 +349,7 @@ IPC_SERVER_REGISTER_INTERFACES(IpcFsServer, 10,
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
printf("MemFS Start\n");
|
||||||
sys_state_info info;
|
sys_state_info info;
|
||||||
get_memblock_info(&info);
|
get_memblock_info(&info);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
// Block size
|
// Block size
|
||||||
#define BLOCK_SIZE 512
|
#define BLOCK_SIZE 512
|
||||||
#define NR_BIT_BLOCKS 2
|
#define NR_BIT_BLOCKS 8
|
||||||
|
|
||||||
// bits size
|
// bits size
|
||||||
#define BITS 8
|
#define BITS 8
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N
|
user_ldflags = -N
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -12,7 +12,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -12,7 +12,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -11,7 +11,7 @@ endif
|
||||||
ifeq ($(BOARD), ok1028a-c)
|
ifeq ($(BOARD), ok1028a-c)
|
||||||
toolchain ?= aarch64-none-elf-
|
toolchain ?= aarch64-none-elf-
|
||||||
user_ldflags = -N -Ttext 0
|
user_ldflags = -N -Ttext 0
|
||||||
cflags = -Wall -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = ${toolchain}gcc
|
cc = ${toolchain}gcc
|
||||||
|
|
|
@ -49,7 +49,7 @@ Modification:
|
||||||
#define ROOT_INUM 1 // root inode number
|
#define ROOT_INUM 1 // root inode number
|
||||||
#define BLOCK_SIZE 512 // block size
|
#define BLOCK_SIZE 512 // block size
|
||||||
#define NR_BIT_PER_BYTE 8
|
#define NR_BIT_PER_BYTE 8
|
||||||
#define NR_BIT_BLOCKS 2
|
#define NR_BIT_BLOCKS 8
|
||||||
#define nr_blocks_total (BLOCK_SIZE * NR_BIT_PER_BYTE * NR_BIT_BLOCKS) // total number of blocks (including used blocks and free blocks)
|
#define nr_blocks_total (BLOCK_SIZE * NR_BIT_PER_BYTE * NR_BIT_BLOCKS) // total number of blocks (including used blocks and free blocks)
|
||||||
#define nr_inodes 200 // total number of inodes
|
#define nr_inodes 200 // total number of inodes
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ int main(void)
|
||||||
char* fs_server_task_param[2] = { "/app/fs_server", 0 };
|
char* fs_server_task_param[2] = { "/app/fs_server", 0 };
|
||||||
sys_spawn((char*)_binary_default_fs_start, "memfs", fs_server_task_param);
|
sys_spawn((char*)_binary_default_fs_start, "memfs", fs_server_task_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start scheduler */
|
/* start scheduler */
|
||||||
struct SchedulerRightGroup scheduler_rights;
|
struct SchedulerRightGroup scheduler_rights;
|
||||||
assert(AchieveResourceTag(&scheduler_rights.mmu_driver_tag, &hardkernel_tag, "mmu-ac-resource"));
|
assert(AchieveResourceTag(&scheduler_rights.mmu_driver_tag, &hardkernel_tag, "mmu-ac-resource"));
|
||||||
|
|
|
@ -61,12 +61,12 @@ static bool _map_pages(uintptr_t* pgdir, uintptr_t vaddr, uintptr_t paddr, int l
|
||||||
while (true) {
|
while (true) {
|
||||||
uintptr_t* pte = NULL;
|
uintptr_t* pte = NULL;
|
||||||
if ((pte = _page_walk(pgdir, vaddr, true)) == NULL) {
|
if ((pte = _page_walk(pgdir, vaddr, true)) == NULL) {
|
||||||
ERROR("pte not found for vaddr %x.\n", vaddr);
|
ERROR("pte not found for vaddr %p.\n", vaddr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNLIKELY(*pte != 0)) {
|
if (UNLIKELY(*pte != 0)) {
|
||||||
ERROR("remapping: vaddr: %x | paddr: %x | pte: %x |\n", vaddr, paddr, *pte);
|
ERROR("remapping: vaddr: %p | paddr: %p | pte: %p |\n", vaddr, paddr, *pte);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,12 +93,12 @@ static bool _unmap_pages(uintptr_t* pgdir, uintptr_t vaddr, int len)
|
||||||
while (true) {
|
while (true) {
|
||||||
uintptr_t* pte = NULL;
|
uintptr_t* pte = NULL;
|
||||||
if ((pte = _page_walk(pgdir, vaddr, false)) == NULL) {
|
if ((pte = _page_walk(pgdir, vaddr, false)) == NULL) {
|
||||||
ERROR("pte not found for vaddr %x.\n", vaddr);
|
ERROR("pte not found for vaddr %p.\n", vaddr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*pte == 0) {
|
if (*pte == 0) {
|
||||||
ERROR("unmap a unmapped page, vaddr: %x, pte: %x\n", vaddr, *pte);
|
ERROR("unmap a unmapped page, vaddr: %p, pte: %p\n", vaddr, *pte);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@ Modification:
|
||||||
#include "multicores.h"
|
#include "multicores.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
static struct TraceTag clock_driver_tag;
|
static struct TraceTag clock_driver_tag;
|
||||||
static struct XiziClockDriver* p_clock_driver = NULL;
|
static struct XiziClockDriver* p_clock_driver = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue