Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve arm #1180

Merged
merged 7 commits into from Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/arch/arm/fpu/vfp.h
Expand Up @@ -41,16 +41,16 @@ extern int try_vfp_instructions(void);
stmia stack!, {tmp}; \
tst tmp, #0xF00000; \
beq fpu_out_save_inc; \
vstmia stack!, {d0-d15}; \
vstmia stack!, {d16-d31}; \
vstmia stack!, {d0-d15}; \
vstmia stack!, {d16-d31}; \
fpu_out_save_inc:

#define ARM_FPU_CONTEXT_SAVE_DEC(tmp, stack) \
mrc p15, 0, tmp, c1, c0, 2; \
tst tmp, #0xF00000; \
beq fpu_out_save_dec; \
fstmfdd stack!, {d0-d15}; \
fstmfdd stack!, {d16-d31}; \
vstmdb stack!, {d0-d15}; \
vstmdb stack!, {d16-d31}; \
fpu_out_save_dec: \
stmfd stack!, {tmp};

Expand All @@ -68,8 +68,8 @@ fpu_out_save_dec: \
mcr p15, 0, tmp, c1, c0, 2; \
tst tmp, #0xF00000; \
beq fpu_out_load_dec; \
fldmfdd stack!, {d16-d31}; \
fldmfdd stack!, {d0-d15}; \
vldmia stack!, {d16-d31}; \
vldmia stack!, {d0-d15}; \
fpu_out_load_dec:

#endif /* __ASSEMBLER__ */
Expand Down
6 changes: 3 additions & 3 deletions src/arch/arm/fpu/vfp9_s.h
Expand Up @@ -40,15 +40,15 @@ extern int try_vfp_instructions(void /*struct pt_regs_fpu *vfp */);
stmia stack!, {tmp}; \
ands tmp, tmp, #1<<30; \
beq fpu_out_save_inc; \
vstmia stack!, {d0-d15}; \
vstmia stack!, {d0-d15}; \
fpu_out_save_inc:

#define ARM_FPU_CONTEXT_SAVE_DEC(tmp, stack) \
vmrs tmp, FPEXC ; \
sub stack, stack, #(4 * 32); \
tst tmp, #1<<30; \
beq fpu_skip_save_dec; \
fstmiad stack, {d0-d15}; \
vstmia stack, {d0-d15}; \
fpu_skip_save_dec: \
stmfd stack!, {tmp};

Expand All @@ -66,7 +66,7 @@ fpu_skip_save_dec: \
/* vmsr FPEXC, tmp; */ \
ands tmp, tmp, #1<<30; \
beq fpu_skip_load_dec; \
fldmfdd stack, {d0-d15}; \
vldmia stack, {d0-d15}; \
fpu_skip_load_dec: \
add stack, stack, #4 * 32;

Expand Down
10 changes: 9 additions & 1 deletion src/compat/libc/math/math_builtins.c
Expand Up @@ -35,10 +35,18 @@ double log10(double x) {
return __builtin_log10(x);
}

