[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] target/tricore: Add lseek semihosting call
|
From: |
Bastian Koppelmann |
|
Subject: |
[PATCH 3/6] target/tricore: Add lseek semihosting call |
|
Date: |
Sun, 15 Oct 2023 22:59:10 +0200 |
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
target/tricore/tricore-semi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/tricore/tricore-semi.c b/target/tricore/tricore-semi.c
index ccbeae4bc0..6f321391ef 100644
--- a/target/tricore/tricore-semi.c
+++ b/target/tricore/tricore-semi.c
@@ -164,6 +164,17 @@ static void tricore_vio_set_result(CPUTriCoreState *env,
int retval,
env->gpr_d[12] = tricore_vio_errno_h2g(host_errno);
}
+
+static void tricore_vio_lseek(CPUTriCoreState *env)
+{
+ int fd = env->gpr_d[4];
+ off_t offset = env->gpr_d[5];
+ int whence = env->gpr_d[6];
+
+ off_t res = lseek(fd, offset, whence);
+ tricore_vio_set_result(env, res, errno);
+}
+
static void tricore_vio_readwrite(CPUTriCoreState *env, bool is_write)
{
CPUState *cs = env_cpu(env);
@@ -234,6 +245,9 @@ void helper_tricore_semihost(CPUTriCoreState *env, uint32_t
pc)
syscall = (int)env->gpr_d[12];
switch (syscall) {
+ case SYS__LSEEK:
+ tricore_vio_lseek(env);
+ break;
case SYS__READ:
tricore_vio_read(env);
break;
--
2.42.0
- [PATCH 0/6] TriCore Semihosting, Bastian Koppelmann, 2023/10/15
- [PATCH 1/6] target/tricore: Add semihosting stub, Bastian Koppelmann, 2023/10/15
- [PATCH 4/6] target/tricore: Add close semihosting call, Bastian Koppelmann, 2023/10/15
- [PATCH 5/6] target/tricore: Add open and creat semihosting calls, Bastian Koppelmann, 2023/10/15
- [PATCH 2/6] target/tricore: Add read and write semihosting calls, Bastian Koppelmann, 2023/10/15
- [PATCH 6/6] target/tricore: Enable semihosting, Bastian Koppelmann, 2023/10/15
- [PATCH 3/6] target/tricore: Add lseek semihosting call,
Bastian Koppelmann <=