newlib/libgloss/xc16x/trap_handle.c
Jeff Johnston e6291536c7 2009-12-10 Conny Marco Menebrocker <c-m-m@gmx.de>
* configure.in: Add xc16x support.
        * configure: Regenerated.
        * xc16x/Makefile.in: New file for xc16x port.
        * xc16x/aclocal.m4: Ditto.
        * xc16x/close.S: Ditto.
        * xc16x/configure: Ditto.
        * xc16x/configure.in: Ditto.
        * xc16x/create.c: Ditto.
        * xc16x/crt0.S: Ditto.
        * xc16x/fstat.S: Ditto.
        * xc16x/getchar1.c: Ditto.
        * xc16x/isatty.c: Ditto.
        * xc16x/lseek.c: Ditto.
        * xc16x/mem-layout.c: Ditto.
        * xc16x/misc.c: Ditto.
        * xc16x/open.c: Ditto.
        * xc16x/read.c: Ditto.
        * xc16x/sbrk.c: Ditto.
        * xc16x/syscalls.c: Ditto.
        * xc16x/trap_handle.c: Ditto.
        * xc16x/write.c: Ditto.
        * xc16x/sys/syscall.h: Ditto.
2009-12-10 17:07:04 +00:00

68 lines
2.1 KiB
C

/*
* Copyright (C) 2006 KPIT Cummins
* Copyright (C) 2009 Conny Marco Menebröcker
* All rights reserved.
*
* Redistribution and use in source and binary forms is permitted
* provided that the above copyright notice and following paragraph are
* duplicated in all such forms.
*
* This file is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
int trap0(int file, unsigned long ptr,int len)
{
asm volatile("TRAP #3");
return len;
}
int trap1(int file, unsigned long ptr,int len)
{
asm volatile("TRAP #4");
}
int trap_lseek(int file, unsigned long ptr,int len)
{
asm volatile("TRAP #8");
}
volatile int opensys(char *name,int flags,int perms)
{
#ifndef __xc16xL__
asm volatile("push r11\n"
"mov r11,r10 \n"
" mov r10,r9 \n"
" mov r9,#0x300 \n"
);
#endif
asm volatile("trap #5");
#ifndef __xc16xL__
asm volatile("pop r11");
#endif
}
volatile int creatsys(char *name,int perms)
{
#ifndef __xc16xL__
asm volatile("push r10\n"
" mov r10,r9 \n"
" mov r9,#0x300 \n"
);
#endif
asm volatile("trap #7");
#ifndef __xc16xL__
asm volatile("pop r10");
#endif
}