double ceill(double x) {
long double ceill(long double x) {
return __builtin_ceill(x);
}

double ceil(double x) {
return __builtin_ceil(x);
}

float ceilf(float x) {
return __builtin_ceilf(x);
}

double floor(double x) {
return __builtin_floor(x);
}
Expand Down
4 changes: 3 additions & 1 deletion src/compat/libc/math/math_builtins.h
Expand Up @@ -15,7 +15,9 @@ extern double fabs(double x);
extern double roundl(double x);
extern double pow(double x, double y);
extern double log10(double x);
extern double ceill(double x);
extern double ceil(double x);
extern float ceilf(float x);
extern long double ceill(long double x);

extern double floor(double x);
extern float floorf(float x);
Expand Down
2 changes: 1 addition & 1 deletion src/mem/pagealloc/bitmask.c
Expand Up @@ -112,7 +112,7 @@ struct page_allocator *page_allocator_init(char *start, size_t len, size_t page_
unsigned int pages;
size_t bitmap_len;

if (len < page_size) {
if (len < page_size + sizeof(struct page_allocator)) {
return NULL;
}

Expand Down
19 changes: 16 additions & 3 deletions src/mem/vmem/vmem_alloc.c
Expand Up @@ -46,11 +46,13 @@

static char pgd_raw[(PGD_COUNT + 1) * MMU_PGD_SIZE] __attribute__ ((aligned(MMU_PGD_SIZE)));
static char pmd_raw[(PMD_COUNT + 1) * MMU_PMD_SIZE] __attribute__ ((aligned(MMU_PMD_SIZE)));
static char pte_raw[(PTE_COUNT + 1) * MMU_PTE_SIZE] __attribute__ ((aligned(MMU_PTE_SIZE)));

static struct page_allocator *pgd_allocator;
static struct page_allocator *pmd_allocator;
#if (PTE_COUNT > 1)
static struct page_allocator *pte_allocator;
static char pte_raw[(PTE_COUNT + 1) * MMU_PTE_SIZE] __attribute__ ((aligned(MMU_PTE_SIZE)));
#endif

static char virtual_page_raw[(VIRTUAL_PAGES_COUNT + 1) * MMU_PAGE_SIZE] __attribute__ ((section(".bss.vmem_pages")));
static struct page_allocator *virt_page_allocator;
Expand All @@ -60,11 +62,13 @@ EMBOX_UNIT_INIT(vmem_alloc_init);
static int vmem_alloc_init(void) {
pgd_allocator = page_allocator_init(pgd_raw, sizeof(pgd_raw), MMU_PGD_SIZE);
pmd_allocator = page_allocator_init(pmd_raw, sizeof(pmd_raw), MMU_PMD_SIZE);
#if (PTE_COUNT > 1)
pte_allocator = page_allocator_init(pte_raw, sizeof(pte_raw), MMU_PTE_SIZE);

assert(pte_allocator);
#endif
assert(pgd_allocator);
assert(pmd_allocator);
assert(pte_allocator);

virt_page_allocator = page_allocator_init(virtual_page_raw, VIRTUAL_PAGES_COUNT * MMU_PAGE_SIZE, MMU_PAGE_SIZE);

log_debug("%p", virt_page_allocator);
Expand Down Expand Up @@ -101,7 +105,9 @@ mmu_pmd_t *vmem_alloc_pmd_table(void) {
return addr;
}


mmu_pte_t *vmem_alloc_pte_table(void) {
#if (PTE_COUNT > 1)
void *addr;

assert(pte_allocator);
Expand All @@ -114,6 +120,11 @@ mmu_pte_t *vmem_alloc_pte_table(void) {
log_debug("%p", addr);

return addr;
#else
log_error("PTE pool size is zero for current configuration");

return NULL;
#endif
}

void *vmem_alloc_page() {
Expand All @@ -135,7 +146,9 @@ void vmem_free_pmd_table(mmu_pmd_t *pmd) {
}

void vmem_free_pte_table(mmu_pte_t *pte) {
#if (PTE_COUNT > 1)
page_free(pte_allocator, pte, 1);
#endif
}

void vmem_free_page(void *addr) {
Expand Down
2 changes: 1 addition & 1 deletion templates/arm/qemu/build.conf
Expand Up @@ -8,6 +8,6 @@ CROSS_COMPILE = arm-none-eabi-
CFLAGS += -O0 -g
CFLAGS += -mcpu=arm926ej-s -march=armv5te

CFLAGS += -mfpu=vfp -mfloat-abi=softfp
CFLAGS += -mfpu=vfp -mfloat-abi=hard

LDFLAGS += -N -g
49 changes: 29 additions & 20 deletions templates/arm/qemu/mods.config
Expand Up @@ -11,24 +11,27 @@ configuration conf {
@Runlevel(0) include embox.driver.periph_memory
@Runlevel(0) include embox.arch.arm.fpu.vfp9_s(log_level=3)

@Runlevel(0) include embox.arch.arm.mmu_small_page(domain_access=1,v5_format=1)
@Runlevel(0) include embox.mem.vmem_alloc(pgd_align=0x4000,pmd_align=0x1000,pte_align=0x1000,pmd_count=0x1000,
pte_count=1)
@Runlevel(0) include embox.arch.arm.mmu_small_page(
domain_access=1,v5_format=1)
@Runlevel(0) include embox.mem.vmem_alloc(
pgd_align=0x4000, pmd_align=0x1000,
pmd_count=0x1000, pte_count=0)

@Runlevel(0) include embox.mem.vmem(log_level=1)

include embox.lib.debug.whereami

@Runlevel(1) include embox.driver.video.pl110

include embox.kernel.spinlock(spin_debug=false)
@Runlevel(0) include embox.kernel.stack(stack_size=1048576)
@Runlevel(2) include embox.driver.serial.pl011(base_addr=0x16000000, irq_num=1,baud_rate=115200)
@Runlevel(2) include embox.driver.serial.pl011(
base_addr=0x16000000, irq_num=1, baud_rate=115200)
@Runlevel(1) include embox.driver.diag(impl="embox__driver__serial__pl011")
@Runlevel(1) include embox.driver.interrupt.integrator_pic
@Runlevel(1) include embox.driver.clock.integrator_pit(base_addr=0x13000000)
@Runlevel(1) include embox.driver.clock.integrator_pit(
base_addr=0x13000000)
@Runlevel(1) include embox.driver.net.lan91c111(base_addr=0xC8000000)
@Runlevel(2) include embox.driver.net.loopback
/*@Runlevel(1) include embox.driver.video.pl110*/

@Runlevel(2) include embox.fs.node(fnode_quantity=1024)
@Runlevel(2) include embox.fs.driver.fat
Expand All @@ -37,14 +40,14 @@ configuration conf {
@Runlevel(2) include embox.fs.driver.ramfs
@Runlevel(2) include embox.fs.rootfs


@Runlevel(1) include embox.kernel.timer.sys_timer
@Runlevel(1) include embox.kernel.time.kernel_time
include embox.kernel.thread.signal.sigstate
include embox.kernel.thread.signal.siginfoq

@Runlevel(2) include embox.kernel.task.multi
@Runlevel(2) include embox.kernel.thread.core(thread_pool_size=32, thread_stack_size=1048576)
@Runlevel(2) include embox.kernel.thread.core(
thread_pool_size=32, thread_stack_size=1048576)
@Runlevel(2) include embox.kernel.sched.strategy.priority_based
@Runlevel(2) include embox.kernel.timer.sleep
@Runlevel(2) include embox.kernel.timer.strategy.list_timer
Expand Down Expand Up @@ -84,8 +87,9 @@ configuration conf {
@Runlevel(1) include embox.test.mem.page_allocator
@Runlevel(1) include embox.test.util.hashtable_test

@Runlevel(2) include embox.cmd.sh.tish(prompt="%u@%h:%w%$", rich_prompt_support=1, builtin_commands="exit logout cd export mount umount")
include embox.init.start_script(shell_name="tish", tty_dev="ttyS0", shell_start=1, stop_on_error=true)
@Runlevel(2) include embox.cmd.sh.tish(
prompt="%u@%h:%w%$", rich_prompt_support=1,
builtin_commands="exit logout cd export mount umount")
include embox.init.system_start_service
include embox.cmd.service

Expand Down Expand Up @@ -147,8 +151,11 @@ configuration conf {

@Runlevel(2) include embox.net.core
@Runlevel(2) include embox.net.skbuff(amount_skb=4000)
@Runlevel(2) include embox.net.skbuff_data(amount_skb_data=4000,data_size=1514,data_align=1,data_padto=1,ip_align=false)
@Runlevel(2) include embox.net.skbuff_extra(amount_skb_extra=128,extra_size=10,extra_align=1,extra_padto=1)
@Runlevel(2) include embox.net.skbuff_data(
amount_skb_data=4000, data_size=1514,
data_align=1, data_padto=1,ip_align=false)
@Runlevel(2) include embox.net.skbuff_extra(
amount_skb_extra=128,extra_size=10,extra_align=1,extra_padto=1)
@Runlevel(2) include embox.net.socket
@Runlevel(2) include embox.net.dev
@Runlevel(2) include embox.net.af_inet
Expand All @@ -162,23 +169,25 @@ configuration conf {
@Runlevel(2) include embox.net.tcp_sock
@Runlevel(2) include embox.net.raw_sock
@Runlevel(2) include embox.net.net_entry
@Runlevel(2) include embox.test.net.socket_test(family=2,type=1,proto=0) /* AF_INET, SOCK_STREAM, default */
@Runlevel(2) include embox.test.net.inet_socket_test(type=1,proto=0) /* SOCK_STREAM, default */
@Runlevel(2) include embox.test.net.inet_dgram_socket_test(proto=0) /* default */
@Runlevel(2) include embox.test.net.inet_stream_socket_test(proto=0) /* default */
/* AF_INET, SOCK_STREAM, default */
@Runlevel(2) include embox.test.net.socket_test(family=2,type=1,proto=0)
/* SOCK_STREAM, default */
@Runlevel(2) include embox.test.net.inet_socket_test(type=1,proto=0)
/* default */
@Runlevel(2) include embox.test.net.inet_dgram_socket_test(proto=0)
/* default */
@Runlevel(2) include embox.test.net.inet_stream_socket_test(proto=0)

@Runlevel(2) include embox.test.net.raw_socket_test

@Runlevel(2) include embox.util.LibUtil
@Runlevel(2) include embox.framework.LibFramework
@Runlevel(2) include embox.compat.libc.all
include embox.compat.libc.math_openlibm
include embox.compat.libc.math_builtins
include embox.compat.libc.stdio.asprintf
include embox.compat.posix.proc.atexit_stub
include embox.compat.posix.fs.rewinddir_stub


@Runlevel(1) include embox.test.math.math_test
@Runlevel(2) include embox.test.math.fpu_context_consistency_test

}