This commit is contained in:
2025-09-27 15:16:26 +02:00
parent 5af7c5276a
commit 3b1bb9d531
63 changed files with 1087 additions and 407 deletions

View File

@ -2,10 +2,13 @@
#include <stddef.h>
#include <system/system.h>
#include <sysdefs/processctl.h>
#include <sysdefs/devctl.h>
#include <errors.h>
#include <dlmalloc/malloc.h>
#include <uprintf.h>
#include <log.h>
#include <util/util.h>
#include <devids.h>
extern void main(void);
extern uint8_t _bss_start[];
@ -18,24 +21,28 @@ void clearbss(void) {
}
}
char **_args;
#define MAX_ARGS 15
static char *_args[MAX_ARGS];
size_t _argslen;
char **args(void) {
return _args;
return (char **)_args;
}
size_t argslen(void) {
return _argslen;
}
Dev_t termdev;
// ulib initialization goes here
void _premain(void) {
clearbss();
#define MAX_ARGS 30
_args = (char **)dlmalloc(MAX_ARGS * sizeof(char *));
for (size_t i = 0; i < MAX_ARGS; i++) {
devctl(&termdev, DEVCTL_GET_HANDLE, (uint8_t *)DEV_TERMDEV, 0, 0);
for (size_t i = 0; i < ARRLEN(_args); i++) {
_args[i] = dlmalloc(PROC_ARG_MAX);
}