summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/fs.c2
-rw-r--r--screenshots/foolos.pngbin31624 -> 10496 bytes
-rw-r--r--userspace/foolshell.c82
3 files changed, 19 insertions, 65 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 606e05c..4a254ac 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -7,7 +7,7 @@
int fs_readdir(const char *name,fs_dirent *dirs,int max)
{
- return ext2_read_dir(0x80800, 2,dirs,max); // TODO: hardcoded, fix this
+ return ext2_read_dir(0x80800, name,dirs,max); // TODO: hardcoded, fix this
}
diff --git a/screenshots/foolos.png b/screenshots/foolos.png
index 38751ce..f086f37 100644
--- a/screenshots/foolos.png
+++ b/screenshots/foolos.png
Binary files differ
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index 6baeb87..8bf8288 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -84,83 +84,37 @@ int process(char *buf)
// puts(command);
// copied from trottelshell
- if(!strcmp(command,"HELP"))
+ if(!strcmp(command,"help"))
{
- puts("foolshell: supported built-in commands: HELP, ECHO, TIME, MEM, PROC, TASKS, ALLOC, LS, SYSCALL.");
+ puts("foolshell: supported built-in commands: 'help', 'echo [string]', 'ls [inode_nr]', 'malloc [bytes]', 'free [address]', ");
}
- else if(!strcmp(command,"TIME"))
+ else if(!strcmp(command,"ls"))
{
-// uint32_t time=task_system_clock;
-// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d seconds passed since system start.",(time/25));
- puts("foolshell: TIME not supported now.");
- }
- else if(!strcmp(command,"MEM"))
- {
- //mmap_show_free();
- puts("foolshell: MEM not supported now.");
- }
- else if(!strcmp(command,"PROC"))
- {
- /*
- for(int i=0;i<SMP_MAX_PROC;i++)
- {
- if(cpu_counter[i]!=0)
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"cpu: %d => %d.",i,cpu_counter[i]);
- }
- */
- puts("foolshell: PROC not supported now.");
- }
- else if(!strcmp(command,"TASKS"))
- {
- //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d %d %d",c1,c2,c2);
- puts("foolshell: TASKS not supported now.");
- }
- else if(!strcmp(command,"ALLOC"))
- {
- /*
- uint32_t *malloc= pmmngr_alloc_block();
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"allocated 4KB block at: %08x.",malloc);
- */
- puts("foolshell: ALLOC not supported now.");
- }
- else if(!strcmp(command,"SYSCALL"))
- {
-
- puts("system call 10");
- unsigned int ebx; // will hold return value;
-
- // system call
- asm("pusha");
- asm("mov $10,%eax"); // select syscall 10 (example_syscall)
- asm("mov $666,%edx");
- asm("mov $333,%ecx");
- asm("int $0x80"); // actual syscall ! interrupt
- asm("mov %%ebx, %0": "=b" (ebx));
- asm("popa");
- //
-
- printf("system call returned %i\n",ebx);
-
- }
- else if(!strcmp(command,"LS"))
- {
- //fs_dirent dirs[25];
-
fs_dirent *dirs=malloc(sizeof(fs_dirent)*25);
- int ls=readdir("/dupa",dirs,25);
+ int ls=readdir(atoi(token[1]),dirs,25);
+
int i;
for(i=0;i<ls;i++)
{
- printf("%i %s%c\n",dirs[i].inode, dirs[i].name, ((dirs[i].type==FS_FILE_TYPE_DIR)?'/':' '));
+ printf("foolshell: %i %s%c\n",dirs[i].inode, dirs[i].name, ((dirs[i].type==FS_FILE_TYPE_DIR)?'/':' '));
}
}
- else if(!strcmp(command,"ECHO"))
+ else if(!strcmp(command,"echo"))
{
+ printf("foolshell: \"%s\"\n",token[1]);
- printf("%s\n",token[1]);
-
+ }
+ else if(!strcmp(command,"malloc"))
+ {
+ uint8_t *mall=malloc(atoi(token[1]));
+ printf("foolshell: allocated %d bytes at 0x%8x (%i).\n",atoi(token[1]),mall,mall);
+ }
+ else if(!strcmp(command,"free"))
+ {
+ free(atoi(token[1]));
+ printf("foolshell: called free(%08x).\n",atoi(token[1]));
}
else
{