[libj6] Move remaining j6 headers out of src/include

This means the kernel now depends on libj6. I've added the macro
definition __j6kernel when building for the kernel target, so I can
remove parts with #ifdefs.
This commit is contained in:
Justin C. Miller
2022-01-12 16:04:16 -08:00
parent 2ff7a0864b
commit 950360fddc
19 changed files with 31 additions and 14 deletions

View File

@@ -23,7 +23,8 @@ variables:
"-ggdb",
"-D__ELF__",
"-D__JSIX__",
"-D__jsix__",
"-D__j6kernel",
"-U__linux",
"-U__linux__",
"-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1",

View File

@@ -37,7 +37,7 @@ rule compile_asm
deps = gcc
rule parse_cog
command = $cog -o $out -d $cogflags $in
command = $cog -o $out -d -D target=$target $cogflags $in
description = Parsing $name
rule exe

View File

@@ -11,7 +11,7 @@ variables:
"-g",
"-D__ELF__",
"-D__JSIX__",
"-D__jsix__",
"-U__linux",
"-U__linux__",

View File

@@ -6,7 +6,7 @@ kernel = module("kernel",
output = "jsix.elf",
targets = [ "kernel" ],
description = "jsix kernel",
deps = [ "util", "cpu", "bootproto" ],
deps = [ "util", "cpu", "bootproto", "j6" ],
includes = [ "." ],
sources = [
"apic.cpp",

View File

@@ -2,7 +2,6 @@
#include <arch/memory.h>
#include <bootproto/kernel.h>
#include <j6/init.h>
#include <util/no_construct.h>
#include "assert.h"

View File

@@ -1,6 +1,5 @@
#include <stddef.h>
#include <j6/init.h>
#include <util/spinlock.h>
#include "apic.h"

View File

@@ -1,6 +1,10 @@
#pragma once
// vim: ft=cpp
// The kernel depends on libj6 for some shared code,
// but should not include the user-specific code.
#ifndef __j6kernel
#include <j6/types.h>
#ifdef __cplusplus
@@ -42,3 +46,5 @@ for id, scope, method in syscalls.methods:
#ifdef __cplusplus
}
#endif
#endif // __j6kernel

View File

@@ -1,3 +1,7 @@
// The kernel depends on libj6 for some shared code,
// but should not include the user-specific code.
#ifndef __j6kernel
#include <stdint.h>
#include <j6/init.h>
#include <j6/types.h>
@@ -39,3 +43,5 @@ _init_libj6(uint64_t *rsp)
}
}
}
#endif // __j6kernel

View File

@@ -5,10 +5,15 @@ j6 = module("j6",
includes = [ "include" ],
sources = [
"init.cpp",
"include/j6/syscalls.h.cog",
"syscalls.s.cog",
])
from glob import glob
definitions = glob('definitions/**/*.def', recursive=True)
j6.add_input("include/j6/syscalls.h.cog", deps=definitions)
j6.add_input("syscalls.s.cog", deps=definitions)
j6.add_depends([
"include/j6/syscalls.h.cog",
"syscalls.s.cog",
], definitions)

View File

@@ -27,6 +27,7 @@
; ctx.parse("syscalls.def")
; syscalls = ctx.interfaces['syscalls']
;
; if target != "kernel":
; for id, scope, method in syscalls.methods:
; if scope:
; name = f"{scope.name}_{method.name}"