Some userspace online doc

This commit is contained in:
Mathieu Maret 2023-11-11 00:09:00 +01:00
parent bee58d9642
commit a4f5a367ab
3 changed files with 11 additions and 9 deletions

View File

@ -42,12 +42,13 @@ void *memcpy(void *dst0, const void *src0, size_t len0)
#else
char *dst = dst0;
const char *src = src0;
long *aligned_dst;
const long *aligned_src;
/* If the size is small, or either SRC or DST is unaligned,
then punt into the byte copy loop. This should be rare. */
if (!TOO_SMALL(len0) && !UNALIGNED(src, dst)) {
long *aligned_dst;
const long *aligned_src;
aligned_dst = (long *)dst;
aligned_src = (long *)src;

View File

@ -5,11 +5,11 @@
int func_help()
{
printf("\nAvailable Commands:\n");
printf(" suicide\n");
printf(" help\n");
printf(" syscall5\n");
printf(" alloc\n");
printf(" tiny: a tiny C interpreter\n");
printf(" help: this help\n");
printf(" suicide: userspace self kill\n");
printf(" syscall5: a syscall with parameters over the stack \n");
printf(" alloc: test allocation\n");
printf(" tiny: a tiny C-like interpreter\n");
return 0;
}
@ -21,7 +21,7 @@ int func_suicide()
return 0;
}
void *initialHeap = 0;
char *initialHeap = 0;
int func_alloc()
{
@ -30,7 +30,7 @@ int func_alloc()
}
printf("Testing allocation\n");
int allocSize = 4096 * 2;
void *currentHeap = brk(0);
char *currentHeap = brk(0);
if (currentHeap - initialHeap < allocSize) {
brk(initialHeap + allocSize);
}

View File

@ -284,6 +284,7 @@ void run()
int func_tiny()
{
printf("Enter your program then ESC\n\n");
printf("TinyC grammar\n");
printf("<program> ::= <statement>\n");
printf("<statement> ::= \"if\" <paren_expr> <statement> |\n");