From 4582df89461fc8ffb5cb2c53d242a0729fc36130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kyle=20J=C2=A0Cardoza?= Date: Tue, 9 Jul 2024 11:49:08 -0400 Subject: [PATCH] Documentation of kernel API --- doc/syscalls.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/doc/syscalls.md b/doc/syscalls.md index eb761bd..63c0009 100644 --- a/doc/syscalls.md +++ b/doc/syscalls.md @@ -486,4 +486,53 @@ any device alias, or if the `alias` argument value is already in use as a device alias. On success, `C` will contain `STATUS_OK`. On error, `C` will contain -a negative value which indicates the specific error type. \ No newline at end of file +a negative value which indicates the specific error type. + +## `0x1A`: Get Environment Variable + +Arguments: + - `C`: `0x1A` + - `X`: Bank of argument structure + - `Y`: Address of argument structure + +Return Values: + - `C`: Status code + +Argument Structure: + +``` + struct { + char *name; // The name of the variable to read + char *value; // Buffer for the value of the variable + }; +``` + +This call gets the value of an environment variable specified by the +`name` field of the argument structure, and copies it into the buffer +pointed to by the `value` field. If the variable is not set, the value +will be set to `NULL`, and the status code will be `ERR_ENV_UNSET`; otherwise +the status code will be `STATUS_OK`. + +## `0x1B`: Set Environment Variable + +Arguments: + - `C`: `0x1A` + - `X`: Bank of argument structure + - `Y`: Address of argument structure + +Return Values: + - `C`: Status code + +Argument Structure: + +``` + struct { + char *name; // The name of the variable to set + char *value; // Buffer for the new value of the variable + }; +``` + +This call sets the value of an environment variable specified by the +`name` field of the argument structure by copying the string pointed +to by the `value` field. To unset a variable, pass `NULL` in the `value` +field. This call always returns `STATUS_OK`. \ No newline at end of file