[feat] Support command line arguments for tasks #54

Open
opened 2024-05-15 10:17:57 +02:00 by hgruniaux · 0 comments
hgruniaux commented 2024-05-15 10:17:57 +02:00 (Migrated from github.com)

Command line arguments should be passed in the stack of the created task.

| Stack                               |
| ----------------------------------- |
| Arg 0                               | <- start of the stack
| Arg 1                               |
| ...                                 |
| Arg n                               |
| The constant n                      |
| A pointer to the start of the stack |
| ...                                 | <- SP points here

Example of the _start function in glibc for aarch64:

ENTRY(_start)
	...

	/* Load argc and a pointer to argv */
	ldr	PTR_REG (1), [sp, #0]
	add	x2, sp, #PTR_SIZE

	/* Setup stack limit in argument register */
	mov	x6, sp

        ...
Command line arguments should be passed in the stack of the created task. ``` | Stack | | ----------------------------------- | | Arg 0 | <- start of the stack | Arg 1 | | ... | | Arg n | | The constant n | | A pointer to the start of the stack | | ... | <- SP points here ``` Example of the `_start` function in glibc for aarch64: ```asm ENTRY(_start) ... /* Load argc and a pointer to argv */ ldr PTR_REG (1), [sp, #0] add x2, sp, #PTR_SIZE /* Setup stack limit in argument register */ mov x6, sp ... ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hubert/Pi-kachULM_OS#54
No description provided.