-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernel+userland(lib): implement auxiliary vector
- Loading branch information
Showing
13 changed files
with
153 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
#include "errno.h" | ||
#include "stdlib.h" | ||
#include "unistd.h" | ||
#include <common/extra.h> | ||
#include <kernel/api/elf.h> | ||
|
||
static uint32_t auxv[32]; | ||
|
||
unsigned long getauxval(unsigned long type) { | ||
if (type >= ARRAY_SIZE(auxv)) { | ||
errno = ENOENT; | ||
return 0; | ||
} | ||
return auxv[type]; | ||
} | ||
|
||
int main(int argc, char* const argv[], char* const envp[]); | ||
|
||
void _start(int argc, char* const argv[], char* const envp[]) { | ||
environ = (char**)envp; | ||
|
||
char** p = environ; | ||
while (*p++) | ||
; | ||
for (Elf32_auxv_t* aux = (Elf32_auxv_t*)p; aux->a_type != AT_NULL; ++aux) { | ||
if (aux->a_type < ARRAY_SIZE(auxv)) | ||
auxv[aux->a_type] = aux->a_un.a_val; | ||
} | ||
|
||
exit(main(argc, argv, envp)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include <kernel/api/elf.h> | ||
|
||
unsigned long getauxval(unsigned long type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
#include <kernel/api/time.h> | ||
|
||
#define CLOCKS_PER_SEC 1000000 | ||
|
||
struct tm { | ||
int tm_sec; | ||
int tm_min; | ||
|
Oops, something went wrong.