Add x86_64 start code to access argc and argv
This commit is contained in:
@@ -2,11 +2,18 @@
|
||||
#include "sys.h"
|
||||
|
||||
|
||||
int main() {
|
||||
int main(int argc, char* argv[]) {
|
||||
// Test the write syscall
|
||||
intptr_t n = write(STDOUT, "Hello\n", 6);
|
||||
if(n != 6) return n;
|
||||
|
||||
// Test argc
|
||||
for(int i = 0; i < argc; ++i){
|
||||
int len = strlen(argv[i]);
|
||||
write(STDOUT, argv[i], len);
|
||||
write(STDOUT, "\n", 1);
|
||||
}
|
||||
|
||||
// Test the fork syscall
|
||||
uint64_t pid = fork();
|
||||
// Print the pid in hex
|
||||
|
||||
Reference in New Issue
Block a user