[project] Lose the battle between tabs & spaces
I'm a tabs guy. I like tabs, it's an elegant way to represent indentation instead of brute-forcing it. But I have to admit that the world seems to be going towards spaces, and tooling tends not to play nice with tabs. So here we go, changing the whole repo to spaces since I'm getting tired of all the inconsistent formatting.
This commit is contained in:
committed by
Justin C. Miller
parent
d36b2d8057
commit
8f529046a9
@@ -2,7 +2,7 @@
|
||||
#include "modules.h"
|
||||
|
||||
extern "C" {
|
||||
int main(int, const char **);
|
||||
int main(int, const char **);
|
||||
}
|
||||
|
||||
uintptr_t _arg_modules_phys; // This gets filled in in _start
|
||||
@@ -13,8 +13,8 @@ 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");
|
||||
modules::load_all(_arg_modules_phys);
|
||||
j6_system_log("srv.init starting");
|
||||
modules::load_all(_arg_modules_phys);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,53 +18,53 @@ namespace modules {
|
||||
static const modules_page *
|
||||
load_page(uintptr_t address)
|
||||
{
|
||||
j6_handle_t mods_vma = j6_handle_invalid;
|
||||
j6_status_t s = j6_system_map_phys(handle_system, &mods_vma, address, 0x1000, 0);
|
||||
if (s != j6_status_ok)
|
||||
exit(s);
|
||||
j6_handle_t mods_vma = j6_handle_invalid;
|
||||
j6_status_t s = j6_system_map_phys(handle_system, &mods_vma, address, 0x1000, 0);
|
||||
if (s != j6_status_ok)
|
||||
exit(s);
|
||||
|
||||
s = j6_vma_map(mods_vma, handle_self, address);
|
||||
if (s != j6_status_ok)
|
||||
exit(s);
|
||||
s = j6_vma_map(mods_vma, handle_self, address);
|
||||
if (s != j6_status_ok)
|
||||
exit(s);
|
||||
|
||||
return reinterpret_cast<modules_page*>(address);
|
||||
return reinterpret_cast<modules_page*>(address);
|
||||
}
|
||||
|
||||
void
|
||||
load_all(uintptr_t address)
|
||||
{
|
||||
module_framebuffer const *framebuffer = nullptr;
|
||||
module_framebuffer const *framebuffer = nullptr;
|
||||
|
||||
while (address) {
|
||||
const modules_page *page = load_page(address);
|
||||
while (address) {
|
||||
const modules_page *page = load_page(address);
|
||||
|
||||
char message[100];
|
||||
sprintf(message, "srv.init loading %d modules from page at 0x%lx", page->count, address);
|
||||
j6_system_log(message);
|
||||
char message[100];
|
||||
sprintf(message, "srv.init loading %d modules from page at 0x%lx", page->count, address);
|
||||
j6_system_log(message);
|
||||
|
||||
module *mod = page->modules;
|
||||
size_t count = page->count;
|
||||
while (count--) {
|
||||
switch (mod->mod_type) {
|
||||
case module_type::framebuffer:
|
||||
framebuffer = reinterpret_cast<const module_framebuffer*>(mod);
|
||||
break;
|
||||
module *mod = page->modules;
|
||||
size_t count = page->count;
|
||||
while (count--) {
|
||||
switch (mod->mod_type) {
|
||||
case module_type::framebuffer:
|
||||
framebuffer = reinterpret_cast<const module_framebuffer*>(mod);
|
||||
break;
|
||||
|
||||
case module_type::program:
|
||||
if (mod->mod_flags == module_flags::no_load)
|
||||
j6_system_log("Loaded program module");
|
||||
else
|
||||
j6_system_log("Non-loaded program module");
|
||||
break;
|
||||
case module_type::program:
|
||||
if (mod->mod_flags == module_flags::no_load)
|
||||
j6_system_log("Loaded program module");
|
||||
else
|
||||
j6_system_log("Non-loaded program module");
|
||||
break;
|
||||
|
||||
default:
|
||||
j6_system_log("Unknown module");
|
||||
}
|
||||
mod = offset_ptr<module>(mod, mod->mod_length);
|
||||
}
|
||||
default:
|
||||
j6_system_log("Unknown module");
|
||||
}
|
||||
mod = offset_ptr<module>(mod, mod->mod_length);
|
||||
}
|
||||
|
||||
address = page->next;
|
||||
}
|
||||
address = page->next;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace modules
|
||||
|
||||
Reference in New Issue
Block a user