Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAL] Change Dk prefix to Pal #685

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Documentation/devel/new-syscall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ a |~| few new PAL calls to the existing interface.
To add a |~| new PAL call, first modify :file:`pal/include/pal/pal.h`. Define
the PAL call::

bool DkThreadSetCPUAffinity(size_t cpu_num, PAL_IDX* cpu_indexes);
bool PalThreadSetCPUAffinity(size_t cpu_num, PAL_IDX* cpu_indexes);

The naming convention of a |~| PAL call is to start functions with the ``Dk``
The naming convention of a |~| PAL call is to start functions with the ``Pal``
prefix, followed by a comprehensive name describing the purpose of the PAL
call.

Expand Down
10 changes: 5 additions & 5 deletions Documentation/devel/onboarding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,11 @@ system call that is not implemented in Gramine (recall that ``-38`` is the
``libos/src/bookkeep/shim_thread.c``.

- If the system call cannot be resolved entirely inside the LibOS component
of Gramine, and the current set of PAL API functions (``Dk..()`` functions)
is not enough to service this system call, you must add a new PAL API
function (e.g., ``DkSomeNewFunction``). You will need to implement the
entry-point function (``DkSomeNewFunction``) in the common PAL code, as
well as each host-specific function (``_DkSomeNewFunction``) in each
of Gramine, and the current set of PAL API functions (``Pal..()``
functions) is not enough to service this system call, you must add a new
PAL API function (e.g., ``PalSomeNewFunction``). You will need to implement
the entry-point function (``PalSomeNewFunction``) in the common PAL code,
as well as each host-specific function (``_PalSomeNewFunction``) in each
supported host in PAL.

Note that Gramine strives to keep the PAL API as small as possible. It is
Expand Down
2 changes: 1 addition & 1 deletion Documentation/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Glossary
Platform Adaptation Layer

PAL is the layer of Gramine that implements a narrow Drawbridge-like ABI
interface (with function names starting with the `Dk` prefix)
interface (with function names starting with the `Pal` prefix)

.. seealso::

Expand Down
102 changes: 51 additions & 51 deletions Documentation/pal/host-abi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ PAL public state

All PALs in Gramine expose a structure that provides static immutable
information about the current process and its host. The address of the
structure can be retrieved via :func:`DkGetPalPublicState()` and can be
structure can be retrieved via :func:`PalGetPalPublicState()` and can be
memorized in a global variable for ease of use.

.. doxygenstruct:: pal_public_state
Expand Down Expand Up @@ -105,18 +105,18 @@ on page-base virtual memory. Permissions include read, write, execute, and
guard. Memory regions can be unallocated, reserved, or backed by committed
memory.

.. doxygenfunction:: DkVirtualMemoryAlloc
.. doxygenfunction:: PalVirtualMemoryAlloc
:project: pal

.. doxygenfunction:: DkVirtualMemoryFree
.. doxygenfunction:: PalVirtualMemoryFree
:project: pal

.. doxygentypedef:: pal_alloc_flags_t
:project: pal
.. doxygentypedef:: pal_prot_flags_t
:project: pal

.. doxygenfunction:: DkVirtualMemoryProtect
.. doxygenfunction:: PalVirtualMemoryProtect
:project: pal


Expand All @@ -130,9 +130,9 @@ children. A parent can wait for a child to exit using its handle. Parent and
child may communicate through I/O streams provided by the parent to the child at
creation.

.. doxygenfunction:: DkProcessCreate
.. doxygenfunction:: PalProcessCreate
:project: pal
.. doxygenfunction:: DkProcessExit
.. doxygenfunction:: PalProcessExit
:project: pal


Expand All @@ -156,57 +156,57 @@ provide an ioctl call. Supported URI schemes include:
The latter four schemes are used to open inbound I/O streams for server
applications.

.. doxygenfunction:: DkStreamOpen
.. doxygenfunction:: PalStreamOpen
:project: pal

.. doxygenfunction:: DkStreamWaitForClient
.. doxygenfunction:: PalStreamWaitForClient
:project: pal

.. doxygenfunction:: DkStreamRead
.. doxygenfunction:: PalStreamRead
:project: pal

.. doxygenfunction:: DkStreamWrite
.. doxygenfunction:: PalStreamWrite
:project: pal

.. doxygenfunction:: DkStreamDelete
.. doxygenfunction:: PalStreamDelete
:project: pal

.. doxygenfunction:: DkStreamMap
.. doxygenfunction:: PalStreamMap
:project: pal

.. doxygenfunction:: DkStreamUnmap
.. doxygenfunction:: PalStreamUnmap
:project: pal

.. doxygenfunction:: DkStreamSetLength
.. doxygenfunction:: PalStreamSetLength
:project: pal

.. doxygenfunction:: DkStreamFlush
.. doxygenfunction:: PalStreamFlush
:project: pal

.. doxygenfunction:: DkSendHandle
.. doxygenfunction:: PalSendHandle
:project: pal

.. doxygenfunction:: DkReceiveHandle
.. doxygenfunction:: PalReceiveHandle
:project: pal

.. doxygenfunction:: DkStreamAttributesQuery
.. doxygenfunction:: PalStreamAttributesQuery
:project: pal

.. doxygentypedef:: PAL_STREAM_ATTR
:project: pal
.. doxygenstruct:: _PAL_STREAM_ATTR
:project: pal

.. doxygenfunction:: DkStreamAttributesQueryByHandle
.. doxygenfunction:: PalStreamAttributesQueryByHandle
:project: pal

.. doxygenfunction:: DkStreamAttributesSetByHandle
.. doxygenfunction:: PalStreamAttributesSetByHandle
:project: pal

.. doxygenfunction:: DkStreamGetName
.. doxygenfunction:: PalStreamGetName
:project: pal

.. doxygenfunction:: DkStreamChangeName
.. doxygenfunction:: PalStreamChangeName
:project: pal


Expand Down Expand Up @@ -247,25 +247,25 @@ Socket handling
.. doxygenstruct:: pal_iovec
:project: pal

.. doxygenfunction:: DkSocketCreate
.. doxygenfunction:: PalSocketCreate
:project: pal

.. doxygenfunction:: DkSocketBind
.. doxygenfunction:: PalSocketBind
:project: pal

.. doxygenfunction:: DkSocketListen
.. doxygenfunction:: PalSocketListen
:project: pal

.. doxygenfunction:: DkSocketAccept
.. doxygenfunction:: PalSocketAccept
:project: pal

.. doxygenfunction:: DkSocketConnect
.. doxygenfunction:: PalSocketConnect
:project: pal

.. doxygenfunction:: DkSocketSend
.. doxygenfunction:: PalSocketSend
:project: pal

.. doxygenfunction:: DkSocketRecv
.. doxygenfunction:: PalSocketRecv
:project: pal


Expand All @@ -276,16 +276,16 @@ The ABI supports multithreading through five calls to create, sleep, yield the
scheduler quantum for, resume execution of, and terminate threads, as well as
seven calls to create, signal, and block on synchronization objects.

.. doxygenfunction:: DkThreadCreate
.. doxygenfunction:: PalThreadCreate
:project: pal

.. doxygenfunction:: DkThreadYieldExecution
.. doxygenfunction:: PalThreadYieldExecution
:project: pal

.. doxygenfunction:: DkThreadExit
.. doxygenfunction:: PalThreadExit
:project: pal

.. doxygenfunction:: DkThreadResume
.. doxygenfunction:: PalThreadResume
:project: pal


Expand All @@ -304,32 +304,32 @@ Exception handling
.. doxygentypedef:: pal_event_handler_t
:project: pal

.. doxygenfunction:: DkSetExceptionHandler
.. doxygenfunction:: PalSetExceptionHandler
:project: pal


Synchronization
^^^^^^^^^^^^^^^

.. doxygenfunction:: DkEventCreate
.. doxygenfunction:: PalEventCreate
:project: pal

.. doxygenfunction:: DkEventSet
.. doxygenfunction:: PalEventSet
:project: pal

.. doxygenfunction:: DkEventClear
.. doxygenfunction:: PalEventClear
:project: pal

.. doxygenfunction:: DkEventWait
.. doxygenfunction:: PalEventWait
:project: pal

Objects
^^^^^^^

.. doxygenfunction:: DkStreamsWaitEvents
.. doxygenfunction:: PalStreamsWaitEvents
:project: pal

.. doxygenfunction:: DkObjectClose
.. doxygenfunction:: PalObjectClose
:project: pal

Miscellaneous
Expand All @@ -340,38 +340,38 @@ cryptographically-strong random bits, flush portions of instruction caches,
increment and decrement the reference counts on objects shared between threads,
and to obtain an attestation report and quote.

.. doxygenfunction:: DkDebugLog
.. doxygenfunction:: PalDebugLog
:project: pal

.. doxygenfunction:: DkGetPalPublicState
.. doxygenfunction:: PalGetPalPublicState
:project: pal

.. doxygenfunction:: DkSystemTimeQuery
.. doxygenfunction:: PalSystemTimeQuery
:project: pal

.. doxygenfunction:: DkRandomBitsRead
.. doxygenfunction:: PalRandomBitsRead
:project: pal

.. doxygenfunction:: DkSegmentBaseGet
.. doxygenfunction:: PalSegmentBaseGet
:project: pal

.. doxygenfunction:: DkSegmentBaseSet
.. doxygenfunction:: PalSegmentBaseSet
:project: pal

.. doxygenenum:: pal_segment_reg
:project: pal

.. doxygenfunction:: DkMemoryAvailableQuota
.. doxygenfunction:: PalMemoryAvailableQuota
:project: pal

.. doxygenfunction:: DkCpuIdRetrieve
.. doxygenfunction:: PalCpuIdRetrieve
:project: pal

.. doxygenfunction:: DkAttestationReport
.. doxygenfunction:: PalAttestationReport
:project: pal

.. doxygenfunction:: DkAttestationQuote
.. doxygenfunction:: PalAttestationQuote
:project: pal

.. doxygenfunction:: DkGetSpecialKey
.. doxygenfunction:: PalGetSpecialKey
:project: pal
6 changes: 3 additions & 3 deletions common/src/crypto/adapters/mbedtls_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "pal_error.h"

/* This is declared in pal_internal.h, but that can't be included here. */
int DkRandomBitsRead(void* buffer, size_t size);
int PalRandomBitsRead(void* buffer, size_t size);

static int mbedtls_to_pal_error(int error) {
switch (error) {
Expand Down Expand Up @@ -269,7 +269,7 @@ int mbedtls_hardware_poll(void* data, unsigned char* output, size_t len, size_t*
assert(output && olen);
*olen = 0;

int ret = DkRandomBitsRead(output, len);
int ret = PalRandomBitsRead(output, len);
if (ret < 0)
return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;

Expand Down Expand Up @@ -427,7 +427,7 @@ int lib_SSLSave(LIB_SSL_CONTEXT* ssl_ctx, uint8_t* buf, size_t buf_size, size_t*
* and expects a return value of 0 for success and nonzero for failure. */
static int random_wrapper(void* private, unsigned char* data, size_t size) {
__UNUSED(private);
return DkRandomBitsRead(data, size);
return PalRandomBitsRead(data, size);
}

int lib_DhInit(LIB_DH_CONTEXT* context) {
Expand Down
4 changes: 2 additions & 2 deletions libos/include/arch/x86_64/shim_tcb-arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct libos_xstate {
} while (0)

static inline void set_tls(uintptr_t tls) {
DkSegmentBaseSet(PAL_SEGMENT_FS, tls);
PalSegmentBaseSet(PAL_SEGMENT_FS, tls);
}

static inline void set_default_tls(void) {
Expand All @@ -152,6 +152,6 @@ static inline void set_default_tls(void) {

static inline uintptr_t get_tls(void) {
uintptr_t addr = 0;
(void)DkSegmentBaseGet(PAL_SEGMENT_FS, &addr);
(void)PalSegmentBaseGet(PAL_SEGMENT_FS, &addr);
return addr;
}
4 changes: 2 additions & 2 deletions libos/include/shim_checkpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ enum {
tmp = NEXT_CP_ENTRY(); \
if (!tmp) { \
log_error("cannot find checkpoint entry"); \
DkProcessExit(1); \
PalProcessExit(1); \
} \
tmp->cp_val; \
})
Expand Down Expand Up @@ -277,7 +277,7 @@ struct libos_cp_map_entry* get_cp_map_entry(void* map, void* addr, bool create);
struct libos_cp_map_entry* e = get_cp_map_entry(store->cp_map, obj, true); \
if (!e) { \
log_error("cannot extend checkpoint map buffer"); \
DkProcessExit(1); \
PalProcessExit(1); \
} \
e->off = (off); \
} while (0)
Expand Down
4 changes: 2 additions & 2 deletions libos/include/shim_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ struct libos_fs_ops {
* \param flags `mmap` flags (`MAP_*`).
* \param offset Offset in file.
*
* Maps the file at given address. This might involve mapping directly (`DkStreamMap`), or
* mapping anonymous memory (`DkVirtualMemoryAlloc`) and writing data.
* Maps the file at given address. This might involve mapping directly (`PalStreamMap`), or
* mapping anonymous memory (`PalVirtualMemoryAlloc`) and writing data.
*
* `addr`, `offset` and `size` must be alloc-aligned (see `IS_ALLOC_ALIGNED*` macros in
* `shim_internal.h`).
Expand Down
Loading