Add x86_64 start code to access argc and argv

This commit is contained in:
2025-05-02 20:48:09 -04:00
parent 9163857e83
commit 7c8c2e2dc2
2 changed files with 38 additions and 1 deletions

View File

@@ -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