[project] Generate syscalls from new interface DSL
This change adds a new interface DSL for specifying objects (with methods) and interfaces (that expose objects, and optionally have their own methods). Significant changes: - Add the new scripts/definitions Python module to parse the DSL - Add the new definitions directory containing DSL definition files - Use cog to generate syscall-related code in kernel and libj6 - Unify ordering of pointer + length pairs in interfaces
This commit is contained in:
@@ -33,7 +33,7 @@ struct entry
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
j6_system_log("fb driver starting");
|
||||
j6_log("fb driver starting");
|
||||
|
||||
size_t initc = 0;
|
||||
j6_init_value *initv = nullptr;
|
||||
@@ -48,7 +48,7 @@ main(int argc, const char **argv)
|
||||
}
|
||||
|
||||
if (!fb || fb->addr == 0) {
|
||||
j6_system_log("fb driver didn't find a framebuffer, exiting");
|
||||
j6_log("fb driver didn't find a framebuffer, exiting");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ main(int argc, const char **argv)
|
||||
buffer_size = size;
|
||||
continue;
|
||||
} else if (s != j6_status_ok) {
|
||||
j6_system_log("fb driver got error from get_log, quitting");
|
||||
j6_log("fb driver got error from get_log, quitting");
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ main(int argc, const char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
j6_system_log("fb driver done, exiting");
|
||||
j6_log("fb driver done, exiting");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ j6_handle_t handle_system = 2; // boot protocol is that init gets the system as
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
j6_system_log("srv.init starting");
|
||||
j6_log("srv.init starting");
|
||||
|
||||
modules mods = modules::load_modules(_arg_modules_phys, handle_system, handle_self);
|
||||
|
||||
@@ -28,7 +28,7 @@ main(int argc, const char **argv)
|
||||
for (auto &mod : mods.of_type(module_type::program)) {
|
||||
auto &prog = static_cast<const module_program&>(mod);
|
||||
sprintf(message, " program module '%s' at %lx", prog.filename, prog.base_address);
|
||||
j6_system_log(message);
|
||||
j6_log(message);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -70,7 +70,7 @@ modules::load_modules(uintptr_t address, j6_handle_t system, j6_handle_t self)
|
||||
|
||||
char message[100];
|
||||
sprintf(message, "srv.init found %d modules from page at 0x%lx", page->count, address);
|
||||
j6_system_log(message);
|
||||
j6_log(message);
|
||||
|
||||
if (!first)
|
||||
first = page->modules;
|
||||
|
||||
@@ -20,32 +20,32 @@ extern "C" {
|
||||
void
|
||||
thread_proc()
|
||||
{
|
||||
j6_system_log("sub thread starting");
|
||||
j6_log("sub thread starting");
|
||||
|
||||
char buffer[512];
|
||||
size_t len = sizeof(buffer);
|
||||
j6_tag_t tag = 0;
|
||||
j6_status_t result = j6_endpoint_receive(endp, &tag, &len, (void*)buffer);
|
||||
j6_status_t result = j6_endpoint_receive(endp, &tag, (void*)buffer, &len);
|
||||
if (result != j6_status_ok)
|
||||
j6_thread_exit(result);
|
||||
|
||||
j6_system_log("sub thread received message");
|
||||
j6_log("sub thread received message");
|
||||
|
||||
for (int i = 0; i < len; ++i)
|
||||
if (buffer[i] >= 'A' && buffer[i] <= 'Z')
|
||||
buffer[i] += 0x20;
|
||||
|
||||
tag++;
|
||||
result = j6_endpoint_send(endp, tag, len, (void*)buffer);
|
||||
result = j6_endpoint_send(endp, tag, (void*)buffer, len);
|
||||
if (result != j6_status_ok)
|
||||
j6_thread_exit(result);
|
||||
|
||||
j6_system_log("sub thread sent message");
|
||||
j6_log("sub thread sent message");
|
||||
|
||||
for (int i = 1; i < 5; ++i)
|
||||
j6_thread_sleep(i*10);
|
||||
|
||||
j6_system_log("sub thread exiting");
|
||||
j6_log("sub thread exiting");
|
||||
j6_thread_exit(0);
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ main(int argc, const char **argv)
|
||||
j6_handle_t children[2] = {j6_handle_invalid, j6_handle_invalid};
|
||||
j6_signal_t out = 0;
|
||||
|
||||
j6_system_log("main thread starting");
|
||||
j6_log("main thread starting");
|
||||
|
||||
for (int i = 0; i < argc; ++i)
|
||||
j6_system_log(argv[i]);
|
||||
j6_log(argv[i]);
|
||||
|
||||
void *base = malloc(0x1000);
|
||||
if (!base)
|
||||
@@ -68,57 +68,57 @@ main(int argc, const char **argv)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
vma_ptr[i*100] = uint64_t(i);
|
||||
|
||||
j6_system_log("main thread wrote to memory area");
|
||||
j6_log("main thread wrote to memory area");
|
||||
|
||||
j6_status_t result = j6_endpoint_create(&endp);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
j6_system_log("main thread created endpoint");
|
||||
j6_log("main thread created endpoint");
|
||||
|
||||
result = j6_thread_create(reinterpret_cast<void*>(&thread_proc), &children[1]);
|
||||
result = j6_thread_create(&children[1], reinterpret_cast<uintptr_t>(&thread_proc));
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
j6_system_log("main thread created sub thread");
|
||||
j6_log("main thread created sub thread");
|
||||
|
||||
char message[] = "MAIN THREAD SUCCESSFULLY CALLED SENDRECV IF THIS IS LOWERCASE";
|
||||
size_t size = sizeof(message);
|
||||
j6_tag_t tag = 16;
|
||||
result = j6_endpoint_sendrecv(endp, &tag, &size, (void*)message);
|
||||
result = j6_endpoint_sendrecv(endp, &tag, (void*)message, &size);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
if (tag != 17)
|
||||
j6_system_log("GOT WRONG TAG FROM SENDRECV");
|
||||
j6_log("GOT WRONG TAG FROM SENDRECV");
|
||||
|
||||
result = j6_system_bind_irq(__handle_sys, endp, 3);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
j6_system_log(message);
|
||||
j6_log(message);
|
||||
|
||||
j6_system_log("main thread creating a new process");
|
||||
j6_log("main thread creating a new process");
|
||||
result = j6_process_create(&children[0]);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
j6_system_log("main thread waiting on children");
|
||||
j6_log("main thread waiting on children");
|
||||
|
||||
j6_handle_t outhandle;
|
||||
result = j6_object_wait_many(children, 2, -1ull, &outhandle, &out);
|
||||
result = j6_kobject_wait_many(children, 2, -1ull, &outhandle, &out);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
if (outhandle == children[1]) {
|
||||
j6_system_log(" ok from child thread");
|
||||
j6_log(" ok from child thread");
|
||||
} else if (outhandle == children[0]) {
|
||||
j6_system_log(" ok from child process");
|
||||
j6_log(" ok from child process");
|
||||
} else {
|
||||
j6_system_log(" ... got unknown handle");
|
||||
j6_log(" ... got unknown handle");
|
||||
}
|
||||
|
||||
j6_system_log("main testing irqs");
|
||||
j6_log("main testing irqs");
|
||||
|
||||
|
||||
serial_port com2(COM2);
|
||||
@@ -137,16 +137,10 @@ main(int argc, const char **argv)
|
||||
return result;
|
||||
|
||||
if (j6_tag_is_irq(tag))
|
||||
j6_system_log("main thread got irq!");
|
||||
j6_log("main thread got irq!");
|
||||
}
|
||||
|
||||
j6_system_log("main thread closing endpoint");
|
||||
|
||||
result = j6_object_close(endp);
|
||||
if (result != j6_status_ok)
|
||||
return result;
|
||||
|
||||
j6_system_log("main thread done, exiting");
|
||||
j6_log("main thread done, exiting");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user