|
20 | 20 | #include <stdint.h>
|
21 | 21 | #include <flanterm/flanterm.h>
|
22 | 22 | #include <filesystems/fwrfs.h>
|
23 |
| - |
| 23 | +#include <fdlfcn.h> |
24 | 24 |
|
25 | 25 | void init_command_list(command_list* lst)
|
26 | 26 | {
|
@@ -93,6 +93,23 @@ void welcome_message(){
|
93 | 93 | display_time();
|
94 | 94 | }
|
95 | 95 |
|
| 96 | +extern int64* wm_addr; |
| 97 | + |
| 98 | +void start_window_manager(){ |
| 99 | + void* file_addr = wm_addr; |
| 100 | + elf_load_from_memory(file_addr); |
| 101 | + fdlfcn_handle* handle = fdlopen(file_addr, FDL_IMMEDIATE); |
| 102 | + int(*startfunction)(void); |
| 103 | + startfunction = (int(*)(void))fdlsym(handle, "_start"); |
| 104 | + if (startfunction != NULL) |
| 105 | + { |
| 106 | + int result = startfunction(); |
| 107 | + printf("Result function: %d\n", result); |
| 108 | + info("Successfully loaded function from .so file", __FILE__); |
| 109 | + } |
| 110 | + fdlclose(handle); |
| 111 | +} |
| 112 | + |
96 | 113 | extern struct flanterm_context* ft_ctx;
|
97 | 114 |
|
98 | 115 | struct fwrfs* fs;
|
@@ -291,6 +308,8 @@ void execute(const char* buffer, int argc, char** argv)
|
291 | 308 | printf("touch: missing file operand");
|
292 | 309 | } else if (strcmp(buffer, "ls") == 0) {
|
293 | 310 | list_contents(fs);
|
| 311 | + } else if (strncmp(buffer, "frostedwm", 9) == 0 || strcmp(buffer, "frostedwm") == 0) { |
| 312 | + start_window_manager(); |
294 | 313 | } else if (strncmp(buffer, "user ", 5) == 0 || strcmp(buffer, "user") == 0) {
|
295 | 314 | if(argv[1] != null)
|
296 | 315 | if((int)argv[1] == 1)
|
|
0 commit comments