Skip to content

Commit 4a273eb

Browse files
authored
Added hal address space interface (#102)
And moved hal to be a part of kernel instead of a library
1 parent e407733 commit 4a273eb

27 files changed

Lines changed: 94 additions & 228 deletions

File tree

src/example_dtree/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SETUP_EXECUTABLE(example_dtree)
22

3-
target_link_libraries(example_dtree PRIVATE device_tree_access Debug startup stdbigos)
3+
target_link_libraries(example_dtree PRIVATE dt_access Debug startup stdbigos)
44

55
ADD_QEMU_TARGET(example_dtree)

src/example_trap/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/example_trap/entry.c

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/example_umode_concurrency/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/example_umode_concurrency/entry.c

Lines changed: 0 additions & 119 deletions
This file was deleted.

src/kernel/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SETUP_EXECUTABLE(kernel)
22

33
target_compile_definitions(kernel PRIVATE $<IF:$<CONFIG:DEBUG>,__DEBUG__ __LOGLVL__=3, __LOGLVL__=1>)
4-
target_link_libraries(kernel PRIVATE Debug stdbigos hal)
4+
target_link_libraries(kernel PRIVATE Debug stdbigos dt_access)
55

66
target_link_options(kernel PRIVATE -static-pie -e kinit)
77

src/kernel/address_space/address_space.c

Whitespace-only changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#ifndef KERNEL_ADDRESS_SPACE_ADDRESS_SPACE
2+
#define KERNEL_ADDRESS_SPACE_ADDRESS_SPACE
3+
4+
#include "stdbigos/error.h"
5+
#include "stdbigos/types.h"
6+
7+
typedef enum : u16 {
8+
AS_FLAGS_READ = (1ull << 0),
9+
AS_FLAGS_WRITE = (1ull << 1),
10+
AS_FLAGS_EXECUTE = (1ull << 2),
11+
AS_FLAGS_MAPPED = (1ull << 3),
12+
AS_FLAGS_GLOBAL = (1ull << 4),
13+
AS_FLAGS_USER = (1ull << 5),
14+
} address_space_region_flags_t;
15+
16+
typedef struct {
17+
address_space_region_flags_t flags;
18+
void* addr;
19+
size_t size;
20+
} address_space_region_t;
21+
22+
typedef struct {
23+
address_space_region_t* regions;
24+
size_t regions_count;
25+
bool does_manage_own_memory;
26+
bool active;
27+
} address_space_t;
28+
29+
error_t address_space_init();
30+
31+
error_t address_space_init_from_buffer(address_space_region_t* regions, size_t count);
32+
33+
error_t address_space_delegate_memory_management(void** addrOUT);
34+
35+
#endif // !KERNEL_ADDRESS_SPACE_ADDRESS_SPACE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "hal/include/address_space.h"

0 commit comments

Comments
 (0)