mirror of
https://github.com/drasko/codezero.git
synced 2026-03-10 14:23:33 +01: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:
@@ -52,7 +52,7 @@ SECTIONS
|
||||
{
|
||||
. = virtual_base;
|
||||
_start_text = .;
|
||||
.text : AT (ADDR(.text) - offset) { crt0.o(.text) *(.text) }
|
||||
.text : AT (ADDR(.text) - offset) { *(.text.init) *(.text) }
|
||||
/* rodata is needed else your strings will link at physical! */
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
@@ -78,10 +78,10 @@ testTaskEnvironment.Append(CPPPATH=['#' + posixServicesDirectory +'libposix/incl
|
||||
testExecLinkerScript = Command('#build/' + posixServicesDirectory + taskName + '/include/test_exec_linker.lds', testTaskEnvironment['physicalBaseLinkerScript'], createTestExecLinkerScript)
|
||||
testExecEnvironment = testTaskEnvironment.Clone()
|
||||
testExecEnvironment.Append(LINKFLAGS=['-T' + testExecLinkerScript[0].path])
|
||||
testExec = testExecEnvironment.Program('test_exec', Glob('src/test_exec/*.c') + ['#' + environment['userspace_crt0'][0].name])
|
||||
testExec = testExecEnvironment.Program('test_exec', Glob('src/test_exec/*.[cS]'))
|
||||
Depends(testExec, testExecLinkerScript)
|
||||
testExecS = Command('#build/' + posixServicesDirectory + taskName + '/test_exec.S', testExec, createTestExecS)
|
||||
program = testTaskEnvironment['buildTask'](taskName, Glob('*.c') + Glob('src/*.c') + testExecS, testTaskEnvironment, previousImage)
|
||||
program = testTaskEnvironment['buildTask'](taskName, Glob('*.c') + Glob('src/*.[cS]') + testExecS, testTaskEnvironment, previousImage)
|
||||
Depends(program, testExec)
|
||||
|
||||
Return('program')
|
||||
|
||||
@@ -26,7 +26,7 @@ SECTIONS
|
||||
{
|
||||
. = virtual_base;
|
||||
_start_text = .;
|
||||
.text : AT (ADDR(.text) - offset) { crt0.o(.text) *(.text) }
|
||||
.text : AT (ADDR(.text) - offset) { *(.text.head) *(.text) }
|
||||
/* rodata is needed else your strings will link at physical! */
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
#define __TASKNAME__ "test0"
|
||||
|
||||
//#define TEST_VERBOSE_PRINT
|
||||
#define TEST_VERBOSE_PRINT
|
||||
#if defined (TEST_VERBOSE_PRINT)
|
||||
#define test_printf(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define test_printf(...)
|
||||
#endif
|
||||
|
||||
#include <printf.h>
|
||||
#include <sys/types.h>
|
||||
extern pid_t parent_of_all;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Clone test.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <printf.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
12
containers/posix/test0/src/crt0.S
Normal file
12
containers/posix/test0/src/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
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
#include <dirent.h>
|
||||
#include <l4lib/os/posix/readdir.h>
|
||||
#include <tests.h>
|
||||
#include <printf.h>
|
||||
|
||||
#define DENTS_TOTAL 50
|
||||
|
||||
void print_fsize(struct stat *s)
|
||||
{
|
||||
printf("%d", s->st_size);
|
||||
printf("%lu", s->st_size);
|
||||
}
|
||||
|
||||
void print_flink(struct stat *s)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <printf.h>
|
||||
|
||||
extern char _start_test_exec[];
|
||||
extern char _end_test_exec[];
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string.h>
|
||||
#include <tests.h>
|
||||
#include <errno.h>
|
||||
#include <printf.h>
|
||||
|
||||
int fileio(void)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <tests.h>
|
||||
#include <l4/macros.h>
|
||||
#include <printf.h>
|
||||
|
||||
int global = 0;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <unistd.h>
|
||||
#include <tests.h>
|
||||
#include <errno.h>
|
||||
#include <printf.h>
|
||||
|
||||
#define PAGE_SIZE 0x1000
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ int shmtest(void)
|
||||
test_printf("Initiating shmget()\n");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if ((shmids[i] = shmget(keys[i], 27, IPC_CREAT | 0666)) < 0) {
|
||||
test_printf("SHMGET", errno);
|
||||
test_printf("SHMGET: %d", errno);
|
||||
goto out_err;
|
||||
} else
|
||||
test_printf("SHMID returned: %d\n", shmids[i]);
|
||||
@@ -30,7 +30,7 @@ int shmtest(void)
|
||||
test_printf("Now shmat()\n");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if ((int)(bases[i] = shmat(shmids[i], NULL, 0)) == -1) {
|
||||
test_printf("SHMAT", errno);
|
||||
test_printf("SHMAT: %d", errno);
|
||||
goto out_err;
|
||||
} else
|
||||
test_printf("SHM base address returned: %p\n", bases[i]);
|
||||
@@ -42,7 +42,7 @@ int shmtest(void)
|
||||
test_printf("Now shmdt()\n");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (shmdt(bases[i]) < 0) {
|
||||
test_printf("SHMDT", errno);
|
||||
test_printf("SHMDT: %d", errno);
|
||||
goto out_err;
|
||||
} else
|
||||
test_printf("SHM detached OK.\n");
|
||||
|
||||
12
containers/posix/test0/src/test_exec/crt0.S
Normal file
12
containers/posix/test0/src/test_exec/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
|
||||
|
||||
@@ -26,7 +26,7 @@ void main(void)
|
||||
{
|
||||
wait_pager(0);
|
||||
if (getpid() == 2) {
|
||||
printf("EXECVE TEST -- PASSED --\n", getpid());
|
||||
printf("EXECVE TEST -- PASSED --\n");
|
||||
printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid());
|
||||
while (1)
|
||||
wait_pager(0);
|
||||
|
||||
Reference in New Issue
Block a user