-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clkmgr: first draft of end to end simulation, using clknetsim.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
- Loading branch information
Showing
9 changed files
with
368 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
/doc/ | ||
/utest/utest_* | ||
/pub/clkmgr/types*.h | ||
/sim |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
From fd356c3cf075fd5b89cc98e8f8f1a971a699e99c Mon Sep 17 00:00:00 2001 | ||
From: Erez Geva <ErezGeva2@gmail.com> | ||
Date: Wed, 5 Feb 2025 09:45:56 +0100 | ||
Subject: [PATCH] Add futex system call. | ||
|
||
Signed-off-by: Erez Geva <ErezGeva2@gmail.com> | ||
--- | ||
client.c | 14 ++++++++++++++ | ||
1 file changed, 14 insertions(+) | ||
|
||
diff --git a/client.c b/client.c | ||
index 12923de..7968548 100644 | ||
--- a/client.c | ||
+++ b/client.c | ||
@@ -63,6 +63,7 @@ | ||
#ifdef SO_TIMESTAMPING | ||
#include <linux/ptp_clock.h> | ||
#include <linux/net_tstamp.h> | ||
+#include <linux/futex.h> | ||
#endif | ||
|
||
#include "protocol.h" | ||
@@ -129,6 +130,7 @@ static int (*_usleep)(useconds_t usec); | ||
static void (*_srandom)(unsigned int seed); | ||
static int (*_shmget)(key_t key, size_t size, int shmflg); | ||
static void *(*_shmat)(int shmid, const void *shmaddr, int shmflg); | ||
+static long *(*_syscall)(long number, ...); | ||
|
||
static unsigned int node; | ||
static int initializing = 0; | ||
@@ -280,6 +282,7 @@ static void init_symbols(void) { | ||
_srandom = (void (*)(unsigned int seed))dlsym(RTLD_NEXT, "srandom"); | ||
_shmget = (int (*)(key_t key, size_t size, int shmflg))dlsym(RTLD_NEXT, "shmget"); | ||
_shmat = (void *(*)(int shmid, const void *shmaddr, int shmflg))dlsym(RTLD_NEXT, "shmat"); | ||
+ _syscall = (long *(*)(long number, ...))dlsym(RTLD_NEXT, "syscall"); | ||
|
||
initialized_symbols = 1; | ||
} | ||
@@ -2920,6 +2923,17 @@ long syscall(long number, ...) { | ||
} | ||
break; | ||
#endif | ||
+ case __NR_futex: | ||
+ { | ||
+ uint32_t *uaddr = va_arg(ap, uint32_t *); | ||
+ int futex_op = va_arg(ap, int); | ||
+ uint32_t val = va_arg(ap, uint32_t); | ||
+ struct timespec *timeout = va_arg(ap, struct timespec *); | ||
+ uint32_t *uaddr2 = va_arg(ap, uint32_t *); | ||
+ uint32_t val3 = va_arg(ap, uint32_t); | ||
+ r = syscall(SYS_futex, uaddr, futex_op, val, timeout, uaddr2, val3); | ||
+ } | ||
+ break; | ||
default: | ||
assert(0); | ||
} | ||
-- | ||
2.39.5 | ||
|
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,27 @@ | ||
From c2f41da8111e8ec0b1ee1f213a7e454fb3f10cb3 Mon Sep 17 00:00:00 2001 | ||
From: Erez Geva <ErezGeva2@gmail.com> | ||
Date: Sun, 9 Feb 2025 01:25:44 +0100 | ||
Subject: [PATCH] Add gettid system call. | ||
|
||
Signed-off-by: Erez Geva <ErezGeva2@gmail.com> | ||
--- | ||
client.c | 3 +++ | ||
1 file changed, 3 insertions(+) | ||
|
||
diff --git a/client.c b/client.c | ||
index 7968548..af11b63 100644 | ||
--- a/client.c | ||
+++ b/client.c | ||
@@ -2934,6 +2934,9 @@ long syscall(long number, ...) { | ||
r = syscall(SYS_futex, uaddr, futex_op, val, timeout, uaddr2, val3); | ||
} | ||
break; | ||
+ case __NR_gettid: | ||
+ r = syscall(SYS_gettid); | ||
+ break; | ||
default: | ||
assert(0); | ||
} | ||
-- | ||
2.39.5 | ||
|
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,2 @@ | ||
futex.patch | ||
gettid.patch |
Oops, something went wrong.