X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Finit_src%2Fmain.c;h=50057089ef5524675a562b7c68b1ecca056b1207;hb=05ebedc80e5aab98be31a032eed5caf28944ea57;hp=b205e3b3570e3d5f7ce45e378e5fb6531d71c427;hpb=3f47fd7edcc581911a23ca075a463c5c8de9ab9a;p=tpg%2Facess2.git diff --git a/Usermode/Applications/init_src/main.c b/Usermode/Applications/init_src/main.c index b205e3b3..50057089 100644 --- a/Usermode/Applications/init_src/main.c +++ b/Usermode/Applications/init_src/main.c @@ -5,30 +5,40 @@ // === CONSTANTS === #define NULL ((void*)0) +#define NUM_TERMS 4 #define DEFAULT_TERMINAL "/Devices/VTerm/0" -#define DEFAULT_SHELL "/Acess/CLIShell" +#define DEFAULT_SHELL "/Acess/SBin/login" // === CODE === /** * \fn int main(int argc, char *argv[]) + * \brief Entrypoint */ int main(int argc, char *argv[]) { int tid; - open(DEFAULT_TERMINAL, OPENFLAG_READ); // Stdin - open(DEFAULT_TERMINAL, OPENFLAG_WRITE); // Stdout - open(DEFAULT_TERMINAL, OPENFLAG_WRITE); // Stderr + int i; + char termpath[sizeof(DEFAULT_TERMINAL)] = DEFAULT_TERMINAL; + char *child_argv[2] = {DEFAULT_SHELL, 0}; - write(1, 13, "Hello, World!"); - - tid = clone(CLONE_VM, 0); - __asm__ __volatile__("xchg %%bx, %%bx"::"a"(tid)); - if(tid == 0) - { - execve(DEFAULT_SHELL, NULL, NULL); - for(;;) __asm__ __volatile__("hlt"); + for( i = 0; i < NUM_TERMS; i++ ) + { + tid = clone(CLONE_VM, 0); + if(tid == 0) + { + termpath[sizeof(DEFAULT_TERMINAL)-2] = '0' + i; + + //__asm__ __volatile__ ("int $0xAC" :: "a" (256), "b" ("%s"), "c" (termpath)); + + open(termpath, OPENFLAG_READ); // Stdin + open(termpath, OPENFLAG_WRITE); // Stdout + open(termpath, OPENFLAG_WRITE); // Stderr + execve(DEFAULT_SHELL, child_argv, NULL); + for(;;) sleep(); + } } + // TODO: Implement message watching for(;;) sleep(); return 42;