Some userspace online doc
This commit is contained in:
parent
bee58d9642
commit
a4f5a367ab
@ -42,12 +42,13 @@ void *memcpy(void *dst0, const void *src0, size_t len0)
|
|||||||
#else
|
#else
|
||||||
char *dst = dst0;
|
char *dst = dst0;
|
||||||
const char *src = src0;
|
const char *src = src0;
|
||||||
long *aligned_dst;
|
|
||||||
const long *aligned_src;
|
|
||||||
|
|
||||||
/* If the size is small, or either SRC or DST is unaligned,
|
/* If the size is small, or either SRC or DST is unaligned,
|
||||||
then punt into the byte copy loop. This should be rare. */
|
then punt into the byte copy loop. This should be rare. */
|
||||||
if (!TOO_SMALL(len0) && !UNALIGNED(src, dst)) {
|
if (!TOO_SMALL(len0) && !UNALIGNED(src, dst)) {
|
||||||
|
long *aligned_dst;
|
||||||
|
const long *aligned_src;
|
||||||
|
|
||||||
aligned_dst = (long *)dst;
|
aligned_dst = (long *)dst;
|
||||||
aligned_src = (long *)src;
|
aligned_src = (long *)src;
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
int func_help()
|
int func_help()
|
||||||
{
|
{
|
||||||
printf("\nAvailable Commands:\n");
|
printf("\nAvailable Commands:\n");
|
||||||
printf(" suicide\n");
|
printf(" help: this help\n");
|
||||||
printf(" help\n");
|
printf(" suicide: userspace self kill\n");
|
||||||
printf(" syscall5\n");
|
printf(" syscall5: a syscall with parameters over the stack \n");
|
||||||
printf(" alloc\n");
|
printf(" alloc: test allocation\n");
|
||||||
printf(" tiny: a tiny C interpreter\n");
|
printf(" tiny: a tiny C-like interpreter\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ int func_suicide()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *initialHeap = 0;
|
char *initialHeap = 0;
|
||||||
int func_alloc()
|
int func_alloc()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ int func_alloc()
|
|||||||
}
|
}
|
||||||
printf("Testing allocation\n");
|
printf("Testing allocation\n");
|
||||||
int allocSize = 4096 * 2;
|
int allocSize = 4096 * 2;
|
||||||
void *currentHeap = brk(0);
|
char *currentHeap = brk(0);
|
||||||
if (currentHeap - initialHeap < allocSize) {
|
if (currentHeap - initialHeap < allocSize) {
|
||||||
brk(initialHeap + allocSize);
|
brk(initialHeap + allocSize);
|
||||||
}
|
}
|
||||||
|
@ -284,6 +284,7 @@ void run()
|
|||||||
|
|
||||||
int func_tiny()
|
int func_tiny()
|
||||||
{
|
{
|
||||||
|
printf("Enter your program then ESC\n\n");
|
||||||
printf("TinyC grammar\n");
|
printf("TinyC grammar\n");
|
||||||
printf("<program> ::= <statement>\n");
|
printf("<program> ::= <statement>\n");
|
||||||
printf("<statement> ::= \"if\" <paren_expr> <statement> |\n");
|
printf("<statement> ::= \"if\" <paren_expr> <statement> |\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user