<commit_before>## Porting AliOS

This document describes the required functions to port AliOS to a new
architecture.

#### void _kernelLock()

<commit_msg>documentation<commit_after>## Porting AliOS

This document describes the required functions to port AliOS to a new
architecture.

#### void _kernelLock()
This function is called to lock the kernel from within an interrupt context.

#### void _kernelUnlock()
This function is called to unlock the kernel from within an interrupt context.
This function must be able to unlock a kernelLock().

#### void kernelLock()
This function is called to lock the kernel. This function must be able to be
called from within an interrupt context.

#### void kernelUnlock()
This function is called to unlock the kernel. This function must be able to
unlock a _kernelLock().

#### void taskSetup(Task* task, void (*fx)(void*, void*), void* arg1, void* arg2)
This function does the architecture specific setup required for a task.  This
usually consists of settting up the initial stack.

#### unsigned long taskStackUsage(Task* task)
This function is required if TASK_STACK_USAGE is enabled.  This function must
return the number of bytes of stack that has been used by a task.  This
function is useful in properly setting the stack sizes of tasks.

#### void _taskEntry(Task* task)
This function is called by the kernel before a task is run for the first time.
Technically, the task is running but the kernel is just about call the task's
fx(arg) function.  Depending on the architecture, the kernel will start a
task with the kernel locked, and this callback can be used to unlock the
kernel.

{'fraction_non_alphanumeric': 0.06184935701163503, 'fraction_numerical': 0.001224739742804654, 'mean_word_length': 4.713286713286713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6453087', 'n_tokens_mistral': 409, 'n_tokens_neox': 401, 'n_words': 245}