Added header containing kernel typedefs for sandbox programs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
SANDBOX_DIR_LIST := $(sort $(dir $(wildcard ./*/.)))
|
||||
SANDBOX_DIR_LIST := $(filter-out ./include/,$(sort $(dir $(wildcard ./*/.))))
|
||||
|
||||
all:
|
||||
@for prog in $(SANDBOX_DIR_LIST); do \
|
||||
|
||||
8
sandbox/include/socks/types.h
Normal file
8
sandbox/include/socks/types.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef SOCKS_TYPES_H_
|
||||
#define SOCKS_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uintptr_t phys_addr_t;
|
||||
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <socks/types.h>
|
||||
|
||||
#define MEMBLOCK_INIT_MEMORY_REGION_COUNT 128
|
||||
#define MEMBLOCK_INIT_RESERVED_REGION_COUNT 128
|
||||
@@ -37,9 +37,9 @@ typedef enum memblock_region_status {
|
||||
|
||||
typedef struct memblock_region {
|
||||
/* the address of the first byte that makes up the region */
|
||||
uintptr_t base;
|
||||
phys_addr_t base;
|
||||
/* the address of the last byte that makes up the region */
|
||||
size_t limit;
|
||||
phys_addr_t limit;
|
||||
} memblock_region_t;
|
||||
|
||||
typedef struct memblock_type {
|
||||
@@ -56,21 +56,21 @@ typedef struct memblock {
|
||||
|
||||
typedef struct memblock_iter {
|
||||
memblock_index_t idx;
|
||||
uintptr_t base;
|
||||
size_t limit;
|
||||
phys_addr_t base;
|
||||
phys_addr_t limit;
|
||||
} memblock_iter_t;
|
||||
|
||||
extern memblock_t memblock;
|
||||
|
||||
extern int __next_mem_range(memblock_iter_t *it);
|
||||
|
||||
extern int memblock_add(uintptr_t base, size_t size);
|
||||
extern int memblock_reserve(uintptr_t base, size_t size);
|
||||
extern int memblock_add(phys_addr_t base, size_t size);
|
||||
extern int memblock_reserve(phys_addr_t base, size_t size);
|
||||
|
||||
extern uintptr_t memblock_alloc(size_t size);
|
||||
extern phys_addr_t memblock_alloc(size_t size);
|
||||
|
||||
extern void __next_memory_region(memblock_iter_t *it, \
|
||||
memblock_type_t *type_a, memblock_type_t *type_b,
|
||||
uintptr_t start, uintptr_t end);
|
||||
phys_addr_t start, phys_addr_t end);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@ BUILD_DIR := $(SANDBOX_BUILD_DIR)/$(SANDBOX_PROG_NAME)
|
||||
SRC := $(wildcard *.c)
|
||||
OBJ := $(addprefix $(BUILD_DIR)/,$(SRC:.c=.o))
|
||||
|
||||
CFLAGS := -g
|
||||
CFLAGS := -g "-I$(SANDBOX_BASE_DIR)/include"
|
||||
|
||||
$(BUILD_DIR)/$(SANDBOX_PROG_NAME): $(OBJ)
|
||||
@mkdir -p $(@D)
|
||||
|
||||
Reference in New Issue
Block a user