Finally use ramdisk code for /rd/.
E.g. in the test 016_#f01_#draw_all.t.
This commit is contained in:
parent
01df7faab2
commit
6d302f27fe
34
shell.c
34
shell.c
@ -34,6 +34,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include "vdisk.h"
|
||||
#include "vnet.h"
|
||||
#include "umka.h"
|
||||
@ -288,6 +289,36 @@ void shell_disk_list_partitions(disk_t *d) {
|
||||
}
|
||||
}
|
||||
|
||||
void shell_ramdisk_init(int argc, char **argv) {
|
||||
const char *usage = \
|
||||
"usage: ramdisk_init <file>\n"
|
||||
" <file> absolute or relative path";
|
||||
if (argc != 2) {
|
||||
puts(usage);
|
||||
return;
|
||||
}
|
||||
const char *fname = argv[1];
|
||||
FILE *f = fopen(fname, "r");
|
||||
if (!f) {
|
||||
fprintf(fout, "[!] can't open file '%s': %s\n", fname, strerror(errno));
|
||||
return;
|
||||
}
|
||||
fseek(f, 0, SEEK_END);
|
||||
size_t fsize = ftell(f);
|
||||
if (fsize > 2880*512) {
|
||||
fprintf(fout, "[!] file '%s' is too big, max size is 1474560 bytes\n",
|
||||
fname);
|
||||
return;
|
||||
}
|
||||
rewind(f);
|
||||
fread(kos_ramdisk, fsize, 1, f);
|
||||
fclose(f);
|
||||
COVERAGE_ON();
|
||||
void *ramdisk = kos_ramdisk_init();
|
||||
COVERAGE_OFF();
|
||||
shell_disk_list_partitions(ramdisk);
|
||||
}
|
||||
|
||||
void shell_disk_add(int argc, char **argv) {
|
||||
const char *usage = \
|
||||
"usage: disk_add <file> <name> [option]...\n"
|
||||
@ -1133,7 +1164,9 @@ void shell_acpi_call(int argc, char **argv) {
|
||||
}
|
||||
const char *method = argv[1];
|
||||
fprintf(fout, "calling acpi method: '%s'\n", method);
|
||||
COVERAGE_ON();
|
||||
kos_acpi_call_name(acpi_ctx, method);
|
||||
COVERAGE_OFF();
|
||||
fprintf(fout, "acpi method returned\n");
|
||||
}
|
||||
|
||||
@ -1866,6 +1899,7 @@ typedef struct {
|
||||
|
||||
func_table_t funcs[] = {
|
||||
{ "i40", shell_i40 },
|
||||
{ "ramdisk_init", shell_ramdisk_init },
|
||||
{ "disk_add", shell_disk_add },
|
||||
{ "disk_del", shell_disk_del },
|
||||
{ "ls70", shell_ls70 },
|
||||
|
@ -1,4 +1,5 @@
|
||||
/> disk_add ../img/kolibri.img rd -c 0
|
||||
#disk_add ../img/kolibri.img rd -c 0
|
||||
/> ramdisk_init ../img/kolibri.img
|
||||
/rd/1: fat
|
||||
/> set_skin /sys/DEFAULT.SKN
|
||||
status: 0
|
||||
|
@ -1,4 +1,5 @@
|
||||
disk_add ../img/kolibri.img rd -c 0
|
||||
#disk_add ../img/kolibri.img rd -c 0
|
||||
ramdisk_init ../img/kolibri.img
|
||||
set_skin /sys/DEFAULT.SKN
|
||||
window_redraw 1
|
||||
draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
|
||||
|
1
umka.asm
1
umka.asm
@ -43,6 +43,7 @@ public WIN_POS as 'kos_win_pos'
|
||||
public lfb_base as 'kos_lfb_base'
|
||||
|
||||
public RAMDISK as 'kos_ramdisk'
|
||||
public ramdisk_init as 'kos_ramdisk_init'
|
||||
|
||||
public enable_acpi
|
||||
public acpi.call_name
|
||||
|
3
umka.h
3
umka.h
@ -325,7 +325,7 @@ void kos_init(void);
|
||||
void i40(void);
|
||||
uint32_t kos_time_to_epoch(uint32_t *time);
|
||||
|
||||
void *disk_add(diskfunc_t *disk, const char *name, void *userdata, uint32_t flags) __attribute__((__stdcall__));
|
||||
disk_t *disk_add(diskfunc_t *disk, const char *name, void *userdata, uint32_t flags) __attribute__((__stdcall__));
|
||||
void *disk_media_changed(diskfunc_t *disk, int inserted) __attribute__((__stdcall__));
|
||||
void disk_del(disk_t *disk) __attribute__((__stdcall__));
|
||||
|
||||
@ -337,6 +337,7 @@ extern uint8_t fat_user_functions[];
|
||||
extern uint8_t ntfs_user_functions[];
|
||||
|
||||
extern uint8_t kos_ramdisk[2880*512];
|
||||
disk_t *kos_ramdisk_init(void);
|
||||
|
||||
static inline void kos_enable_acpi() {
|
||||
__asm__ __inline__ __volatile__ (
|
||||
|
Loading…
Reference in New Issue
Block a user