Added some files that we probably won't need for a while...

(syscalls.inc for other platforms)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1391 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-10-05 18:09:26 +00:00
parent fae903cacf
commit e195c3e79e
6 changed files with 274 additions and 0 deletions

View File

@ -0,0 +1,53 @@
/*
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
/*
** arg layout:
** r4-r7: arg 1 - 4
** r0-r3: arg 5 - 8
** r8-r13: arg 8 - 13
*/
#define FUNC(name) .align 2 ; .globl _##name ; .type _##name,@function ; _##name:
#define SYSCALL0(name, n) \
FUNC(name) \
rts
#define SYSCALL1(name, n) \
FUNC(name) \
rts
#define SYSCALL2(name, n) \
FUNC(name) \
rts
#define SYSCALL3(name, n) \
FUNC(name) \
rts
#define SYSCALL4(name, n) \
FUNC(name) \
rts
#define SYSCALL5(name, n) \
FUNC(name) \
rts
#define SYSCALL6(name, n) \
FUNC(name) \
rts
#define SYSCALL7(name, n) \
FUNC(name) \
rts
#define SYSCALL8(name, n) \
FUNC(name) \
rts
#define SYSCALL9(name, n) \
FUNC(name) \
rts

View File

@ -0,0 +1,23 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#define SYSCALL0(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL1(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL2(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL3(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL4(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL5(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL6(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL7(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL8(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL9(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL10(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL11(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL12(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL13(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL14(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL15(name, number) .align 2 ; .globl name ; .type name,@function ; name:
#define SYSCALL16(name, number) .align 2 ; .globl name ; .type name,@function ; name:

View File

@ -0,0 +1,64 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#define SYSCALL0(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL1(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL2(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL3(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL4(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL5(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL6(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL7(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL8(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:
#define SYSCALL9(name, n) \
.globl name; \
.type name,@function; \
.align 4; \
name:

View File

@ -0,0 +1,32 @@
/*
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#include <sys/atomic.h>
#include <sys/syscalls.h>
int atomic_add(int *val, int incr)
{
return sys_atomic_add(val, incr);
}
int atomic_and(int *val, int incr)
{
return sys_atomic_and(val, incr);
}
int atomic_or(int *val, int incr)
{
return sys_atomic_or(val, incr);
}
int atomic_set(int *val, int set_to)
{
return sys_atomic_set(val, set_to);
}
int test_and_set(int *val, int set_to, int test_val)
{
return sys_test_and_set(val, set_to, test_val);
}

View File

@ -0,0 +1,97 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
/*
** arg layout:
** r4-r7: arg 1 - 4
** r0-r3: arg 5 - 8
** r8-r13: arg 8 - 13
*/
#define FUNC(name) .align 2 ; .globl _##name ; .type _##name,@function ; _##name:
#define SYSCALL0(name, n) \
FUNC(name) \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL1(name, n) \
FUNC(name) \
trapa #(n); \
rts; \
nop;
#define SYSCALL2(name, n) \
FUNC(name) \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL3(name, n) \
FUNC(name) \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL4(name, n) \
FUNC(name) \
trapa #(n); \
nop; \
rts; \
nop; \
#define SYSCALL5(name, n) \
FUNC(name) \
mov.l @r15,r0; \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL6(name, n) \
FUNC(name) \
mov.l @(0,r15),r0; \
mov.l @(4,r15),r1; \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL7(name, n) \
FUNC(name) \
mov.l @(0,r15),r0; \
mov.l @(4,r15),r1; \
mov.l @(8,r15),r2; \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL8(name, n) \
FUNC(name) \
mov.l @(0,r15),r0; \
mov.l @(4,r15),r1; \
mov.l @(8,r15),r2; \
mov.l @(12,r15),r3; \
trapa #(n); \
nop; \
rts; \
nop;
#define SYSCALL9(name, n) \
FUNC(name) \
mov.l @(0,r15),r0; \
mov.l @(4,r15),r1; \
mov.l @(8,r15),r2; \
mov.l @(12,r15),r3; \
mov.l r8,@-r15; \
mov.l @(20,r15),r8; \
trapa #(n); \
nop; \
rts; \
mov.l @r15+,r8

View File

@ -0,0 +1,5 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/