Move shell from umka_shell to separate module.
This commit is contained in:
7
makefile
7
makefile
@@ -11,18 +11,21 @@ all: umka_shell umka_fuse umka_os umka.sym umka.prp umka.lst tags tools/mkdirran
|
|||||||
covpreproc: covpreproc.c
|
covpreproc: covpreproc.c
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
||||||
|
|
||||||
umka_shell: umka_shell.o umka.o trace.o trace_lbr.o vdisk.o vnet.o lodepng.o pci.o thread.o
|
umka_shell: umka_shell.o umka.o shell.o trace.o trace_lbr.o vdisk.o vnet.o lodepng.o pci.o thread.o
|
||||||
$(CC) $(LDFLAGS_32) $^ -o $@ -static
|
$(CC) $(LDFLAGS_32) $^ -o $@ -static
|
||||||
|
|
||||||
umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o pci.o thread.o
|
umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o pci.o thread.o
|
||||||
$(CC) $(LDFLAGS_32) $^ -o $@ `pkg-config fuse3 --libs`
|
$(CC) $(LDFLAGS_32) $^ -o $@ `pkg-config fuse3 --libs`
|
||||||
|
|
||||||
umka_os: umka_os.o umka.o trace.o trace_lbr.o vdisk.o pci.o thread.o
|
umka_os: umka_os.o umka.o shell.o lodepng.o vdisk.o vnet.o trace.o trace_lbr.o vdisk.o pci.o thread.o
|
||||||
$(CC) $(LDFLAGS_32) $^ -o $@ -static
|
$(CC) $(LDFLAGS_32) $^ -o $@ -static
|
||||||
|
|
||||||
umka.o umka.fas: umka.asm
|
umka.o umka.fas: umka.asm
|
||||||
INCLUDE="$(KOLIBRI)/kernel/trunk;$(KOLIBRI)/programs/develop/libraries/libcrash/trunk" $(FASM) $< umka.o -s umka.fas -m 1234567
|
INCLUDE="$(KOLIBRI)/kernel/trunk;$(KOLIBRI)/programs/develop/libraries/libcrash/trunk" $(FASM) $< umka.o -s umka.fas -m 1234567
|
||||||
|
|
||||||
|
shell.o: shell.c
|
||||||
|
$(CC) $(CFLAGS_32) -c $<
|
||||||
|
|
||||||
thread.o: linux/thread.c
|
thread.o: linux/thread.c
|
||||||
$(CC) $(CFLAGS_32) -c $<
|
$(CC) $(CFLAGS_32) -c $<
|
||||||
|
|
||||||
|
8
shell.h
Normal file
8
shell.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef SHELL_H_INCLUDED
|
||||||
|
#define SHELL_H_INCLUDED
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void *run_test(FILE *in, FILE *out, int block);
|
||||||
|
|
||||||
|
#endif // SHELL_H_INCLUDED
|
6
umka.asm
6
umka.asm
@@ -26,7 +26,8 @@ public monitor_thread
|
|||||||
public CURRENT_TASK as 'kos_current_task'
|
public CURRENT_TASK as 'kos_current_task'
|
||||||
public current_slot as 'kos_current_slot'
|
public current_slot as 'kos_current_slot'
|
||||||
public TASK_COUNT as 'kos_task_count'
|
public TASK_COUNT as 'kos_task_count'
|
||||||
public task_base_addr as 'kos_task_base'
|
public TASK_BASE as 'kos_task_base'
|
||||||
|
;public task_base_addr as 'kos_task_base'
|
||||||
public task_data_addr as 'kos_task_data'
|
public task_data_addr as 'kos_task_data'
|
||||||
public slot_base_addr as 'kos_slot_base'
|
public slot_base_addr as 'kos_slot_base'
|
||||||
|
|
||||||
@@ -282,7 +283,7 @@ proc kos_init c uses ebx esi edi ebp
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
public idle as 'umka_idle'
|
public skin_udata
|
||||||
proc idle uses ebx esi edi
|
proc idle uses ebx esi edi
|
||||||
.loop:
|
.loop:
|
||||||
mov ecx, 10000000
|
mov ecx, 10000000
|
||||||
@@ -542,7 +543,6 @@ macro lea r, v {
|
|||||||
|
|
||||||
macro add r, v {
|
macro add r, v {
|
||||||
if v eq CURRENT_TASK - (SLOT_BASE shr 3)
|
if v eq CURRENT_TASK - (SLOT_BASE shr 3)
|
||||||
; int3
|
|
||||||
push r
|
push r
|
||||||
mov r, SLOT_BASE
|
mov r, SLOT_BASE
|
||||||
shr r, 3
|
shr r, 3
|
||||||
|
17
umka.h
17
umka.h
@@ -454,10 +454,25 @@ typedef struct {
|
|||||||
uint8_t pad[256-80];
|
uint8_t pad[256-80];
|
||||||
} appdata_t;
|
} appdata_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t event_mask;
|
||||||
|
uint32_t pid;
|
||||||
|
uint16_t pad1;
|
||||||
|
uint8_t state;
|
||||||
|
uint8_t pad2;
|
||||||
|
uint16_t pad3;
|
||||||
|
uint8_t wnd_number;
|
||||||
|
uint8_t pad4;
|
||||||
|
uint32_t mem_start;
|
||||||
|
uint32_t counter_sum;
|
||||||
|
uint32_t counter_add;
|
||||||
|
uint32_t cpu_usage;
|
||||||
|
} taskdata_t;
|
||||||
|
|
||||||
extern uint32_t kos_current_task;
|
extern uint32_t kos_current_task;
|
||||||
extern appdata_t *kos_current_slot;
|
extern appdata_t *kos_current_slot;
|
||||||
extern size_t kos_task_count;
|
extern size_t kos_task_count;
|
||||||
extern void *kos_task_base;
|
extern taskdata_t *kos_task_base;
|
||||||
extern void *kos_task_data;
|
extern void *kos_task_data;
|
||||||
extern appdata_t *kos_slot_base;
|
extern appdata_t *kos_slot_base;
|
||||||
extern void (*monitor_thread)(void);
|
extern void (*monitor_thread)(void);
|
||||||
|
26
umka_os.c
26
umka_os.c
@@ -2,9 +2,15 @@
|
|||||||
#define __USE_GNU
|
#define __USE_GNU
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include "umka.h"
|
#include "umka.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "shell.h"
|
||||||
|
|
||||||
struct itimerval timeout = {.it_value = {.tv_sec = 0, .tv_usec = 10000}};
|
struct itimerval timeout = {.it_value = {.tv_sec = 0, .tv_usec = 10000}};
|
||||||
|
|
||||||
@@ -23,19 +29,35 @@ void scheduler(int signo, siginfo_t *info, void *context) {
|
|||||||
kos_current_task = 1;
|
kos_current_task = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("########## cli ############\n");
|
// printf("########## cli ############\n");
|
||||||
}
|
}
|
||||||
kos_current_slot = kos_slot_base + kos_current_task;
|
kos_current_slot = kos_slot_base + kos_current_task;
|
||||||
|
kos_task_base = ((taskdata_t*)&kos_current_task) + kos_current_task;
|
||||||
printf("##### kos_current_task: %u\n", kos_current_task);
|
printf("##### kos_current_task: %u\n", kos_current_task);
|
||||||
setitimer(ITIMER_PROF, &timeout, NULL);
|
setitimer(ITIMER_PROF, &timeout, NULL);
|
||||||
siglongjmp(*kos_slot_base[kos_current_task].fpu_state, 1);
|
siglongjmp(*kos_slot_base[kos_current_task].fpu_state, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//void intwrite(int fd,
|
||||||
|
|
||||||
void monitor() {
|
void monitor() {
|
||||||
|
fprintf(stderr, "Start monitor thread\n");
|
||||||
|
// mkfifo("/tmp/umka.fifo.2u", 0644);
|
||||||
|
// mkfifo("/tmp/umka.fifo.4u", 0644);
|
||||||
|
FILE *fin = fopen("/tmp/umka.fifo.2u", "r");
|
||||||
|
FILE *fout = fopen("/tmp/umka.fifo.4u", "w");
|
||||||
|
// while (1) {
|
||||||
|
fprintf(stderr, "### from monitor: %d\n", fileno(fout));
|
||||||
|
// }
|
||||||
|
if (!fin || !fout) {
|
||||||
|
fprintf(stderr, "Can't open monitor files!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
run_test(fin, fout, 0);
|
||||||
while (1) {
|
while (1) {
|
||||||
for (int i = 0; i < 10000000; i++) {}
|
for (int i = 0; i < 10000000; i++) {}
|
||||||
printf("6 usera\n");
|
printf("6 monitor\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
1788
umka_shell.c
1788
umka_shell.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user