[Pal/Skeleton] Fix the build of Skeleton PAL

This commit is contained in:
Chia-Che Tsai
2019-09-10 14:55:25 -07:00
committed by Dmitrii Kuvaiskii
parent df2f8d2de7
commit 99ec09b2be
34 changed files with 302 additions and 278 deletions
+1
View File
@@ -16,6 +16,7 @@
*.s
*.e
*.d
pal.map
# object file/libraries
*.a
+4
View File
@@ -17,6 +17,10 @@ pipeline {
cd Pal/ipc/linux
make KERNELDIR=/lib/modules/4.4.0-161-generic/build
'''
sh '''
cd Pal/src
make -j 8 PAL_HOST=Skeleton WERROR=1
'''
}
}
stage('Test') {
+4
View File
@@ -9,6 +9,10 @@ pipeline {
make -j 8 DEBUG=1 WERROR=1
make -j 8 DEBUG=1 WERROR=1 test
'''
sh '''
cd Pal/src
make -j 8 PAL_HOST=Skeleton DEBUG=1 WERROR=1
'''
}
}
stage('Test') {
+12 -2
View File
@@ -93,7 +93,7 @@ quiet_cmd_cpp_s_S = [ $@ ]
# LD
quiet_cmd_ld_so_o = [ $@ ]
cmd_ld_so_o = $(LD) $(LDFLAGS) $(LDFLAGS-$@) -o $@ $(filter-out %.map %.lds,$^) -soname $(notdir $@)
cmd_ld_so_o = $(LD) $(LDFLAGS) $(LDFLAGS-$@) -o $@ $(filter-out pal-symbols %.map %.map.template %.lds,$^) -soname $(notdir $@)
# AR
quiet_cmd_ar_so_o = [ $@ ]
@@ -104,7 +104,7 @@ quiet_cmd_ar_a_o = [ $@ ]
# LD only
quiet_cmd_ld = [ $@ ]
cmd_ld = $(LD) $(LDFLAGS) $(LDFLAGS-$@) -o $@ $(filter-out %.map %.lds,$^)
cmd_ld = $(LD) $(LDFLAGS) $(LDFLAGS-$@) -o $@ $(filter-out pal-symbols %.map %.map.template %.lds,$^)
# OBJCOPY
quiet_cmd_objcopy = [ $@ ]
@@ -142,3 +142,13 @@ quiet_cmd_sgx_manifest_dependency = [ $@ ]
awk -F= '/^\s*sgx.trusted_files./{file=$$2; gsub("file:", "", file); printf(" \\\n\t%s", file)}' $<; \
awk -F= '/^\s*sgx.trusted_children./{file=$$2; gsub("file:", "", file); printf(" \\\n\t%s", file); gsub(".sig", "", file); printf(" \\\n\t%s.manifest.sgx", file)}' $<; \
echo "") > $@
# pal map
PAL_SYMBOL_FILE = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))Pal/src/pal-symbols
PAL_SYMBOLS = $(shell sed -e 's|$$|;|g' $(PAL_SYMBOL_FILE))
quiet_cmd_pal_map = [ $@ ]
cmd_pal_map = sed -e 's|\$$(PAL_SYMBOLS)|$(PAL_SYMBOLS)|g' $< > $@
pal.map: pal.map.template $(PAL_SYMBOL_FILE)
$(call cmd,pal_map)
+5 -1
View File
@@ -59,7 +59,9 @@ export DEBUG
# libpal-{Host Name}.so: dynamic-linking library
# pal_gdb-{Host Name}: debugger for PAL (as an executable)
runtime_loader = $(RUNTIME_DIR)/pal-$(PAL_HOST)
ifneq ($(pal_loader),)
runtime_loader += $(RUNTIME_DIR)/pal-$(PAL_HOST)
endif
ifneq ($(pal_lib),)
runtime_lib += $(RUNTIME_DIR)/libpal-$(PAL_HOST)$(suffix $(pal_lib))
@@ -99,8 +101,10 @@ $(host_lib): host_lib_recurse
$(pal_loader): $(host_lib)
ifneq ($(pal_loader),)
$(runtime_loader): $(pal_loader)
$(call cmd,ln_sf)
endif
ifneq ($(pal_lib),)
$(pal_lib): $(addprefix $(OBJ_DIR)/,$(addsuffix .o,$(objs))) \
+4 -4
View File
@@ -5,7 +5,7 @@ CFLAGS += -I. -Iinclude -I../.. -I../../../include -I../../../lib -I../../../ipc
-I../../../linux-kernel/graphene
ASFLAGS += -I. -Iinclude -I../.. -I../../../include
host_target = libpal-FreeBSD.a ../../pal-gdb
host_files = libpal-FreeBSD.a pal.map ../../pal-gdb
defs = -DIN_PAL -DPAL_DIR="$(PAL_DIR)"
CFLAGS += $(defs)
@@ -17,7 +17,7 @@ graphene_lib = .lib/graphene-lib.a
headers = $(wildcard *.h) $(wildcard ../../*.h) $(wildcard ../../../lib/*.h)
.PHONY: all
all: $(host_target)
all: $(host_files)
ifeq ($(DEBUG),1)
CC += -g -gdwarf-2 -gstrict-dwarf
@@ -50,8 +50,8 @@ libpal-FreeBSD.a: $(addsuffix .o,$(objs)) $(graphene_lib)
include ../../../../Makefile.rules
CLEAN_FILES += $(notdir $(pal_static) $(pal_lib) $(pal_loader))
CLEAN_FILES += $(notdir $(pal_static) $(pal_lib) $(pal_sec) $(pal_loader))
.PHONY: clean
clean:
rm -f $(addsuffix .o,$(objs)) $(host_target) $(CLEAN_FILES)
rm -f $(addsuffix .o,$(objs)) $(host_files) $(CLEAN_FILES)
+1 -1
View File
@@ -16,6 +16,6 @@ endif
pal_loader = $(HOST_DIR)/libpal.so
pal_lib = $(HOST_DIR)/libpal.so
pal_lib_deps = $(HOST_DIR)/pal.map $(HOST_DIR)/pal.lds
pal_lib_deps = pal-symbols $(HOST_DIR)/pal.map.template $(HOST_DIR)/pal.lds
pal_lib_post =
pal_static = $(HOST_DIR)/libpal.a
-54
View File
@@ -1,54 +0,0 @@
PAL {
global:
# Drawbridge ABIs
DkVirtualMemoryAlloc; DkVirtualMemoryFree; DkVirtualMemoryProtect;
DkThreadCreate; DkThreadDelayExecution;
DkThreadYieldExecution; DkThreadExit; DkThreadResume;
DkSemaphoreCreate; DkNotificationEventCreate;
DkSynchronizationEventCreate;
DkSemaphoreRelease;
DkEventSet; DkEventClear;
DkObjectsWaitAny;
DkStreamOpen; DkStreamRead; DkStreamWrite;
DkStreamMap; DkStreamUnmap; DkStreamSetLength;
DkStreamFlush; DkStreamDelete;
DkSendHandle; DkReceiveHandle; # Added by us
DkStreamWaitForClient;
DkStreamGetName;
DkStreamAttributesQueryByHandle; DkStreamAttributesQuery;
DkProcessCreate; DkProcessExit;
DkSystemTimeQuery; DkRandomBitsRead;
DkInstructionCacheFlush;
DkObjectReference; DkObjectClose;
# objects checkpoint?
# objects reload?
# The ABIs we added in the paper
DkSetExceptionHandler; DkExceptionReturn; # exceptions
DkCreatePhysicalMemoryChannel; # IPC
DkPhysicalMemoryCommit; # IPC
DkPhysicalMemoryMap; # IPC
DkSegmentRegister; # set segmentation registers
DkStreamChangeName;
DkStreamAttributesSetByHandle;
DkMemoryAvailableQuota;
# Debugging ABIs
pal_printf; DkDebugAttachBinary; DkDebugDetachBinary;
# Control block
pal_control_addr; pal_sec;
# debugger interface
r_debug;
local: *;
};
PAL_PRIVATE {
global:
r_debug_state;
};
+8
View File
@@ -0,0 +1,8 @@
PAL {
global: $(PAL_SYMBOLS) r_debug;
local: *;
};
PAL_PRIVATE {
global:
r_debug_state;
};
+1 -1
View File
@@ -4,7 +4,7 @@ include Makefile.am
CFLAGS += -I. -Iinclude -I../.. -I../../../include -I../../../lib -Isgx-driver
ASFLAGS += -I. -I../.. -I../../../include
host_files = libpal-Linux-SGX.a pal-sgx debugger/sgx_gdb.so generated_offsets.py
host_files = libpal-Linux-SGX.a pal-sgx debugger/sgx_gdb.so pal.map generated_offsets.py
defs = -DIN_PAL -DPAL_DIR=$(PAL_DIR) -DRUNTIME_DIR=$(RUNTIME_DIR)
CFLAGS += $(defs)
+1 -1
View File
@@ -25,7 +25,7 @@ endif
pal_loader = $(HOST_DIR)/pal-sgx
pal_lib = $(HOST_DIR)/libpal.so
pal_lib_deps = $(HOST_DIR)/enclave.lds $(HOST_DIR)/pal.map
pal_lib_deps = pal-symbols $(HOST_DIR)/pal.map.template $(HOST_DIR)/enclave.lds
pal_static = $(HOST_DIR)/libpal.a
pal_gdb = $(HOST_DIR)/debugger/gdb
pal_signer = pal-sgx-get-token pal-sgx-sign aesm_pb2.py
-51
View File
@@ -1,51 +0,0 @@
PAL {
global:
# Drawbridge ABIs
DkVirtualMemoryAlloc; DkVirtualMemoryFree; DkVirtualMemoryProtect;
DkThreadCreate; DkThreadDelayExecution;
DkThreadYieldExecution; DkThreadExit; DkThreadResume;
DkMutexCreate; DkNotificationEventCreate;
DkSynchronizationEventCreate;
DkMutexRelease;
DkEventSet; DkEventClear;
DkObjectsWaitAny;
DkStreamOpen; DkStreamRead; DkStreamWrite;
DkStreamMap; DkStreamUnmap; DkStreamSetLength;
DkStreamFlush; DkStreamDelete;
DkSendHandle; DkReceiveHandle; # Added by us
DkStreamWaitForClient;
DkStreamGetName;
DkStreamAttributesQueryByHandle; DkStreamAttributesQuery;
DkProcessCreate; DkProcessExit;
DkSystemTimeQuery; DkRandomBitsRead;
DkInstructionCacheFlush;
DkObjectReference; DkObjectClose;
# objects checkpoint?
# objects reload?
# The ABIs we added in the paper
DkSetExceptionHandler; DkExceptionReturn; # exceptions
DkCreatePhysicalMemoryChannel; # IPC
DkPhysicalMemoryCommit; # IPC
DkPhysicalMemoryMap; # IPC
DkThreadStackSet; # set stack range
DkThreadPrivateSet; DkThreadPrivateGet; # set/get thread private area
DkThreadGetCurrent; # get a handle to describe the current thread
DkStreamChangeName;
DkStreamAttributesSetByHandle;
DkSegmentRegister; # set segment register
DkMemoryAvailableQuota;
DkCpuIdRetrieve; # retrieve CPUID
# Debugging ABIs
pal_printf; pal_snprintf; DkDebugAttachBinary; DkDebugDetachBinary;
# Control block
pal_control; pal_control_addr;
local: *;
};
+4
View File
@@ -0,0 +1,4 @@
PAL {
global: $(PAL_SYMBOLS)
local: *;
};
+2 -2
View File
@@ -10,7 +10,7 @@ ifeq ($(PROFILING),1)
CFLAGS += -DPROFILING=1
endif
host_files = libpal-Linux.a
host_files = libpal-Linux.a pal.map
defs = -DIN_PAL -DPAL_DIR=$(PAL_DIR) -DRUNTIME_DIR=$(RUNTIME_DIR)
CFLAGS += $(defs)
@@ -51,7 +51,7 @@ include ../../../../Makefile.rules
-include $(addsuffix .d,$(objs)) $(addsuffix .i.d,$(objs)) $(addsuffix .s.d,$(objs))
CLEAN_FILES += $(notdir $(pal_static) $(pal_lib) $(pal_loader))
CLEAN_FILES += $(notdir $(pal_static) $(pal_lib) $(pal_sec) $(pal_loader))
.PHONY: clean
clean:
+1 -1
View File
@@ -22,7 +22,7 @@ endif
pal_loader = $(HOST_DIR)/libpal.so
pal_lib = $(HOST_DIR)/libpal.so
pal_lib_deps = $(HOST_DIR)/pal.map $(HOST_DIR)/pal.lds
pal_lib_deps = pal-symbols $(HOST_DIR)/pal.map.template $(HOST_DIR)/pal.lds
pal_lib_post =
pal_static = $(HOST_DIR)/libpal.a
pal_gdb =
-55
View File
@@ -1,55 +0,0 @@
PAL {
global:
# Drawbridge ABIs
DkVirtualMemoryAlloc; DkVirtualMemoryFree; DkVirtualMemoryProtect;
DkThreadCreate; DkThreadDelayExecution;
DkThreadYieldExecution; DkThreadExit; DkThreadResume;
DkMutexCreate; DkNotificationEventCreate;
DkSynchronizationEventCreate;
DkMutexRelease;
DkEventSet; DkEventClear;
DkObjectsWaitAny;
DkStreamOpen; DkStreamRead; DkStreamWrite;
DkStreamMap; DkStreamUnmap; DkStreamSetLength;
DkStreamFlush; DkStreamDelete;
DkSendHandle; DkReceiveHandle; # Added by us
DkStreamWaitForClient;
DkStreamGetName;
DkStreamAttributesQueryByHandle; DkStreamAttributesQuery;
DkProcessCreate; DkProcessExit;
DkSystemTimeQuery; DkRandomBitsRead;
DkInstructionCacheFlush;
DkCpuIdRetrieve;
DkObjectClose;
# objects checkpoint?
# objects reload?
# The ABIs we added in the paper
DkSetExceptionHandler; DkExceptionReturn; # exceptions
DkCreatePhysicalMemoryChannel; # IPC
DkPhysicalMemoryCommit; # IPC
DkPhysicalMemoryMap; # IPC
DkSegmentRegister; # set segmentation registers
DkStreamChangeName;
DkStreamAttributesSetByHandle;
DkMemoryAvailableQuota;
# Debugging ABIs
pal_printf; DkDebugAttachBinary; DkDebugDetachBinary;
# Control block
pal_control_addr; pal_sec;
# debugger
_r_debug;
local: *;
};
PAL_PRIVATE {
global:
_dl_debug_state;
};
+9
View File
@@ -0,0 +1,9 @@
PAL {
global: $(PAL_SYMBOLS) _r_debug;
local: *;
};
PAL_PRIVATE {
global:
_dl_debug_state;
};
+5 -6
View File
@@ -4,18 +4,17 @@ include Makefile.am
CFLAGS += -I. -I../.. -I../../../include -I../../../lib
ASFLAGS += -I. -I../.. -I../../../include
host_target = libpal-Skeleton.a
host_files = libpal-Skeleton.a pal.map
defs = -DIN_PAL
CFLAGS += $(defs)
ASFLAGS += $(defs)
objs = $(addprefix db_,files devices pipes sockets streams memory threading \
semaphore events process object main rtld misc ipc exception)
graphene_lib = ../../../lib/graphene-lib.a
mutex events process object main rtld misc ipc exception)
headers = $(wildcard *.h) $(wildcard ../../*.h) $(wildcard ../../../lib/*.h)
.PHONY: all
all: $(host_target)
all: $(host_files)
ifeq ($(DEBUG),1)
CC += -gdwarf-2 -g3
@@ -26,7 +25,7 @@ endif
../../host_endian.h: host_endian.h
$(MAKE) -C ../../ $<
libpal-Skeleton.a: $(addsuffix .o,$(objs)) $(graphene_lib)
libpal-Skeleton.a: $(addsuffix .o,$(objs))
$(call cmd,ar_a_o)
%.o: %.c $(headers)
@@ -39,4 +38,4 @@ include ../../../../Makefile.rules
.PHONY: clean
clean:
rm -f $(addsuffix .o,$(objs)) $(host_target)
rm -f $(addsuffix .o,$(objs)) $(host_files)
+19 -2
View File
@@ -1,9 +1,26 @@
# Add host-specific compilation rules here
CFLAGS = -Wall -fPIC -O2 -std=gnu99 -fgnu89-inline -Wall -U_FORTIFY_SOURCE -fno-builtin
ASFLAGS = -DPIC -DSHARED -fPIC -DASSEMBLER -Wa,--noexecstack -x assembler-with-cpp
CFLAGS = -Wall -fPIC -O2 -std=c11 -U_FORTIFY_SOURCE \
-fno-stack-protector -fno-builtin
EXTRAFLAGS = -Wextra -Wno-unused-parameter -Wno-sign-compare $(call cc-option,-Wnull-dereference)
CFLAGS += $(EXTRAFLAGS)
ASFLAGS = -DPIC -DSHARED -fPIC -DASSEMBLER -Wa,--noexecstack \
-x assembler-with-cpp
LDFLAGS = -shared -nostdlib -z combreloc -z defs \
--version-script $(HOST_DIR)/pal.map -T $(HOST_DIR)/pal.lds
ARFLAGS =
ifeq ($(WERROR),1)
CFLAGS += -Werror
endif
pal_loader =
pal_sec =
pal_lib = $(HOST_DIR)/libpal.so
pal_lib_deps = pal-symbols $(HOST_DIR)/pal.map.template $(HOST_DIR)/pal.lds
pal_lib_post =
pal_static =
pal_gdb =
+1 -1
View File
@@ -204,7 +204,7 @@ static int dev_attrquery (const char * type, const char * uri,
PAL_STREAM_ATTR * attr)
{
struct handle_ops * ops = NULL;
const char * dev_type = NULL;
char * dev_type = NULL;
int ret = 0;
ret = parse_device_uri(&uri, &dev_type, &ops);
+16 -1
View File
@@ -41,7 +41,7 @@ int _DkEventSet (PAL_HANDLE event, int wakeup)
return -PAL_ERROR_NOTIMPLEMENTED;
}
int _DkEventWaitTimeout (PAL_HANDLE event, uint64_t timeout)
int _DkEventWaitTimeout (PAL_HANDLE event, int64_t timeout_us)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
@@ -55,3 +55,18 @@ int _DkEventClear (PAL_HANDLE event)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int event_close (PAL_HANDLE handle)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int event_wait (PAL_HANDLE handle, int64_t timeout_us)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
struct handle_ops event_ops = {
.close = &event_close,
.wait = &event_wait,
};
+2 -2
View File
@@ -102,7 +102,7 @@ static int file_rename (PAL_HANDLE handle, const char * type,
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int file_getname (PAL_HANDLE handle, char * buffer, int count)
static int file_getname (PAL_HANDLE handle, char * buffer, size_t count)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
@@ -169,7 +169,7 @@ static int dir_rename (PAL_HANDLE handle, const char * type,
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int dir_getname (PAL_HANDLE handle, char * buffer, int count)
static int dir_getname (PAL_HANDLE handle, char * buffer, size_t count)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
+2 -1
View File
@@ -60,7 +60,8 @@ PAL_NUM _DkGetHostId (void)
return 0;
}
void _DkGetCPUInfo (PAL_CPU_INFO * ci)
int _DkGetCPUInfo (PAL_CPU_INFO * ci)
{
/* need to be implemented */
return 0;
}
+7 -1
View File
@@ -41,7 +41,7 @@ unsigned long _DkSystemTimeQuery (void)
return 0;
}
int _DkRandomBitsRead (void * buffer, int size)
size_t _DkRandomBitsRead (void * buffer, size_t size)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
@@ -60,3 +60,9 @@ int _DkInstructionCacheFlush (const void * addr, int size)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
int _DkCpuIdRetrieve (unsigned int leaf, unsigned int subleaf,
unsigned int values[4])
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
@@ -15,9 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/*
* db_semaphore.c
*
* This file contains APIs that provides operations of semaphores.
* db_mutex.c
*/
#include "api.h"
@@ -26,26 +24,42 @@
#include "pal_error.h"
#include "pal_internal.h"
int _DkSemaphoreCreate(PAL_HANDLE handle, int initialCount, int maxCount) {
int
_DkMutexCreate (PAL_HANDLE * handle, int initialCount)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
void _DkSemaphoreDestroy(PAL_HANDLE semaphoreHandle) {
/* need to be implemented */
}
int _DkSemaphoreAcquire(PAL_HANDLE sem, int count) {
int _DkMutexLockTimeout (struct mutex_handle * m, int64_t timeout_us)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
int _DkSemaphoreAcquireTimeout(PAL_HANDLE sem, int count, int timeout) {
int _DkMutexLock (struct mutex_handle * m)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
void _DkSemaphoreRelease(PAL_HANDLE sem, int count) {
/* need to be implemented */
}
int _DkSemaphoreGetCurrentCount(PAL_HANDLE sem) {
int _DkMutexAcquireTimeout (PAL_HANDLE handle, int64_t timeout_us)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
int _DkMutexUnlock (struct mutex_handle * m)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
void _DkMutexRelease (PAL_HANDLE handle)
{
/* Not implemented yet */
}
static int mutex_wait (PAL_HANDLE handle, int64_t timeout_us)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
struct handle_ops mutex_ops = {
.wait = &mutex_wait,
};
+1 -1
View File
@@ -29,6 +29,6 @@
/* _DkObjectsWaitAny for internal use. The function wait for any of the handle
in the handle array. timeout can be set for the wait. */
int _DkObjectsWaitAny(int count, PAL_HANDLE* handleArray, uint64_t timeout, PAL_HANDLE* polled) {
int _DkObjectsWaitAny(int count, PAL_HANDLE* handleArray, int64_t timeout_us, PAL_HANDLE* polled) {
return -PAL_ERROR_NOTIMPLEMENTED;
}
+1 -1
View File
@@ -109,7 +109,7 @@ static int pipe_delete (PAL_HANDLE handle, int access)
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int pipe_getname (PAL_HANDLE handle, char * buffer, int count)
static int pipe_getname (PAL_HANDLE handle, char * buffer, size_t count)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
+4 -3
View File
@@ -32,15 +32,16 @@
#include "pal_error.h"
#include "api.h"
int _DkProcessCreate (PAL_HANDLE * handle, const char * uri,
int flags, const char ** args)
int _DkProcessCreate (PAL_HANDLE * handle, const char * uri, const char ** args)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
noreturn void _DkProcessExit (int exitcode)
{
/* need to be implemented */
while (true) {
/* nothing */;
}
}
static int64_t proc_read (PAL_HANDLE handle, uint64_t offset, uint64_t count,
+11 -11
View File
@@ -54,7 +54,7 @@ static int tcp_connect (PAL_HANDLE * handle, char * uri, int create)
static int tcp_open (PAL_HANDLE *handle, const char * type, const char * uri,
int access, int share, int create, int options)
{
int uri_len = strlen(uri) + 1;
size_t uri_len = strlen(uri) + 1;
if (uri_len > PAL_SOCKADDR_SIZE)
return -PAL_ERROR_TOOLONG;
@@ -72,13 +72,13 @@ static int tcp_open (PAL_HANDLE *handle, const char * type, const char * uri,
}
/* 'read' operation of tcp stream */
static int64_t tcp_read (PAL_HANDLE handle, uint64_t offset, uint64_t len, void * buf)
static int64_t tcp_read (PAL_HANDLE handle, uint64_t offset, size_t len, void * buf)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
/* write' operation of tcp stream */
static int64_t tcp_write (PAL_HANDLE handle, uint64_t offset, uint64_t len, const void * buf)
static int64_t tcp_write (PAL_HANDLE handle, uint64_t offset, size_t len, const void * buf)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
@@ -99,7 +99,7 @@ static int udp_open (PAL_HANDLE *hdl, const char * type, const char * uri,
int access, int share, int create, int options)
{
char buf[PAL_SOCKADDR_SIZE];
int len = strlen(uri);
size_t len = strlen(uri);
if (len >= PAL_SOCKADDR_SIZE)
return -PAL_ERROR_TOOLONG;
@@ -115,24 +115,24 @@ static int udp_open (PAL_HANDLE *hdl, const char * type, const char * uri,
return -PAL_ERROR_NOTSUPPORT;
}
static int64_t udp_receive (PAL_HANDLE handle, uint64_t offset, uint64_t len, void * buf)
static int64_t udp_receive (PAL_HANDLE handle, uint64_t offset, size_t len, void * buf)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int64_t udp_receivebyaddr (PAL_HANDLE handle, uint64_t offset, uint64_t len,
void * buf, char * addr, int addrlen)
static int64_t udp_receivebyaddr (PAL_HANDLE handle, uint64_t offset, size_t len,
void * buf, char * addr, size_t addrlen)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int64_t udp_send (PAL_HANDLE handle, uint64_t offset, uint64_t len, const void * buf)
static int64_t udp_send (PAL_HANDLE handle, uint64_t offset, size_t len, const void * buf)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int64_t udp_sendbyaddr (PAL_HANDLE handle, uint64_t offset, uint64_t len,
const void * buf, const char * addr, int addrlen)
static int64_t udp_sendbyaddr (PAL_HANDLE handle, uint64_t offset, size_t len,
const void * buf, const char * addr, size_t addrlen)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
@@ -152,7 +152,7 @@ static int socket_attrquerybyhdl (PAL_HANDLE handle, PAL_STREAM_ATTR * attr)
return -PAL_ERROR_NOTIMPLEMENTED;
}
static int socket_getname (PAL_HANDLE handle, char * buffer, int count)
static int socket_getname (PAL_HANDLE handle, char * buffer, size_t count)
{
return -PAL_ERROR_NOTIMPLEMENTED;
}
+82
View File
@@ -0,0 +1,82 @@
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(pal_start);
SECTIONS
{
/* Read-only sections, merged into text segment; */
__text_start = .;
. = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rela.dyn :
{
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
*(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
*(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
*(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
*(.rela.ifunc)
}
.rela.plt :
{
*(.rela.plt)
*(.rela.iplt)
}
.init : { *(.init) }
.plt : { *(.plt) *(.iplt) }
.text :
{
/* the rest of text segments */
*(.text .stub .text.*);
}
.fini : { *(.fini) }
.rodata :
{
/* the rest of rodata */
*(.rodata .rodata.*)
}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { *(.eh_frame) }
__text_end = .;
/* now adjust the address for the data segment */
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
__data_start = .;
.eh_frame : ONLY_IF_RW { *(.eh_frame) }
.data.rel.ro : { *(.data.rel.ro) }
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
.jcr : { *(.jcr) }
.dynamic : { *(.dynamic) }
.got : { *(.got) *(.igot) }
.got.plt : { *(.got.plt) *(.igot.plt) }
.data :
{
/* the rest of data segment */
*(.data .data.*);
}
.bss :
{
*(.bss .bss.*)
*(COMMON)
}
. = DATA_SEGMENT_END(.);
__data_end = .;
}
-54
View File
@@ -1,54 +0,0 @@
PAL {
global:
# Drawbridge ABIs
DkVirtualMemoryAlloc; DkVirtualMemoryFree; DkVirtualMemoryProtect;
DkThreadCreate; DkThreadDelayExecution;
DkThreadYieldExecution; DkThreadExit; DkThreadResume;
DkSemaphoreCreate; DkNotificationEventCreate;
DkSynchronizationEventCreate;
DkSemaphoreRelease;
DkEventSet; DkEventClear;
DkObjectsWaitAny;
DkStreamOpen; DkStreamRead; DkStreamWrite;
DkStreamMap; DkStreamUnmap; DkStreamSetLength;
DkStreamFlush; DkStreamDelete;
DkSendHandle; DkReceiveHandle; # Added by us
DkStreamWaitForClient;
DkStreamGetName;
DkStreamAttributesQueryByHandle; DkStreamAttributesQuery;
DkProcessCreate; DkProcessExit;
DkSystemTimeQuery; DkRandomBitsRead;
DkInstructionCacheFlush;
DkObjectReference; DkObjectClose;
# objects checkpoint?
# objects reload?
# The ABIs we added in the paper
DkSetExceptionHandler; DkExceptionReturn; # exceptions
DkCreatePhysicalMemoryChannel; # IPC
DkPhysicalMemoryCommit; # IPC
DkPhysicalMemoryMap; # IPC
DkSegmentRegister; # set segmentation registers
DkStreamChangeName;
DkStreamAttributesSetByHandle;
DkMemoryAvailableQuota;
# Debugging ABIs
pal_printf; DkDebugAttachBinary; DkDebugDetachBinary;
# Control block
pal_control_addr; pal_sec;
# debugger interface
_r_debug;
local: *;
};
PAL_PRIVATE {
global:
_dl_debug_state;
};
+4
View File
@@ -0,0 +1,4 @@
PAL {
global: $(PAL_SYMBOLS)
local: *;
};
+11 -6
View File
@@ -27,8 +27,13 @@
# error "cannot be included outside PAL"
#endif
typedef int PAL_LOCK;
#define LOCK_INIT 0
typedef struct mutex_handle {
int unused;
} PAL_LOCK;
#define LOCK_INIT {}
#define INIT_LOCK(lock) do {} while (0)
#define MAX_FDS 3
typedef struct pal_handle
@@ -79,20 +84,20 @@ typedef struct pal_handle
} sock;
struct {
PAL_IDX fd;
PAL_IDX unused;
} process;
struct {
PAL_IDX fd;
PAL_IDX unused;
} mcast;
struct {
PAL_IDX fd;
PAL_IDX unused;
} thread;
struct {
PAL_IDX fd;
} semaphore;
} mutex;
struct {
PAL_IDX fd;
+50
View File
@@ -0,0 +1,50 @@
DkVirtualMemoryAlloc
DkVirtualMemoryFree
DkVirtualMemoryProtect
DkThreadCreate
DkThreadDelayExecution
DkThreadYieldExecution
DkThreadExit
DkThreadResume
DkMutexCreate
DkNotificationEventCreate
DkSynchronizationEventCreate
DkMutexRelease
DkEventSet
DkEventClear
DkObjectsWaitAny
DkStreamOpen
DkStreamRead
DkStreamWrite
DkStreamMap
DkStreamUnmap
DkStreamSetLength
DkStreamFlush
DkStreamDelete
DkSendHandle
DkReceiveHandle
DkStreamWaitForClient
DkStreamGetName
DkStreamAttributesQueryByHandle
DkStreamAttributesQuery
DkProcessCreate
DkProcessExit
DkProcessSandboxCreate
DkSystemTimeQuery
DkRandomBitsRead
DkInstructionCacheFlush
DkCpuIdRetrieve
DkObjectClose
DkSetExceptionHandler
DkExceptionReturn
DkCreatePhysicalMemoryChannel
DkPhysicalMemoryCommit
DkPhysicalMemoryMap
DkSegmentRegister
DkStreamChangeName
DkStreamAttributesSetByHandle
DkMemoryAvailableQuota
DkDebugAttachBinary
DkDebugDetachBinary
pal_printf
pal_control_addr