diff options
author | Jojo R <jiejie_rong@c-sky.com> | 2020-09-25 18:01:25 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2020-09-25 18:02:34 +0300 |
commit | 648365e0e990489ecff21af17b743e74417aab3b (patch) | |
tree | 179d4c2cf48cfa156d7e39d708a1d1f110539c21 /libgloss/csky/io-write.c | |
parent | c1f7c4d1b6d7424d7081fd382ac83a631b7671ff (diff) |
Add C-SKY port for libgloss
This patch contain all libgloss for C-SKY
Contributor list:
- Lifang Xia <lifang_xia@c-sky.com>
- Jojo R <jiejie_rong@c-sky.com>
- Xianmiao Qu <xianmiao_qu@c-sky.com>
- Yunhai Shang <yunhai_shang@c-sky.com>
Diffstat (limited to 'libgloss/csky/io-write.c')
-rw-r--r-- | libgloss/csky/io-write.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libgloss/csky/io-write.c b/libgloss/csky/io-write.c new file mode 100644 index 000000000..dcac9bdb3 --- /dev/null +++ b/libgloss/csky/io-write.c @@ -0,0 +1,48 @@ +/* + * io-write.c -- + * + * Copyright (c) 2006 CodeSourcery Inc + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include <unistd.h> +#include <errno.h> +#define IO write +#include "io.h" + +/* + * write -- write to a file descriptor + * input parameters: + * 0 : file descriptor + * 1 : buf ptr + * 2 : count + * output parameters: + * 0 : errno + * result : r0 + */ + +ssize_t write (int fd, const void *buf, size_t count) +{ +#if HOSTED + gdb_parambuf_t parameters; + int ret = 0; + parameters[0] = (uint32_t) fd; + parameters[1] = (uint32_t) buf; + parameters[2] = (uint32_t) count; + ret = __hosted (HOSTED_WRITE, parameters); + errno = __hosted_from_gdb_errno (parameters[0]); + return ret; +#else + errno = ENOSYS; + return -1; +#endif +} |