mirror of
https://github.com/drasko/codezero.git
synced 2026-04-08 04:59:04 +02:00
Created libc under containers/posix which now all tasks use to build.
There is a problem in the new libc that test0 now misbehaves. Going to be fixed.
This commit is contained in:
@@ -19,6 +19,6 @@
|
||||
|
||||
Import('environment', 'previousImage')
|
||||
|
||||
program = environment['buildTask']('mm0', Glob('*.c') + [Glob(directory + '/*.c') for directory in [ 'src', 'src/lib', 'src/lib/elf', 'src/arch-' + environment['ARCH']]], environment, previousImage)
|
||||
program = environment['buildTask']('mm0', Glob('*.c') + [Glob(directory + '/*.[cS]') for directory in [ 'src', 'src/lib', 'src/lib/elf', 'src/arch-' + environment['ARCH']]], environment, previousImage)
|
||||
|
||||
Return('program')
|
||||
|
||||
@@ -16,9 +16,13 @@
|
||||
*/
|
||||
|
||||
void main(void);
|
||||
void uart_init(void);
|
||||
|
||||
void __container_init(void)
|
||||
{
|
||||
/* Initialize uarts */
|
||||
uart_init();
|
||||
|
||||
/* Generic L4 initialisation */
|
||||
__l4_init();
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#include <posix/sys/types.h>
|
||||
#include <task.h>
|
||||
|
||||
#define SEEK_CUR 0
|
||||
#define SEEK_END 1
|
||||
#define SEEK_SET 2
|
||||
|
||||
int vfs_read(unsigned long vnum, unsigned long f_offset, unsigned long npages,
|
||||
void *pagebuf);
|
||||
int vfs_write(unsigned long vnum, unsigned long f_offset, unsigned long npages,
|
||||
|
||||
@@ -25,7 +25,7 @@ SECTIONS
|
||||
{
|
||||
. = virtual_base;
|
||||
_start_text = .;
|
||||
.text : AT (ADDR(.text) - pager_offset) { crt0.o(.text) *(.text) }
|
||||
.text : AT (ADDR(.text) - pager_offset) { *(.text.head) *(.text) }
|
||||
/* rodata is needed else your strings will link at physical! */
|
||||
.rodata : AT (ADDR(.rodata) - pager_offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - pager_offset) { *(.rodata1) }
|
||||
|
||||
@@ -168,9 +168,9 @@ void handle_requests(void)
|
||||
}
|
||||
default:
|
||||
printf("%s: Unrecognised ipc tag (%d) "
|
||||
"received from (%d). Full mr reading: "
|
||||
"received from (%lu). Full mr reading: "
|
||||
"%u, %u, %u, %u, %u, %u. Ignoring.\n",
|
||||
__TASKNAME__, tag, sender, read_mr(0),
|
||||
__TASKNAME__, tag, (unsigned long)senderid, read_mr(0),
|
||||
read_mr(1), read_mr(2), read_mr(3), read_mr(4),
|
||||
read_mr(5));
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
arch-arm
|
||||
12
containers/posix/mm0/src/arch-arm/crt0.S
Normal file
12
containers/posix/mm0/src/arch-arm/crt0.S
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
.section .text.head
|
||||
.global _start;
|
||||
.type _start,function;
|
||||
.align;
|
||||
|
||||
_start:
|
||||
ldr sp, =__stack
|
||||
bl __container_init
|
||||
1:
|
||||
b 1b
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <arch/mm.h>
|
||||
#include <task.h>
|
||||
#include <vm_area.h>
|
||||
#include <printf.h>
|
||||
|
||||
/* Extracts generic protection flags from architecture-specific pte */
|
||||
unsigned int vm_prot_flags(pte_t pte)
|
||||
|
||||
12
containers/posix/mm0/src/arch/crt0.S
Normal file
12
containers/posix/mm0/src/arch/crt0.S
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
.section .text.head
|
||||
.global _start;
|
||||
.type _start,function;
|
||||
.align;
|
||||
|
||||
_start:
|
||||
ldr sp, =__stack
|
||||
bl __container_init
|
||||
1:
|
||||
b 1b
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <l4/api/errno.h>
|
||||
#include INC_GLUE(memory.h)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <printf.h>
|
||||
|
||||
/* All memory allocated here is discarded after boot */
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4/generic/cap-types.h> /* TODO: Move this to API */
|
||||
#include <lib/malloc.h>
|
||||
#include <printf.h>
|
||||
|
||||
struct cap_list capability_list;
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ int read_file_pages(struct vm_file *vmfile, unsigned long pfn_start,
|
||||
f_offset);
|
||||
if (IS_ERR(page)) {
|
||||
printf("%s: %s:Could not read page %d "
|
||||
"from file with vnum: 0x%x\n", __TASKNAME__,
|
||||
"from file with vnum: 0x%lx\n", __TASKNAME__,
|
||||
__FUNCTION__, f_offset, vm_file_to_vnum(vmfile));
|
||||
return (int)page;
|
||||
}
|
||||
@@ -460,7 +460,7 @@ int write_file_pages(struct vm_file *f, unsigned long pfn_start,
|
||||
err = f->vm_obj.pager->ops.page_out(&f->vm_obj, f_offset);
|
||||
if (err < 0) {
|
||||
printf("%s: %s:Could not write page %d "
|
||||
"to file with vnum: 0x%x\n", __TASKNAME__,
|
||||
"to file with vnum: 0x%lx\n", __TASKNAME__,
|
||||
__FUNCTION__, f_offset, vm_file_to_vnum(f));
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <l4/types.h>
|
||||
#include INC_GLUE(memory.h)
|
||||
#include <lib/addr.h>
|
||||
#include <stdio.h>
|
||||
#include <printf.h>
|
||||
|
||||
/*
|
||||
* Initializes an address pool, but uses an already
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <lib/bit.h>
|
||||
#include <l4/macros.h>
|
||||
#include <l4/config.h>
|
||||
#include <stdio.h>
|
||||
#include <printf.h>
|
||||
#include INC_GLUE(memory.h)
|
||||
|
||||
/* Emulation of ARM's CLZ (count leading zeroes) instruction */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <lib/elf/elfprg.h>
|
||||
#include <lib/elf/elfsym.h>
|
||||
#include <lib/elf/elfsect.h>
|
||||
|
||||
#include <printf.h>
|
||||
|
||||
int elf_probe(struct elf_header *header)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <lib/malloc.h>
|
||||
#include <l4/macros.h>
|
||||
#include INC_GLUE(memory.h)
|
||||
#include <stdio.h>
|
||||
#include <printf.h>
|
||||
#include <l4/api/errno.h>
|
||||
|
||||
struct id_pool *id_pool_new_init(int totalbits)
|
||||
|
||||
@@ -18,6 +18,7 @@ Messages that indicate a software error will contain three asterisks (***).
|
||||
*****************************************************************************/
|
||||
#include <string.h> /* memcpy(), memset() */
|
||||
#include <stdio.h> /* printf() */
|
||||
#include <printf.h>
|
||||
#include <l4/macros.h>
|
||||
#define _32BIT 1
|
||||
|
||||
|
||||
@@ -239,8 +239,8 @@ void *do_mmap(struct vm_file *mapfile, unsigned long file_offset,
|
||||
/* Get total file pages, check if mapping is within file size */
|
||||
file_npages = __pfn(page_align_up(mapfile->length));
|
||||
if (npages > file_npages - file_offset) {
|
||||
printf("%s: Trying to map %d pages from page %d, "
|
||||
"but file length is %d\n", __FUNCTION__,
|
||||
printf("%s: Trying to map %d pages from page %lu, "
|
||||
"but file length is %lu\n", __FUNCTION__,
|
||||
npages, file_offset, file_npages);
|
||||
return PTR_ERR(-EINVAL);
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ int file_page_out(struct vm_object *vm_obj, unsigned long page_offset)
|
||||
|
||||
/* Check first if the file has such a page at all */
|
||||
if (__pfn(page_align_up(f->length) <= page_offset)) {
|
||||
printf("%s: %s: Trying to look up page %d, but file length "
|
||||
"is %d bytes.\n", __TASKNAME__, __FUNCTION__,
|
||||
printf("%s: %s: Trying to look up page %lu, but file length "
|
||||
"is %lu bytes.\n", __TASKNAME__, __FUNCTION__,
|
||||
page_offset, f->length);
|
||||
BUG();
|
||||
}
|
||||
@@ -123,8 +123,8 @@ struct page *file_page_in(struct vm_object *vm_obj, unsigned long page_offset)
|
||||
|
||||
/* Check first if the file has such a page at all */
|
||||
if (__pfn(page_align_up(f->length) <= page_offset)) {
|
||||
printf("%s: %s: Trying to look up page %d, but file length "
|
||||
"is %d bytes.\n", __TASKNAME__, __FUNCTION__,
|
||||
printf("%s: %s: Trying to look up page %lu, but file length "
|
||||
"is %lu bytes.\n", __TASKNAME__, __FUNCTION__,
|
||||
page_offset, f->length);
|
||||
BUG();
|
||||
}
|
||||
@@ -253,8 +253,8 @@ struct page *bootfile_page_in(struct vm_object *vm_obj,
|
||||
|
||||
/* Check first if the file has such a page at all */
|
||||
if (__pfn(page_align_up(boot_file->length) <= offset)) {
|
||||
printf("%s: %s: Trying to look up page %d, but file length "
|
||||
"is %d bytes.\n", __TASKNAME__, __FUNCTION__,
|
||||
printf("%s: %s: Trying to look up page %lu, but file length "
|
||||
"is %lu bytes.\n", __TASKNAME__, __FUNCTION__,
|
||||
offset, boot_file->length);
|
||||
BUG();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <mmap.h>
|
||||
#include <shm.h>
|
||||
#include <globals.h>
|
||||
#include <printf.h>
|
||||
|
||||
struct vm_statistics {
|
||||
int tasks; /* All tasks counted on the system */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <utcb.h>
|
||||
#include <lib/malloc.h>
|
||||
#include <vm_area.h>
|
||||
#include <printf.h>
|
||||
|
||||
/*
|
||||
* UTCB management in Codezero
|
||||
@@ -140,7 +141,7 @@ out:
|
||||
if (IS_ERR(err = do_mmap(0, 0, task, slot,
|
||||
VMA_ANONYMOUS | VMA_PRIVATE |
|
||||
VMA_FIXED | VM_READ | VM_WRITE, 1))) {
|
||||
printf("UTCB: mmapping failed with %d\n", err);
|
||||
printf("UTCB: mmapping failed with %p\n", err);
|
||||
return (int)err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <l4/api/errno.h>
|
||||
#include <lib/malloc.h>
|
||||
#include <globals.h>
|
||||
#include <printf.h>
|
||||
|
||||
/* Global list of all in-memory files on the system */
|
||||
struct global_list global_vm_files = {
|
||||
|
||||
Reference in New Issue
Block a user