Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332305
b: refs/heads/master
c: 717460e
h: refs/heads/master
i:
  332303: fc114b6
v: v3
  • Loading branch information
Max Filippov authored and Chris Zankel committed Oct 3, 2012
1 parent 9217239 commit e83e462
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 63 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33c8213d6930cfa1d09e2912b9e2d59f251c33b7
refs/heads/master: 717460ee3e8399eb66799cac0bb83217475b7027
13 changes: 0 additions & 13 deletions trunk/arch/xtensa/platforms/iss/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ static struct timer_list serial_timer;

static DEFINE_SPINLOCK(timer_lock);

int errno;

static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
static int __simc (int a, int b, int c, int d, int e, int f)
{
int ret;
__asm__ __volatile__ ("simcall\n"
"mov %0, a2\n"
"mov %1, a3\n" : "=a" (ret), "=a" (errno)
: : "a2", "a3");
return ret;
}

static char *serial_version = "0.1";
static char *serial_name = "ISS serial driver";

Expand Down
53 changes: 53 additions & 0 deletions trunk/arch/xtensa/platforms/iss/include/platform/simcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,59 @@
#define XTISS_SELECT_ONE_WRITE 2
#define XTISS_SELECT_ONE_EXCEPT 3

static int errno;

static inline int __simc(int a, int b, int c, int d, int e, int f)
{
int ret;
register int a1 asm("a2") = a;
register int b1 asm("a3") = b;
register int c1 asm("a4") = c;
register int d1 asm("a5") = d;
register int e1 asm("a6") = e;
register int f1 asm("a7") = f;
__asm__ __volatile__ (
"simcall\n"
"mov %0, a2\n"
"mov %1, a3\n"
: "=a" (ret), "=a" (errno), "+r"(a1), "+r"(b1)
: "r"(c1), "r"(d1), "r"(e1), "r"(f1)
: );
return ret;
}

static inline int simc_open(char *file, int flags, int mode)
{
return __simc(SYS_open, (int) file, flags, mode, 0, 0);
}

static inline int simc_close(int fd)
{
return __simc(SYS_close, fd, 0, 0, 0, 0);
}

static inline int simc_ioctl(int fd, int request, void *arg)
{
return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
}

static inline int simc_read(int fd, void *buf, size_t count)
{
return __simc(SYS_read, fd, (int) buf, count, 0, 0);
}

static inline int simc_write(int fd, void *buf, size_t count)
{
return __simc(SYS_write, fd, (int) buf, count, 0, 0);
}

static inline int simc_poll(int fd)
{
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };

return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,
0, 0);
}

#endif /* _XTENSA_PLATFORM_ISS_SIMCALL_H */

49 changes: 0 additions & 49 deletions trunk/arch/xtensa/platforms/iss/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,55 +101,6 @@ struct iss_net_private {

};

/* ======================= ISS SIMCALL INTERFACE =========================== */

/* Note: __simc must _not_ be declared inline! */

static int errno;

static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
static int __simc (int a, int b, int c, int d, int e, int f)
{
int ret;
__asm__ __volatile__ ("simcall\n"
"mov %0, a2\n"
"mov %1, a3\n" : "=a" (ret), "=a" (errno)
: : "a2", "a3");
return ret;
}

static int inline simc_open(char *file, int flags, int mode)
{
return __simc(SYS_open, (int) file, flags, mode, 0, 0);
}

static int inline simc_close(int fd)
{
return __simc(SYS_close, fd, 0, 0, 0, 0);
}

static int inline simc_ioctl(int fd, int request, void *arg)
{
return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
}

static int inline simc_read(int fd, void *buf, size_t count)
{
return __simc(SYS_read, fd, (int) buf, count, 0, 0);
}

static int inline simc_write(int fd, void *buf, size_t count)
{
return __simc(SYS_write, fd, (int) buf, count, 0, 0);
}

static int inline simc_poll(int fd)
{
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };

return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,0,0);
}

/* ================================ HELPERS ================================ */


Expand Down

0 comments on commit e83e462

Please sign in to comment.