12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429 |
- From be7942d8dbce223ed6a75dfdf8d2cd1beb04e2eb Mon Sep 17 00:00:00 2001
- From: Max Filippov <jcmvbkbc@gmail.com>
- Date: Tue, 22 Mar 2016 02:35:58 +0300
- Subject: [PATCH 242/242] xtensa: add port
- Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
- Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
- ---
- arch/xtensa/atomic_arch.h | 30 ++
- arch/xtensa/bits/alltypes.h.in | 30 ++
- arch/xtensa/bits/endian.h | 7 +
- arch/xtensa/bits/float.h | 16 +
- arch/xtensa/bits/ioctl.h | 227 ++++++++++++
- arch/xtensa/bits/limits.h | 7 +
- arch/xtensa/bits/mman.h | 57 +++
- arch/xtensa/bits/posix.h | 2 +
- arch/xtensa/bits/reg.h | 2 +
- arch/xtensa/bits/setjmp.h | 1 +
- arch/xtensa/bits/signal.h | 88 +++++
- arch/xtensa/bits/stat.h | 21 ++
- arch/xtensa/bits/stdint.h | 20 +
- arch/xtensa/bits/syscall.h | 679 ++++++++++++++++++++++++++++++++++
- arch/xtensa/bits/termios.h | 168 +++++++++
- arch/xtensa/bits/user.h | 4 +
- arch/xtensa/bits/xtensa-config.h | 46 +++
- arch/xtensa/crt_arch.h | 26 ++
- arch/xtensa/pthread_arch.h | 11 +
- arch/xtensa/reloc.h | 21 ++
- arch/xtensa/syscall_arch.h | 102 +++++
- configure | 1 +
- crt/xtensa/crti.s | 11 +
- crt/xtensa/crtn.s | 5 +
- include/elf.h | 58 +++
- ldso/dlstart.c | 13 +-
- ldso/dynlink.c | 41 +-
- src/internal/xtensa/syscall.s | 15 +
- src/ldso/xtensa/tlsdesc.s | 22 ++
- src/setjmp/xtensa/longjmp.s | 73 ++++
- src/setjmp/xtensa/setjmp.s | 13 +
- src/signal/xtensa/restore.s | 10 +
- src/signal/xtensa/sigsetjmp.s | 69 ++++
- src/signal/xtensa/windowspill.s | 78 ++++
- src/thread/xtensa/__set_thread_area.s | 8 +
- src/thread/xtensa/__unmapself.s | 10 +
- src/thread/xtensa/clone.s | 39 ++
- src/thread/xtensa/syscall_cp.s | 37 ++
- 38 files changed, 2066 insertions(+), 2 deletions(-)
- create mode 100644 arch/xtensa/atomic_arch.h
- create mode 100644 arch/xtensa/bits/alltypes.h.in
- create mode 100644 arch/xtensa/bits/endian.h
- create mode 100644 arch/xtensa/bits/float.h
- create mode 100644 arch/xtensa/bits/ioctl.h
- create mode 100644 arch/xtensa/bits/limits.h
- create mode 100644 arch/xtensa/bits/mman.h
- create mode 100644 arch/xtensa/bits/posix.h
- create mode 100644 arch/xtensa/bits/reg.h
- create mode 100644 arch/xtensa/bits/setjmp.h
- create mode 100644 arch/xtensa/bits/signal.h
- create mode 100644 arch/xtensa/bits/stat.h
- create mode 100644 arch/xtensa/bits/stdint.h
- create mode 100644 arch/xtensa/bits/syscall.h
- create mode 100644 arch/xtensa/bits/termios.h
- create mode 100644 arch/xtensa/bits/user.h
- create mode 100644 arch/xtensa/bits/xtensa-config.h
- create mode 100644 arch/xtensa/crt_arch.h
- create mode 100644 arch/xtensa/pthread_arch.h
- create mode 100644 arch/xtensa/reloc.h
- create mode 100644 arch/xtensa/syscall_arch.h
- create mode 100644 crt/xtensa/crti.s
- create mode 100644 crt/xtensa/crtn.s
- create mode 100644 src/internal/xtensa/syscall.s
- create mode 100644 src/ldso/xtensa/tlsdesc.s
- create mode 100644 src/setjmp/xtensa/longjmp.s
- create mode 100644 src/setjmp/xtensa/setjmp.s
- create mode 100644 src/signal/xtensa/restore.s
- create mode 100644 src/signal/xtensa/sigsetjmp.s
- create mode 100644 src/signal/xtensa/windowspill.s
- create mode 100644 src/thread/xtensa/__set_thread_area.s
- create mode 100644 src/thread/xtensa/__unmapself.s
- create mode 100644 src/thread/xtensa/clone.s
- create mode 100644 src/thread/xtensa/syscall_cp.s
- diff --git a/arch/xtensa/atomic_arch.h b/arch/xtensa/atomic_arch.h
- new file mode 100644
- index 0000000..476814b
- --- /dev/null
- +++ b/arch/xtensa/atomic_arch.h
- @@ -0,0 +1,30 @@
- +#ifndef _INTERNAL_ATOMIC_H
- +#define _INTERNAL_ATOMIC_H
- +
- +#include <stdint.h>
- +
- +#define a_cas a_cas
- +static inline int a_cas(volatile int *p, int t, int s)
- +{
- + __asm__ __volatile__(
- + " wsr %1, scompare1\n"
- + " s32c1i %0, %2, 0\n"
- + : "+a"(s)
- + : "a"(t), "a"(p)
- + : "memory" );
- + return s;
- +}
- +
- +#define a_barrier a_barrier
- +static inline void a_barrier()
- +{
- + __asm__ __volatile__ ("memw" : : : "memory");
- +}
- +
- +#define a_crash a_crash
- +static inline void a_crash()
- +{
- + __asm__ __volatile__ ("ill" : : : "memory");
- +}
- +
- +#endif
- diff --git a/arch/xtensa/bits/alltypes.h.in b/arch/xtensa/bits/alltypes.h.in
- new file mode 100644
- index 0000000..1e2a8c1
- --- /dev/null
- +++ b/arch/xtensa/bits/alltypes.h.in
- @@ -0,0 +1,30 @@
- +#define _Addr int
- +#define _Int64 long long
- +#define _Reg int
- +
- +TYPEDEF __builtin_va_list va_list;
- +TYPEDEF __builtin_va_list __isoc_va_list;
- +
- +#ifndef __cplusplus
- +#ifdef __WCHAR_TYPE__
- +TYPEDEF __WCHAR_TYPE__ wchar_t;
- +#else
- +TYPEDEF unsigned wchar_t;
- +#endif
- +#endif
- +
- +TYPEDEF float float_t;
- +TYPEDEF double double_t;
- +
- +TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
- +
- +TYPEDEF long time_t;
- +TYPEDEF long suseconds_t;
- +
- +TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
- +TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
- +TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
- +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
- +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
- +TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
- +TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
- diff --git a/arch/xtensa/bits/endian.h b/arch/xtensa/bits/endian.h
- new file mode 100644
- index 0000000..d719907
- --- /dev/null
- +++ b/arch/xtensa/bits/endian.h
- @@ -0,0 +1,7 @@
- +#if __XTENSA_EB__
- +#define __BYTE_ORDER __BIG_ENDIAN
- +#elif __XTENSA_EL__
- +#define __BYTE_ORDER __LITTLE_ENDIAN
- +#else
- +#error Unknown endianness
- +#endif
- diff --git a/arch/xtensa/bits/float.h b/arch/xtensa/bits/float.h
- new file mode 100644
- index 0000000..c4a655e
- --- /dev/null
- +++ b/arch/xtensa/bits/float.h
- @@ -0,0 +1,16 @@
- +#define FLT_EVAL_METHOD 0
- +
- +#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
- +#define LDBL_MIN 2.22507385850720138309e-308L
- +#define LDBL_MAX 1.79769313486231570815e+308L
- +#define LDBL_EPSILON 2.22044604925031308085e-16L
- +
- +#define LDBL_MANT_DIG 53
- +#define LDBL_MIN_EXP (-1021)
- +#define LDBL_MAX_EXP 1024
- +
- +#define LDBL_DIG 15
- +#define LDBL_MIN_10_EXP (-307)
- +#define LDBL_MAX_10_EXP 308
- +
- +#define DECIMAL_DIG 17
- diff --git a/arch/xtensa/bits/ioctl.h b/arch/xtensa/bits/ioctl.h
- new file mode 100644
- index 0000000..e1ab80e
- --- /dev/null
- +++ b/arch/xtensa/bits/ioctl.h
- @@ -0,0 +1,227 @@
- +#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
- +#define _IOC_NONE 0U
- +#define _IOC_READ 2U
- +#define _IOC_WRITE 1U
- +
- +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
- +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
- +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
- +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
- +
- +#define FIOCLEX _IO('f', 1)
- +#define FIONCLEX _IO('f', 2)
- +#define FIOASYNC _IOW('f', 125, int)
- +#define FIONBIO _IOW('f', 126, int)
- +#define FIONREAD _IOR('f', 127, int)
- +#define TIOCINQ FIONREAD
- +#define FIOQSIZE _IOR('f', 128, loff_t)
- +
- +#define TCGETS 0x5401
- +#define TCSETS 0x5402
- +#define TCSETSW 0x5403
- +#define TCSETSF 0x5404
- +
- +#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
- +#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
- +#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
- +#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */
- +
- +#define TCSBRK _IO('t', 29)
- +#define TCXONC _IO('t', 30)
- +#define TCFLSH _IO('t', 31)
- +
- +#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
- +#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
- +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
- +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
- +#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
- +
- +#define TIOCSPGRP _IOW('t', 118, int)
- +#define TIOCGPGRP _IOR('t', 119, int)
- +
- +#define TIOCEXCL _IO('T', 12)
- +#define TIOCNXCL _IO('T', 13)
- +#define TIOCSCTTY _IO('T', 14)
- +
- +#define TIOCSTI _IOW('T', 18, char)
- +#define TIOCMGET _IOR('T', 21, unsigned int)
- +#define TIOCMBIS _IOW('T', 22, unsigned int)
- +#define TIOCMBIC _IOW('T', 23, unsigned int)
- +#define TIOCMSET _IOW('T', 24, unsigned int)
- +# define TIOCM_LE 0x001
- +# define TIOCM_DTR 0x002
- +# define TIOCM_RTS 0x004
- +# define TIOCM_ST 0x008
- +# define TIOCM_SR 0x010
- +# define TIOCM_CTS 0x020
- +# define TIOCM_CAR 0x040
- +# define TIOCM_RNG 0x080
- +# define TIOCM_DSR 0x100
- +# define TIOCM_CD TIOCM_CAR
- +# define TIOCM_RI TIOCM_RNG
- +
- +#define TIOCGSOFTCAR _IOR('T', 25, unsigned int)
- +#define TIOCSSOFTCAR _IOW('T', 26, unsigned int)
- +#define TIOCLINUX _IOW('T', 28, char)
- +#define TIOCCONS _IO('T', 29)
- +#define TIOCGSERIAL 0x803C541E /*_IOR('T', 30, struct serial_struct)*/
- +#define TIOCSSERIAL 0x403C541F /*_IOW('T', 31, struct serial_struct)*/
- +#define TIOCPKT _IOW('T', 32, int)
- +# define TIOCPKT_DATA 0
- +# define TIOCPKT_FLUSHREAD 1
- +# define TIOCPKT_FLUSHWRITE 2
- +# define TIOCPKT_STOP 4
- +# define TIOCPKT_START 8
- +# define TIOCPKT_NOSTOP 16
- +# define TIOCPKT_DOSTOP 32
- +# define TIOCPKT_IOCTL 64
- +
- +
- +#define TIOCNOTTY _IO('T', 34)
- +#define TIOCSETD _IOW('T', 35, int)
- +#define TIOCGETD _IOR('T', 36, int)
- +#define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/
- +#define TIOCSBRK _IO('T', 39) /* BSD compatibility */
- +#define TIOCCBRK _IO('T', 40) /* BSD compatibility */
- +#define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/
- +#define TCGETS2 _IOR('T', 42, struct termios2)
- +#define TCSETS2 _IOW('T', 43, struct termios2)
- +#define TCSETSW2 _IOW('T', 44, struct termios2)
- +#define TCSETSF2 _IOW('T', 45, struct termios2)
- +#define TIOCGRS485 _IOR('T', 46, struct serial_rs485)
- +#define TIOCSRS485 _IOWR('T', 47, struct serial_rs485)
- +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
- +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
- +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
- +#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
- +#define TIOCVHANGUP _IO('T', 0x37)
- +#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
- +#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
- +#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
- +
- +#define TIOCSERCONFIG _IO('T', 83)
- +#define TIOCSERGWILD _IOR('T', 84, int)
- +#define TIOCSERSWILD _IOW('T', 85, int)
- +#define TIOCGLCKTRMIOS 0x5456
- +#define TIOCSLCKTRMIOS 0x5457
- +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
- +#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */
- + /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
- +# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
- +#define TIOCSERGETMULTI 0x80a8545a /* Get multiport config */
- + /* _IOR('T', 90, struct serial_multiport_struct) */
- +#define TIOCSERSETMULTI 0x40a8545b /* Set multiport config */
- + /* _IOW('T', 91, struct serial_multiport_struct) */
- +
- +#define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */
- +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
- +
- +struct winsize {
- + unsigned short ws_row;
- + unsigned short ws_col;
- + unsigned short ws_xpixel;
- + unsigned short ws_ypixel;
- +};
- +
- +#define TIOCM_LE 0x001
- +#define TIOCM_DTR 0x002
- +#define TIOCM_RTS 0x004
- +#define TIOCM_ST 0x008
- +#define TIOCM_SR 0x010
- +#define TIOCM_CTS 0x020
- +#define TIOCM_CAR 0x040
- +#define TIOCM_RNG 0x080
- +#define TIOCM_DSR 0x100
- +#define TIOCM_CD TIOCM_CAR
- +#define TIOCM_RI TIOCM_RNG
- +#define TIOCM_OUT1 0x2000
- +#define TIOCM_OUT2 0x4000
- +#define TIOCM_LOOP 0x8000
- +#define TIOCM_MODEM_BITS TIOCM_OUT2
- +
- +#define N_TTY 0
- +#define N_SLIP 1
- +#define N_MOUSE 2
- +#define N_PPP 3
- +#define N_STRIP 4
- +#define N_AX25 5
- +#define N_X25 6
- +#define N_6PACK 7
- +#define N_MASC 8
- +#define N_R3964 9
- +#define N_PROFIBUS_FDL 10
- +#define N_IRDA 11
- +#define N_SMSBLOCK 12
- +#define N_HDLC 13
- +#define N_SYNC_PPP 14
- +#define N_HCI 15
- +
- +#define FIOGETOWN _IOR('f', 123, int)
- +#define FIOSETOWN _IOW('f', 124, int)
- +#define SIOCATMARK _IOR('s', 7, int)
- +#define SIOCSPGRP _IOW('s', 8, pid_t)
- +#define SIOCGPGRP _IOR('s', 9, pid_t)
- +#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
- +#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
- +
- +#define SIOCADDRT 0x890B
- +#define SIOCDELRT 0x890C
- +#define SIOCRTMSG 0x890D
- +
- +#define SIOCGIFNAME 0x8910
- +#define SIOCSIFLINK 0x8911
- +#define SIOCGIFCONF 0x8912
- +#define SIOCGIFFLAGS 0x8913
- +#define SIOCSIFFLAGS 0x8914
- +#define SIOCGIFADDR 0x8915
- +#define SIOCSIFADDR 0x8916
- +#define SIOCGIFDSTADDR 0x8917
- +#define SIOCSIFDSTADDR 0x8918
- +#define SIOCGIFBRDADDR 0x8919
- +#define SIOCSIFBRDADDR 0x891a
- +#define SIOCGIFNETMASK 0x891b
- +#define SIOCSIFNETMASK 0x891c
- +#define SIOCGIFMETRIC 0x891d
- +#define SIOCSIFMETRIC 0x891e
- +#define SIOCGIFMEM 0x891f
- +#define SIOCSIFMEM 0x8920
- +#define SIOCGIFMTU 0x8921
- +#define SIOCSIFMTU 0x8922
- +#define SIOCSIFHWADDR 0x8924
- +#define SIOCGIFENCAP 0x8925
- +#define SIOCSIFENCAP 0x8926
- +#define SIOCGIFHWADDR 0x8927
- +#define SIOCGIFSLAVE 0x8929
- +#define SIOCSIFSLAVE 0x8930
- +#define SIOCADDMULTI 0x8931
- +#define SIOCDELMULTI 0x8932
- +#define SIOCGIFINDEX 0x8933
- +#define SIOGIFINDEX SIOCGIFINDEX
- +#define SIOCSIFPFLAGS 0x8934
- +#define SIOCGIFPFLAGS 0x8935
- +#define SIOCDIFADDR 0x8936
- +#define SIOCSIFHWBROADCAST 0x8937
- +#define SIOCGIFCOUNT 0x8938
- +
- +#define SIOCGIFBR 0x8940
- +#define SIOCSIFBR 0x8941
- +
- +#define SIOCGIFTXQLEN 0x8942
- +#define SIOCSIFTXQLEN 0x8943
- +
- +#define SIOCDARP 0x8953
- +#define SIOCGARP 0x8954
- +#define SIOCSARP 0x8955
- +
- +#define SIOCDRARP 0x8960
- +#define SIOCGRARP 0x8961
- +#define SIOCSRARP 0x8962
- +
- +#define SIOCGIFMAP 0x8970
- +#define SIOCSIFMAP 0x8971
- +
- +#define SIOCADDDLCI 0x8980
- +#define SIOCDELDLCI 0x8981
- +
- +#define SIOCDEVPRIVATE 0x89F0
- +#define SIOCPROTOPRIVATE 0x89E0
- diff --git a/arch/xtensa/bits/limits.h b/arch/xtensa/bits/limits.h
- new file mode 100644
- index 0000000..fbc6d23
- --- /dev/null
- +++ b/arch/xtensa/bits/limits.h
- @@ -0,0 +1,7 @@
- +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
- +#define LONG_BIT 32
- +#endif
- +
- +#define LONG_MAX 0x7fffffffL
- +#define LLONG_MAX 0x7fffffffffffffffLL
- diff --git a/arch/xtensa/bits/mman.h b/arch/xtensa/bits/mman.h
- new file mode 100644
- index 0000000..3125fc2
- --- /dev/null
- +++ b/arch/xtensa/bits/mman.h
- @@ -0,0 +1,57 @@
- +#define MAP_FAILED ((void *) -1)
- +
- +#define PROT_NONE 0
- +#define PROT_READ 1
- +#define PROT_WRITE 2
- +#define PROT_EXEC 4
- +#define PROT_GROWSDOWN 0x01000000
- +#define PROT_GROWSUP 0x02000000
- +
- +#define MAP_SHARED 0x01
- +#define MAP_PRIVATE 0x02
- +#define MAP_FIXED 0x10
- +
- +#define MAP_TYPE 0x0f
- +#define MAP_FILE 0x00
- +#define MAP_ANON 0x800
- +#define MAP_ANONYMOUS MAP_ANON
- +#define MAP_NORESERVE 0x0400
- +#define MAP_GROWSDOWN 0x1000
- +#define MAP_DENYWRITE 0x2000
- +#define MAP_EXECUTABLE 0x4000
- +#define MAP_LOCKED 0x8000
- +#define MAP_POPULATE 0x10000
- +#define MAP_NONBLOCK 0x20000
- +#define MAP_STACK 0x40000
- +#define MAP_HUGETLB 0x80000
- +
- +#define POSIX_MADV_NORMAL 0
- +#define POSIX_MADV_RANDOM 1
- +#define POSIX_MADV_SEQUENTIAL 2
- +#define POSIX_MADV_WILLNEED 3
- +#define POSIX_MADV_DONTNEED 0
- +
- +#define MS_ASYNC 1
- +#define MS_INVALIDATE 2
- +#define MS_SYNC 4
- +
- +#define MCL_CURRENT 1
- +#define MCL_FUTURE 2
- +
- +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
- +#define MADV_NORMAL 0
- +#define MADV_RANDOM 1
- +#define MADV_SEQUENTIAL 2
- +#define MADV_WILLNEED 3
- +#define MADV_DONTNEED 4
- +#define MADV_REMOVE 9
- +#define MADV_DONTFORK 10
- +#define MADV_DOFORK 11
- +#define MADV_MERGEABLE 12
- +#define MADV_UNMERGEABLE 13
- +#define MADV_HUGEPAGE 14
- +#define MADV_NOHUGEPAGE 15
- +#define MADV_DONTDUMP 16
- +#define MADV_DODUMP 17
- +#define MADV_HWPOISON 100
- +#endif
- diff --git a/arch/xtensa/bits/posix.h b/arch/xtensa/bits/posix.h
- new file mode 100644
- index 0000000..30a3871
- --- /dev/null
- +++ b/arch/xtensa/bits/posix.h
- @@ -0,0 +1,2 @@
- +#define _POSIX_V6_ILP32_OFFBIG 1
- +#define _POSIX_V7_ILP32_OFFBIG 1
- diff --git a/arch/xtensa/bits/reg.h b/arch/xtensa/bits/reg.h
- new file mode 100644
- index 0000000..0192a29
- --- /dev/null
- +++ b/arch/xtensa/bits/reg.h
- @@ -0,0 +1,2 @@
- +#undef __WORDSIZE
- +#define __WORDSIZE 32
- diff --git a/arch/xtensa/bits/setjmp.h b/arch/xtensa/bits/setjmp.h
- new file mode 100644
- index 0000000..b2bd974
- --- /dev/null
- +++ b/arch/xtensa/bits/setjmp.h
- @@ -0,0 +1 @@
- +typedef unsigned long __jmp_buf[18];
- diff --git a/arch/xtensa/bits/signal.h b/arch/xtensa/bits/signal.h
- new file mode 100644
- index 0000000..545ffd3
- --- /dev/null
- +++ b/arch/xtensa/bits/signal.h
- @@ -0,0 +1,88 @@
- +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
- +
- +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
- +#define MINSIGSTKSZ 2048
- +#define SIGSTKSZ 8192
- +#endif
- +
- +typedef struct sigcontext
- +{
- + unsigned long sc_pc;
- + unsigned long sc_ps;
- + unsigned long sc_lbeg;
- + unsigned long sc_lend;
- + unsigned long sc_lcount;
- + unsigned long sc_sar;
- + unsigned long sc_acclo;
- + unsigned long sc_acchi;
- + unsigned long sc_a[16];
- + void *sc_xtregs;
- +} mcontext_t;
- +
- +struct sigaltstack {
- + void *ss_sp;
- + int ss_flags;
- + size_t ss_size;
- +};
- +
- +typedef struct __ucontext {
- + unsigned long uc_flags;
- + struct __ucontext *uc_link;
- + stack_t uc_stack;
- + mcontext_t uc_mcontext;
- + sigset_t uc_sigmask;
- +} ucontext_t;
- +
- +#define SA_NOCLDSTOP 0x00000001
- +#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
- +#define SA_SIGINFO 0x00000004
- +#define SA_ONSTACK 0x08000000
- +#define SA_RESTART 0x10000000
- +#define SA_NODEFER 0x40000000
- +#define SA_RESETHAND 0x80000000
- +
- +#define SA_NOMASK SA_NODEFER
- +#define SA_ONESHOT SA_RESETHAND
- +
- +#define SA_RESTORER 0x04000000
- +
- +#endif
- +
- +#define SIGHUP 1
- +#define SIGINT 2
- +#define SIGQUIT 3
- +#define SIGILL 4
- +#define SIGTRAP 5
- +#define SIGABRT 6
- +#define SIGIOT 6
- +#define SIGBUS 7
- +#define SIGFPE 8
- +#define SIGKILL 9
- +#define SIGUSR1 10
- +#define SIGSEGV 11
- +#define SIGUSR2 12
- +#define SIGPIPE 13
- +#define SIGALRM 14
- +#define SIGTERM 15
- +#define SIGSTKFLT 16
- +#define SIGCHLD 17
- +#define SIGCONT 18
- +#define SIGSTOP 19
- +#define SIGTSTP 20
- +#define SIGTTIN 21
- +#define SIGTTOU 22
- +#define SIGURG 23
- +#define SIGXCPU 24
- +#define SIGXFSZ 25
- +#define SIGVTALRM 26
- +#define SIGPROF 27
- +#define SIGWINCH 28
- +#define SIGIO 29
- +#define SIGPOLL SIGIO
- +/* #define SIGLOST 29 */
- +#define SIGPWR 30
- +#define SIGSYS 31
- +#define SIGUNUSED 31
- +
- +#define _NSIG 64
- diff --git a/arch/xtensa/bits/stat.h b/arch/xtensa/bits/stat.h
- new file mode 100644
- index 0000000..24231f8
- --- /dev/null
- +++ b/arch/xtensa/bits/stat.h
- @@ -0,0 +1,21 @@
- +/* copied from kernel definition, but with padding replaced
- + * by the corresponding correctly-sized userspace types. */
- +
- +struct stat
- +{
- + dev_t st_dev;
- + ino_t st_ino;
- + mode_t st_mode;
- + nlink_t st_nlink;
- + uid_t st_uid;
- + gid_t st_gid;
- + dev_t st_rdev;
- + off_t st_size;
- + blksize_t st_blksize;
- + long __st_padding1;
- + blkcnt_t st_blocks;
- + struct timespec st_atim;
- + struct timespec st_mtim;
- + struct timespec st_ctim;
- + long __st_padding2[2];
- +};
- diff --git a/arch/xtensa/bits/stdint.h b/arch/xtensa/bits/stdint.h
- new file mode 100644
- index 0000000..d1b2712
- --- /dev/null
- +++ b/arch/xtensa/bits/stdint.h
- @@ -0,0 +1,20 @@
- +typedef int32_t int_fast16_t;
- +typedef int32_t int_fast32_t;
- +typedef uint32_t uint_fast16_t;
- +typedef uint32_t uint_fast32_t;
- +
- +#define INT_FAST16_MIN INT32_MIN
- +#define INT_FAST32_MIN INT32_MIN
- +
- +#define INT_FAST16_MAX INT32_MAX
- +#define INT_FAST32_MAX INT32_MAX
- +
- +#define UINT_FAST16_MAX UINT32_MAX
- +#define UINT_FAST32_MAX UINT32_MAX
- +
- +#define INTPTR_MIN INT32_MIN
- +#define INTPTR_MAX INT32_MAX
- +#define UINTPTR_MAX UINT32_MAX
- +#define PTRDIFF_MIN INT32_MIN
- +#define PTRDIFF_MAX INT32_MAX
- +#define SIZE_MAX UINT32_MAX
- diff --git a/arch/xtensa/bits/syscall.h b/arch/xtensa/bits/syscall.h
- new file mode 100644
- index 0000000..df8c2ab
- --- /dev/null
- +++ b/arch/xtensa/bits/syscall.h
- @@ -0,0 +1,679 @@
- +#define __NR_spill 0
- +#define __NR_xtensa 1
- +#define __NR_available4 2
- +#define __NR_available5 3
- +#define __NR_available6 4
- +#define __NR_available7 5
- +#define __NR_available8 6
- +#define __NR_available9 7
- +#define __NR_open 8
- +#define __NR_close 9
- +#define __NR_dup 10
- +#define __NR_dup2 11
- +#define __NR_read 12
- +#define __NR_write 13
- +#define __NR_select 14
- +#define __NR_lseek 15
- +#define __NR_poll 16
- +#define __NR__llseek 17
- +#define __NR_epoll_wait 18
- +#define __NR_epoll_ctl 19
- +#define __NR_epoll_create 20
- +#define __NR_creat 21
- +#define __NR_truncate 22
- +#define __NR_ftruncate 23
- +#define __NR_readv 24
- +#define __NR_writev 25
- +#define __NR_fsync 26
- +#define __NR_fdatasync 27
- +#define __NR_truncate64 28
- +#define __NR_ftruncate64 29
- +#define __NR_pread64 30
- +#define __NR_pwrite64 31
- +#define __NR_link 32
- +#define __NR_rename 33
- +#define __NR_symlink 34
- +#define __NR_readlink 35
- +#define __NR_mknod 36
- +#define __NR_pipe 37
- +#define __NR_unlink 38
- +#define __NR_rmdir 39
- +#define __NR_mkdir 40
- +#define __NR_chdir 41
- +#define __NR_fchdir 42
- +#define __NR_getcwd 43
- +#define __NR_chmod 44
- +#define __NR_chown 45
- +#define __NR_stat 46
- +#define __NR_stat64 47
- +#define __NR_lchown 48
- +#define __NR_lstat 49
- +#define __NR_lstat64 50
- +#define __NR_available51 51
- +#define __NR_fchmod 52
- +#define __NR_fchown 53
- +#define __NR_fstat 54
- +#define __NR_fstat64 55
- +#define __NR_flock 56
- +#define __NR_access 57
- +#define __NR_umask 58
- +#define __NR_getdents 59
- +#define __NR_getdents64 60
- +#define __NR_fcntl64 61
- +#define __NR_fallocate 62
- +#define __NR_fadvise64_64 63
- +#define __NR_utime 64 /* glibc 2.3.3 ?? */
- +#define __NR_utimes 65
- +#define __NR_ioctl 66
- +#define __NR_fcntl 67
- +#define __NR_setxattr 68
- +#define __NR_getxattr 69
- +#define __NR_listxattr 70
- +#define __NR_removexattr 71
- +#define __NR_lsetxattr 72
- +#define __NR_lgetxattr 73
- +#define __NR_llistxattr 74
- +#define __NR_lremovexattr 75
- +#define __NR_fsetxattr 76
- +#define __NR_fgetxattr 77
- +#define __NR_flistxattr 78
- +#define __NR_fremovexattr 79
- +#define __NR_mmap2 80
- +#define __NR_munmap 81
- +#define __NR_mprotect 82
- +#define __NR_brk 83
- +#define __NR_mlock 84
- +#define __NR_munlock 85
- +#define __NR_mlockall 86
- +#define __NR_munlockall 87
- +#define __NR_mremap 88
- +#define __NR_msync 89
- +#define __NR_mincore 90
- +#define __NR_madvise 91
- +#define __NR_shmget 92
- +#define __NR_shmat 93
- +#define __NR_shmctl 94
- +#define __NR_shmdt 95
- +#define __NR_socket 96
- +#define __NR_setsockopt 97
- +#define __NR_getsockopt 98
- +#define __NR_shutdown 99
- +#define __NR_bind 100
- +#define __NR_connect 101
- +#define __NR_listen 102
- +#define __NR_accept 103
- +#define __NR_getsockname 104
- +#define __NR_getpeername 105
- +#define __NR_sendmsg 106
- +#define __NR_recvmsg 107
- +#define __NR_send 108
- +#define __NR_recv 109
- +#define __NR_sendto 110
- +#define __NR_recvfrom 111
- +#define __NR_socketpair 112
- +#define __NR_sendfile 113
- +#define __NR_sendfile64 114
- +#define __NR_sendmmsg 115
- +#define __NR_clone 116
- +#define __NR_execve 117
- +#define __NR_exit 118
- +#define __NR_exit_group 119
- +#define __NR_getpid 120
- +#define __NR_wait4 121
- +#define __NR_waitid 122
- +#define __NR_kill 123
- +#define __NR_tkill 124
- +#define __NR_tgkill 125
- +#define __NR_set_tid_address 126
- +#define __NR_gettid 127
- +#define __NR_setsid 128
- +#define __NR_getsid 129
- +#define __NR_prctl 130
- +#define __NR_personality 131
- +#define __NR_getpriority 132
- +#define __NR_setpriority 133
- +#define __NR_setitimer 134
- +#define __NR_getitimer 135
- +#define __NR_setuid 136
- +#define __NR_getuid 137
- +#define __NR_setgid 138
- +#define __NR_getgid 139
- +#define __NR_geteuid 140
- +#define __NR_getegid 141
- +#define __NR_setreuid 142
- +#define __NR_setregid 143
- +#define __NR_setresuid 144
- +#define __NR_getresuid 145
- +#define __NR_setresgid 146
- +#define __NR_getresgid 147
- +#define __NR_setpgid 148
- +#define __NR_getpgid 149
- +#define __NR_getppid 150
- +#define __NR_getpgrp 151
- +#define __NR_reserved152 152 /* set_thread_area */
- +#define __NR_reserved153 153 /* get_thread_area */
- +#define __NR_times 154
- +#define __NR_acct 155
- +#define __NR_sched_setaffinity 156
- +#define __NR_sched_getaffinity 157
- +#define __NR_capget 158
- +#define __NR_capset 159
- +#define __NR_ptrace 160
- +#define __NR_semtimedop 161
- +#define __NR_semget 162
- +#define __NR_semop 163
- +#define __NR_semctl 164
- +#define __NR_available165 165
- +#define __NR_msgget 166
- +#define __NR_msgsnd 167
- +#define __NR_msgrcv 168
- +#define __NR_msgctl 169
- +#define __NR_available170 170
- +#define __NR_umount2 171
- +#define __NR_mount 172
- +#define __NR_swapon 173
- +#define __NR_chroot 174
- +#define __NR_pivot_root 175
- +#define __NR_umount 176
- +#define __NR_swapoff 177
- +#define __NR_sync 178
- +#define __NR_syncfs 179
- +#define __NR_setfsuid 180
- +#define __NR_setfsgid 181
- +#define __NR_sysfs 182
- +#define __NR_ustat 183
- +#define __NR_statfs 184
- +#define __NR_fstatfs 185
- +#define __NR_statfs64 186
- +#define __NR_fstatfs64 187
- +#define __NR_setrlimit 188
- +#define __NR_getrlimit 189
- +#define __NR_getrusage 190
- +#define __NR_futex 191
- +#define __NR_gettimeofday 192
- +#define __NR_settimeofday 193
- +#define __NR_adjtimex 194
- +#define __NR_nanosleep 195
- +#define __NR_getgroups 196
- +#define __NR_setgroups 197
- +#define __NR_sethostname 198
- +#define __NR_setdomainname 199
- +#define __NR_syslog 200
- +#define __NR_vhangup 201
- +#define __NR_uselib 202
- +#define __NR_reboot 203
- +#define __NR_quotactl 204
- +#define __NR_nfsservctl 205
- +#define __NR__sysctl 206
- +#define __NR_bdflush 207
- +#define __NR_uname 208
- +#define __NR_sysinfo 209
- +#define __NR_init_module 210
- +#define __NR_delete_module 211
- +#define __NR_sched_setparam 212
- +#define __NR_sched_getparam 213
- +#define __NR_sched_setscheduler 214
- +#define __NR_sched_getscheduler 215
- +#define __NR_sched_get_priority_max 216
- +#define __NR_sched_get_priority_min 217
- +#define __NR_sched_rr_get_interval 218
- +#define __NR_sched_yield 219
- +#define __NR_available222 222
- +#define __NR_restart_syscall 223
- +#define __NR_sigaltstack 224
- +#define __NR_rt_sigreturn 225
- +#define __NR_rt_sigaction 226
- +#define __NR_rt_sigprocmask 227
- +#define __NR_rt_sigpending 228
- +#define __NR_rt_sigtimedwait 229
- +#define __NR_rt_sigqueueinfo 230
- +#define __NR_rt_sigsuspend 231
- +#define __NR_mq_open 232
- +#define __NR_mq_unlink 233
- +#define __NR_mq_timedsend 234
- +#define __NR_mq_timedreceive 235
- +#define __NR_mq_notify 236
- +#define __NR_mq_getsetattr 237
- +#define __NR_available238 238
- +#define __NR_io_setup 239
- +#define __NR_io_destroy 240
- +#define __NR_io_submit 241
- +#define __NR_io_getevents 242
- +#define __NR_io_cancel 243
- +#define __NR_clock_settime 244
- +#define __NR_clock_gettime 245
- +#define __NR_clock_getres 246
- +#define __NR_clock_nanosleep 247
- +#define __NR_timer_create 248
- +#define __NR_timer_delete 249
- +#define __NR_timer_settime 250
- +#define __NR_timer_gettime 251
- +#define __NR_timer_getoverrun 252
- +#define __NR_reserved253 253
- +#define __NR_lookup_dcookie 254
- +#define __NR_available255 255
- +#define __NR_add_key 256
- +#define __NR_request_key 257
- +#define __NR_keyctl 258
- +#define __NR_available259 259
- +#define __NR_readahead 260
- +#define __NR_remap_file_pages 261
- +#define __NR_migrate_pages 262
- +#define __NR_mbind 263
- +#define __NR_get_mempolicy 264
- +#define __NR_set_mempolicy 265
- +#define __NR_unshare 266
- +#define __NR_move_pages 267
- +#define __NR_splice 268
- +#define __NR_tee 269
- +#define __NR_vmsplice 270
- +#define __NR_available271 271
- +#define __NR_pselect6 272
- +#define __NR_ppoll 273
- +#define __NR_epoll_pwait 274
- +#define __NR_epoll_create1 275
- +#define __NR_inotify_init 276
- +#define __NR_inotify_add_watch 277
- +#define __NR_inotify_rm_watch 278
- +#define __NR_inotify_init1 279
- +#define __NR_getcpu 280
- +#define __NR_kexec_load 281
- +#define __NR_ioprio_set 282
- +#define __NR_ioprio_get 283
- +#define __NR_set_robust_list 284
- +#define __NR_get_robust_list 285
- +#define __NR_available286 286
- +#define __NR_available287 287
- +#define __NR_openat 288
- +#define __NR_mkdirat 289
- +#define __NR_mknodat 290
- +#define __NR_unlinkat 291
- +#define __NR_renameat 292
- +#define __NR_linkat 293
- +#define __NR_symlinkat 294
- +#define __NR_readlinkat 295
- +#define __NR_utimensat 296
- +#define __NR_fchownat 297
- +#define __NR_futimesat 298
- +#define __NR_fstatat64 299
- +#define __NR_fchmodat 300
- +#define __NR_faccessat 301
- +#define __NR_available302 302
- +#define __NR_available303 303
- +#define __NR_signalfd 304
- +#define __NR_eventfd 306
- +#define __NR_recvmmsg 307
- +#define __NR_setns 308
- +#define __NR_signalfd4 309
- +#define __NR_dup3 310
- +#define __NR_pipe2 311
- +#define __NR_timerfd_create 312
- +#define __NR_timerfd_settime 313
- +#define __NR_timerfd_gettime 314
- +#define __NR_available315 315
- +#define __NR_eventfd2 316
- +#define __NR_preadv 317
- +#define __NR_pwritev 318
- +#define __NR_available319 319
- +#define __NR_fanotify_init 320
- +#define __NR_fanotify_mark 321
- +#define __NR_process_vm_readv 322
- +#define __NR_process_vm_writev 323
- +#define __NR_name_to_handle_at 324
- +#define __NR_open_by_handle_at 325
- +#define __NR_sync_file_range2 326
- +#define __NR_perf_event_open 327
- +#define __NR_rt_tgsigqueueinfo 328
- +#define __NR_clock_adjtime 329
- +#define __NR_prlimit64 330
- +#define __NR_kcmp 331
- +#define __NR_finit_module 332
- +#define __NR_accept4 333
- +#define __NR_sched_setattr 334
- +#define __NR_sched_getattr 335
- +#define __NR_renameat2 336
- +#define __NR_seccomp 337
- +#define __NR_getrandom 338
- +#define __NR_memfd_create 339
- +#define __NR_bpf 340
- +#define __NR_execveat 341
- +
- +#define SYS_spill 0
- +#define SYS_xtensa 1
- +#define SYS_available4 2
- +#define SYS_available5 3
- +#define SYS_available6 4
- +#define SYS_available7 5
- +#define SYS_available8 6
- +#define SYS_available9 7
- +#define SYS_open 8
- +#define SYS_close 9
- +#define SYS_dup 10
- +#define SYS_dup2 11
- +#define SYS_read 12
- +#define SYS_write 13
- +#define SYS_select 14
- +#define SYS_lseek 15
- +#define SYS_poll 16
- +#define SYS__llseek 17
- +#define SYS_epoll_wait 18
- +#define SYS_epoll_ctl 19
- +#define SYS_epoll_create 20
- +#define SYS_creat 21
- +#define SYS_truncate 22
- +#define SYS_ftruncate 23
- +#define SYS_readv 24
- +#define SYS_writev 25
- +#define SYS_fsync 26
- +#define SYS_fdatasync 27
- +#define SYS_truncate64 28
- +#define SYS_ftruncate64 29
- +#define SYS_pread64 30
- +#define SYS_pwrite64 31
- +#define SYS_link 32
- +#define SYS_rename 33
- +#define SYS_symlink 34
- +#define SYS_readlink 35
- +#define SYS_mknod 36
- +#define SYS_pipe 37
- +#define SYS_unlink 38
- +#define SYS_rmdir 39
- +#define SYS_mkdir 40
- +#define SYS_chdir 41
- +#define SYS_fchdir 42
- +#define SYS_getcwd 43
- +#define SYS_chmod 44
- +#define SYS_chown 45
- +#define SYS_stat 46
- +#define SYS_stat64 47
- +#define SYS_lchown 48
- +#define SYS_lstat 49
- +#define SYS_lstat64 50
- +#define SYS_available51 51
- +#define SYS_fchmod 52
- +#define SYS_fchown 53
- +#define SYS_fstat 54
- +#define SYS_fstat64 55
- +#define SYS_flock 56
- +#define SYS_access 57
- +#define SYS_umask 58
- +#define SYS_getdents 59
- +#define SYS_getdents64 60
- +#define SYS_fcntl64 61
- +#define SYS_fallocate 62
- +#define SYS_fadvise64_64 63
- +#define SYS_utime 64 /* glibc 2.3.3 ?? */
- +#define SYS_utimes 65
- +#define SYS_ioctl 66
- +#define SYS_fcntl 67
- +#define SYS_setxattr 68
- +#define SYS_getxattr 69
- +#define SYS_listxattr 70
- +#define SYS_removexattr 71
- +#define SYS_lsetxattr 72
- +#define SYS_lgetxattr 73
- +#define SYS_llistxattr 74
- +#define SYS_lremovexattr 75
- +#define SYS_fsetxattr 76
- +#define SYS_fgetxattr 77
- +#define SYS_flistxattr 78
- +#define SYS_fremovexattr 79
- +#define SYS_mmap2 80
- +#define SYS_munmap 81
- +#define SYS_mprotect 82
- +#define SYS_brk 83
- +#define SYS_mlock 84
- +#define SYS_munlock 85
- +#define SYS_mlockall 86
- +#define SYS_munlockall 87
- +#define SYS_mremap 88
- +#define SYS_msync 89
- +#define SYS_mincore 90
- +#define SYS_madvise 91
- +#define SYS_shmget 92
- +#define SYS_shmat 93
- +#define SYS_shmctl 94
- +#define SYS_shmdt 95
- +#define SYS_socket 96
- +#define SYS_setsockopt 97
- +#define SYS_getsockopt 98
- +#define SYS_shutdown 99
- +#define SYS_bind 100
- +#define SYS_connect 101
- +#define SYS_listen 102
- +#define SYS_accept 103
- +#define SYS_getsockname 104
- +#define SYS_getpeername 105
- +#define SYS_sendmsg 106
- +#define SYS_recvmsg 107
- +#define SYS_send 108
- +#define SYS_recv 109
- +#define SYS_sendto 110
- +#define SYS_recvfrom 111
- +#define SYS_socketpair 112
- +#define SYS_sendfile 113
- +#define SYS_sendfile64 114
- +#define SYS_sendmmsg 115
- +#define SYS_clone 116
- +#define SYS_execve 117
- +#define SYS_exit 118
- +#define SYS_exit_group 119
- +#define SYS_getpid 120
- +#define SYS_wait4 121
- +#define SYS_waitid 122
- +#define SYS_kill 123
- +#define SYS_tkill 124
- +#define SYS_tgkill 125
- +#define SYS_set_tid_address 126
- +#define SYS_gettid 127
- +#define SYS_setsid 128
- +#define SYS_getsid 129
- +#define SYS_prctl 130
- +#define SYS_personality 131
- +#define SYS_getpriority 132
- +#define SYS_setpriority 133
- +#define SYS_setitimer 134
- +#define SYS_getitimer 135
- +#define SYS_setuid 136
- +#define SYS_getuid 137
- +#define SYS_setgid 138
- +#define SYS_getgid 139
- +#define SYS_geteuid 140
- +#define SYS_getegid 141
- +#define SYS_setreuid 142
- +#define SYS_setregid 143
- +#define SYS_setresuid 144
- +#define SYS_getresuid 145
- +#define SYS_setresgid 146
- +#define SYS_getresgid 147
- +#define SYS_setpgid 148
- +#define SYS_getpgid 149
- +#define SYS_getppid 150
- +#define SYS_getpgrp 151
- +#define SYS_reserved152 152 /* set_thread_area */
- +#define SYS_reserved153 153 /* get_thread_area */
- +#define SYS_times 154
- +#define SYS_acct 155
- +#define SYS_sched_setaffinity 156
- +#define SYS_sched_getaffinity 157
- +#define SYS_capget 158
- +#define SYS_capset 159
- +#define SYS_ptrace 160
- +#define SYS_semtimedop 161
- +#define SYS_semget 162
- +#define SYS_semop 163
- +#define SYS_semctl 164
- +#define SYS_available165 165
- +#define SYS_msgget 166
- +#define SYS_msgsnd 167
- +#define SYS_msgrcv 168
- +#define SYS_msgctl 169
- +#define SYS_available170 170
- +#define SYS_umount2 171
- +#define SYS_mount 172
- +#define SYS_swapon 173
- +#define SYS_chroot 174
- +#define SYS_pivot_root 175
- +#define SYS_umount 176
- +#define SYS_swapoff 177
- +#define SYS_sync 178
- +#define SYS_syncfs 179
- +#define SYS_setfsuid 180
- +#define SYS_setfsgid 181
- +#define SYS_sysfs 182
- +#define SYS_ustat 183
- +#define SYS_statfs 184
- +#define SYS_fstatfs 185
- +#define SYS_statfs64 186
- +#define SYS_fstatfs64 187
- +#define SYS_setrlimit 188
- +#define SYS_getrlimit 189
- +#define SYS_getrusage 190
- +#define SYS_futex 191
- +#define SYS_gettimeofday 192
- +#define SYS_settimeofday 193
- +#define SYS_adjtimex 194
- +#define SYS_nanosleep 195
- +#define SYS_getgroups 196
- +#define SYS_setgroups 197
- +#define SYS_sethostname 198
- +#define SYS_setdomainname 199
- +#define SYS_syslog 200
- +#define SYS_vhangup 201
- +#define SYS_uselib 202
- +#define SYS_reboot 203
- +#define SYS_quotactl 204
- +#define SYS_nfsservctl 205
- +#define SYS__sysctl 206
- +#define SYS_bdflush 207
- +#define SYS_uname 208
- +#define SYS_sysinfo 209
- +#define SYS_init_module 210
- +#define SYS_delete_module 211
- +#define SYS_sched_setparam 212
- +#define SYS_sched_getparam 213
- +#define SYS_sched_setscheduler 214
- +#define SYS_sched_getscheduler 215
- +#define SYS_sched_get_priority_max 216
- +#define SYS_sched_get_priority_min 217
- +#define SYS_sched_rr_get_interval 218
- +#define SYS_sched_yield 219
- +#define SYS_available222 222
- +#define SYS_restart_syscall 223
- +#define SYS_sigaltstack 224
- +#define SYS_rt_sigreturn 225
- +#define SYS_rt_sigaction 226
- +#define SYS_rt_sigprocmask 227
- +#define SYS_rt_sigpending 228
- +#define SYS_rt_sigtimedwait 229
- +#define SYS_rt_sigqueueinfo 230
- +#define SYS_rt_sigsuspend 231
- +#define SYS_mq_open 232
- +#define SYS_mq_unlink 233
- +#define SYS_mq_timedsend 234
- +#define SYS_mq_timedreceive 235
- +#define SYS_mq_notify 236
- +#define SYS_mq_getsetattr 237
- +#define SYS_available238 238
- +#define SYS_io_setup 239
- +#define SYS_io_destroy 240
- +#define SYS_io_submit 241
- +#define SYS_io_getevents 242
- +#define SYS_io_cancel 243
- +#define SYS_clock_settime 244
- +#define SYS_clock_gettime 245
- +#define SYS_clock_getres 246
- +#define SYS_clock_nanosleep 247
- +#define SYS_timer_create 248
- +#define SYS_timer_delete 249
- +#define SYS_timer_settime 250
- +#define SYS_timer_gettime 251
- +#define SYS_timer_getoverrun 252
- +#define SYS_reserved253 253
- +#define SYS_lookup_dcookie 254
- +#define SYS_available255 255
- +#define SYS_add_key 256
- +#define SYS_request_key 257
- +#define SYS_keyctl 258
- +#define SYS_available259 259
- +#define SYS_readahead 260
- +#define SYS_remap_file_pages 261
- +#define SYS_migrate_pages 262
- +#define SYS_mbind 263
- +#define SYS_get_mempolicy 264
- +#define SYS_set_mempolicy 265
- +#define SYS_unshare 266
- +#define SYS_move_pages 267
- +#define SYS_splice 268
- +#define SYS_tee 269
- +#define SYS_vmsplice 270
- +#define SYS_available271 271
- +#define SYS_pselect6 272
- +#define SYS_ppoll 273
- +#define SYS_epoll_pwait 274
- +#define SYS_epoll_create1 275
- +#define SYS_inotify_init 276
- +#define SYS_inotify_add_watch 277
- +#define SYS_inotify_rm_watch 278
- +#define SYS_inotify_init1 279
- +#define SYS_getcpu 280
- +#define SYS_kexec_load 281
- +#define SYS_ioprio_set 282
- +#define SYS_ioprio_get 283
- +#define SYS_set_robust_list 284
- +#define SYS_get_robust_list 285
- +#define SYS_available286 286
- +#define SYS_available287 287
- +#define SYS_openat 288
- +#define SYS_mkdirat 289
- +#define SYS_mknodat 290
- +#define SYS_unlinkat 291
- +#define SYS_renameat 292
- +#define SYS_linkat 293
- +#define SYS_symlinkat 294
- +#define SYS_readlinkat 295
- +#define SYS_utimensat 296
- +#define SYS_fchownat 297
- +#define SYS_futimesat 298
- +#define SYS_fstatat64 299
- +#define SYS_fchmodat 300
- +#define SYS_faccessat 301
- +#define SYS_available302 302
- +#define SYS_available303 303
- +#define SYS_signalfd 304
- +#define SYS_eventfd 306
- +#define SYS_recvmmsg 307
- +#define SYS_setns 308
- +#define SYS_signalfd4 309
- +#define SYS_dup3 310
- +#define SYS_pipe2 311
- +#define SYS_timerfd_create 312
- +#define SYS_timerfd_settime 313
- +#define SYS_timerfd_gettime 314
- +#define SYS_available315 315
- +#define SYS_eventfd2 316
- +#define SYS_preadv 317
- +#define SYS_pwritev 318
- +#define SYS_available319 319
- +#define SYS_fanotify_init 320
- +#define SYS_fanotify_mark 321
- +#define SYS_process_vm_readv 322
- +#define SYS_process_vm_writev 323
- +#define SYS_name_to_handle_at 324
- +#define SYS_open_by_handle_at 325
- +#define SYS_sync_file_range2 326
- +#define SYS_perf_event_open 327
- +#define SYS_rt_tgsigqueueinfo 328
- +#define SYS_clock_adjtime 329
- +#define SYS_prlimit64 330
- +#define SYS_kcmp 331
- +#define SYS_finit_module 332
- +#define SYS_accept4 333
- +#define SYS_sched_setattr 334
- +#define SYS_sched_getattr 335
- +#define SYS_renameat2 336
- +#define SYS_seccomp 337
- +#define SYS_getrandom 338
- +#define SYS_memfd_create 339
- +#define SYS_bpf 340
- +#define SYS_execveat 341
- diff --git a/arch/xtensa/bits/termios.h b/arch/xtensa/bits/termios.h
- new file mode 100644
- index 0000000..f1b32e0
- --- /dev/null
- +++ b/arch/xtensa/bits/termios.h
- @@ -0,0 +1,168 @@
- +struct termios
- +{
- + tcflag_t c_iflag;
- + tcflag_t c_oflag;
- + tcflag_t c_cflag;
- + tcflag_t c_lflag;
- + cc_t c_line;
- + cc_t c_cc[NCCS];
- + speed_t __c_ispeed;
- + speed_t __c_ospeed;
- +};
- +
- +#define VINTR 0
- +#define VQUIT 1
- +#define VERASE 2
- +#define VKILL 3
- +#define VEOF 4
- +#define VTIME 5
- +#define VMIN 6
- +#define VSWTC 7
- +#define VSTART 8
- +#define VSTOP 9
- +#define VSUSP 10
- +#define VEOL 11
- +#define VREPRINT 12
- +#define VDISCARD 13
- +#define VWERASE 14
- +#define VLNEXT 15
- +#define VEOL2 16
- +
- +#define IGNBRK 0000001
- +#define BRKINT 0000002
- +#define IGNPAR 0000004
- +#define PARMRK 0000010
- +#define INPCK 0000020
- +#define ISTRIP 0000040
- +#define INLCR 0000100
- +#define IGNCR 0000200
- +#define ICRNL 0000400
- +#define IUCLC 0001000
- +#define IXON 0002000
- +#define IXANY 0004000
- +#define IXOFF 0010000
- +#define IMAXBEL 0020000
- +#define IUTF8 0040000
- +
- +#define OPOST 0000001
- +#define OLCUC 0000002
- +#define ONLCR 0000004
- +#define OCRNL 0000010
- +#define ONOCR 0000020
- +#define ONLRET 0000040
- +#define OFILL 0000100
- +#define OFDEL 0000200
- +#define NLDLY 0000400
- +#define NL0 0000000
- +#define NL1 0000400
- +#define CRDLY 0003000
- +#define CR0 0000000
- +#define CR1 0001000
- +#define CR2 0002000
- +#define CR3 0003000
- +#define TABDLY 0014000
- +#define TAB0 0000000
- +#define TAB1 0004000
- +#define TAB2 0010000
- +#define TAB3 0014000
- +#define XTABS 0014000
- +#define BSDLY 0020000
- +#define BS0 0000000
- +#define BS1 0020000
- +#define VTDLY 0040000
- +#define VT0 0000000
- +#define VT1 0040000
- +#define FFDLY 0100000
- +#define FF0 0000000
- +#define FF1 0100000
- +
- +#define B0 0000000
- +#define B50 0000001
- +#define B75 0000002
- +#define B110 0000003
- +#define B134 0000004
- +#define B150 0000005
- +#define B200 0000006
- +#define B300 0000007
- +#define B600 0000010
- +#define B1200 0000011
- +#define B1800 0000012
- +#define B2400 0000013
- +#define B4800 0000014
- +#define B9600 0000015
- +#define B19200 0000016
- +#define B38400 0000017
- +#define EXTA 0000016
- +#define EXTB 0000017
- +
- +#define BOTHER 0010000
- +#define B57600 0010001
- +#define B115200 0010002
- +#define B230400 0010003
- +#define B460800 0010004
- +#define B500000 0010005
- +#define B576000 0010006
- +#define B921600 0010007
- +#define B1000000 0010010
- +#define B1152000 0010011
- +#define B1500000 0010012
- +#define B2000000 0010013
- +#define B2500000 0010014
- +#define B3000000 0010015
- +#define B3500000 0010016
- +#define B4000000 0010017
- +
- +#define CBAUD 0010017
- +
- +#define CSIZE 0000060
- +#define CS5 0000000
- +#define CS6 0000020
- +#define CS7 0000040
- +#define CS8 0000060
- +#define CSTOPB 0000100
- +#define CREAD 0000200
- +#define PARENB 0000400
- +#define PARODD 0001000
- +#define HUPCL 0002000
- +#define CLOCAL 0004000
- +
- +#define ISIG 0000001
- +#define ICANON 0000002
- +#define XCASE 0000004
- +#define ECHO 0000010
- +#define ECHOE 0000020
- +#define ECHOK 0000040
- +#define ECHONL 0000100
- +#define NOFLSH 0000200
- +#define TOSTOP 0000400
- +#define ECHOCTL 0001000
- +#define ECHOPRT 0002000
- +#define ECHOKE 0004000
- +#define FLUSHO 0010000
- +#define PENDIN 0040000
- +#define IEXTEN 0100000
- +#define EXTPROC 0200000
- +
- +#define TCOOFF 0
- +#define TCOON 1
- +#define TCIOFF 2
- +#define TCION 3
- +
- +#define TCIFLUSH 0
- +#define TCOFLUSH 1
- +#define TCIOFLUSH 2
- +
- +#define TCSANOW 0
- +#define TCSADRAIN 1
- +#define TCSAFLUSH 2
- +
- +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
- +#define CBAUDEX 0010000
- +#define CIBAUD 002003600000
- +#define IBSHIFT 16
- +#define CMSPAR 010000000000
- +#define CRTSCTS 020000000000
- +#define EXTPROC 0200000
- +#define XTABS 0014000
- +#define TIOCSER_TEMT 1
- +#endif
- diff --git a/arch/xtensa/bits/user.h b/arch/xtensa/bits/user.h
- new file mode 100644
- index 0000000..8ac7526
- --- /dev/null
- +++ b/arch/xtensa/bits/user.h
- @@ -0,0 +1,4 @@
- +#define ELF_NGREG 128
- +#define ELF_NFPREG 18
- +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
- +typedef unsigned int elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
- diff --git a/arch/xtensa/bits/xtensa-config.h b/arch/xtensa/bits/xtensa-config.h
- new file mode 100644
- index 0000000..2e60af9
- --- /dev/null
- +++ b/arch/xtensa/bits/xtensa-config.h
- @@ -0,0 +1,46 @@
- +/* Xtensa configuration settings.
- + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
- + Free Software Foundation, Inc.
- + Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
- +
- + The GNU C Library is free software; you can redistribute it and/or
- + modify it under the terms of the GNU Lesser General Public
- + License as published by the Free Software Foundation; either
- + version 2.1 of the License, or (at your option) any later version.
- +
- + The GNU C Library is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + Lesser General Public License for more details.
- +
- + You should have received a copy of the GNU Lesser General Public
- + License along with the GNU C Library; if not, see
- + <http://www.gnu.org/licenses/>. */
- +
- +#ifndef XTENSA_CONFIG_H
- +#define XTENSA_CONFIG_H
- +
- +/* The macros defined here match those with the same names in the Xtensa
- + compile-time HAL (Hardware Abstraction Layer). Please refer to the
- + Xtensa System Software Reference Manual for documentation of these
- + macros. */
- +
- +/* The following macros reflect the default expectations for Xtensa
- + processor configurations that can run glibc. If you want to try
- + building glibc for an Xtensa configuration that is missing these
- + options, you will at least need to change the values of these
- + macros. */
- +
- +#undef XCHAL_HAVE_NSA
- +#define XCHAL_HAVE_NSA 1
- +
- +#undef XCHAL_HAVE_LOOPS
- +#define XCHAL_HAVE_LOOPS 1
- +
- +/* Assume the maximum number of AR registers. This currently only affects
- + the __window_spill function, and it is always safe to flush extra. */
- +
- +#undef XCHAL_NUM_AREGS
- +#define XCHAL_NUM_AREGS 64
- +
- +#endif /* !XTENSA_CONFIG_H */
- diff --git a/arch/xtensa/crt_arch.h b/arch/xtensa/crt_arch.h
- new file mode 100644
- index 0000000..dc6ddaa
- --- /dev/null
- +++ b/arch/xtensa/crt_arch.h
- @@ -0,0 +1,26 @@
- +__asm__(
- +".begin no-transform\n"
- +".text \n"
- +".global _" START "\n"
- +".global " START "\n"
- +".type _" START ", @function\n"
- +".type " START ", @function\n"
- +"_" START ":\n"
- +"" START ":\n"
- +" call0 2f\n"
- +"1:\n"
- +".align 4\n"
- +".weak _DYNAMIC\n"
- +".hidden _DYNAMIC\n"
- +" .literal .L0, _DYNAMIC\n"
- +" .literal .L1, 1b\n"
- +"2:\n"
- +" mov a6, a1\n"
- +" l32r a7, .L0\n"
- +" l32r a5, .L1\n"
- +" add a7, a7, a0\n"
- +" sub a7, a7, a5\n"
- +" movi a0, 0\n"
- +" call4 " START "_c\n"
- +".end no-transform\n"
- +);
- diff --git a/arch/xtensa/pthread_arch.h b/arch/xtensa/pthread_arch.h
- new file mode 100644
- index 0000000..35c752e
- --- /dev/null
- +++ b/arch/xtensa/pthread_arch.h
- @@ -0,0 +1,11 @@
- +static inline struct pthread *__pthread_self()
- +{
- + register char *tp;
- + __asm__ __volatile__ ("rur %0, threadptr" : "=r" (tp));
- + return (pthread_t)(tp + 8 - sizeof(struct pthread));
- +}
- +
- +#define TLS_ABOVE_TP
- +#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
- +
- +#define MC_PC sc_pc
- diff --git a/arch/xtensa/reloc.h b/arch/xtensa/reloc.h
- new file mode 100644
- index 0000000..bae93a5
- --- /dev/null
- +++ b/arch/xtensa/reloc.h
- @@ -0,0 +1,21 @@
- +#include <endian.h>
- +
- +#if __BYTE_ORDER == __BIG_ENDIAN
- +#define ENDIAN_SUFFIX "eb"
- +#else
- +#define ENDIAN_SUFFIX ""
- +#endif
- +
- +#define LDSO_ARCH "xtensa" ENDIAN_SUFFIX
- +
- +#define TPOFF_K 8
- +
- +#define REL_PLT R_XTENSA_JMP_SLOT
- +#define REL_RELATIVE R_XTENSA_RELATIVE
- +#define REL_GOT R_XTENSA_GLOB_DAT
- +#define REL_COPY R_XTENSA_32
- +#define REL_TPOFF R_XTENSA_TLS_TPOFF
- +//#define REL_TLSDESC R_XTENSA_TLSDESC_FN
- +
- +#define CRTJMP(pc,sp) __asm__ __volatile__( \
- + "movsp a1, %1 ; jx %0" : : "a"(pc), "a"(sp) : "memory" )
- diff --git a/arch/xtensa/syscall_arch.h b/arch/xtensa/syscall_arch.h
- new file mode 100644
- index 0000000..380ce17
- --- /dev/null
- +++ b/arch/xtensa/syscall_arch.h
- @@ -0,0 +1,102 @@
- +#define __SYSCALL_LL_E(x) \
- +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
- +((union { long long ll; long l[2]; }){ .ll = x }).l[1]
- +#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
- +
- +static inline long __syscall0(long n)
- +{
- + register long a2 __asm__("a2") = n;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + :
- + : "memory");
- + return a2;
- +}
- +
- +static inline long __syscall1(long n, long a)
- +{
- + register long a2 __asm__("a2") = n;
- + register long a6 __asm__("a6") = a;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + : "a"(a6)
- + : "memory");
- + return a2;
- +}
- +
- +static inline long __syscall2(long n, long a, long b)
- +{
- + register long a2 __asm__("a2") = n;
- + register long a6 __asm__("a6") = a;
- + register long a3 __asm__("a3") = b;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + : "a"(a6), "a"(a3)
- + : "memory");
- + return a2;
- +}
- +
- +static inline long __syscall3(long n, long a, long b, long c)
- +{
- + register long a2 __asm__("a2") = n;
- + register long a6 __asm__("a6") = a;
- + register long a3 __asm__("a3") = b;
- + register long a4 __asm__("a4") = c;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + : "a"(a6), "a"(a3), "a"(a4)
- + : "memory");
- + return a2;
- +}
- +
- +static inline long __syscall4(long n, long a, long b, long c, long d)
- +{
- + register long a2 __asm__("a2") = n;
- + register long a6 __asm__("a6") = a;
- + register long a3 __asm__("a3") = b;
- + register long a4 __asm__("a4") = c;
- + register long a5 __asm__("a5") = d;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + : "a"(a6), "a"(a3), "a"(a4), "a"(a5)
- + : "memory");
- + return a2;
- +}
- +
- +static inline long __syscall5(long n, long a, long b, long c, long d, long e)
- +{
- + register long a2 __asm__("a2") = n;
- + register long a6 __asm__("a6") = a;
- + register long a3 __asm__("a3") = b;
- + register long a4 __asm__("a4") = c;
- + register long a5 __asm__("a5") = d;
- + register long a8 __asm__("a8") = e;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + : "a"(a6), "a"(a3), "a"(a4), "a"(a5), "a"(a8)
- + : "memory");
- + return a2;
- +}
- +
- +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
- +{
- + register long a2 __asm__("a2") = n;
- + register long a6 __asm__("a6") = a;
- + register long a3 __asm__("a3") = b;
- + register long a4 __asm__("a4") = c;
- + register long a5 __asm__("a5") = d;
- + register long a8 __asm__("a8") = e;
- + register long a9 __asm__("a9") = f;
- +
- + __asm__ __volatile__ ("syscall"
- + : "+&a"(a2)
- + : "a"(a6), "a"(a3), "a"(a4), "a"(a5), "a"(a8), "a"(a9)
- + : "memory");
- + return a2;
- +}
- diff --git a/configure b/configure
- index 0955ce6..2c56cab 100755
- --- a/configure
- +++ b/configure
- @@ -312,6 +312,7 @@ microblaze*) ARCH=microblaze ;;
- or1k*) ARCH=or1k ;;
- powerpc*) ARCH=powerpc ;;
- sh[1-9bel-]*|sh|superh*) ARCH=sh ;;
- +xtensa*) ARCH=xtensa ;;
- unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;;
- *) fail "$0: unknown or unsupported target \"$target\"" ;;
- esac
- diff --git a/crt/xtensa/crti.s b/crt/xtensa/crti.s
- new file mode 100644
- index 0000000..6565656
- --- /dev/null
- +++ b/crt/xtensa/crti.s
- @@ -0,0 +1,11 @@
- +.section .init
- +.global _init
- +.type _init, @function
- +_init:
- + entry a1, 32
- +
- +.section .fini
- +.global _fini
- +.type _fini, @function
- +_fini:
- + entry a1, 32
- diff --git a/crt/xtensa/crtn.s b/crt/xtensa/crtn.s
- new file mode 100644
- index 0000000..7e9a014
- --- /dev/null
- +++ b/crt/xtensa/crtn.s
- @@ -0,0 +1,5 @@
- +.section .init
- + retw
- +
- +.section .fini
- + retw
- diff --git a/include/elf.h b/include/elf.h
- index 8b3cd3e..8168cf1 100644
- --- a/include/elf.h
- +++ b/include/elf.h
- @@ -2819,6 +2819,64 @@ typedef Elf32_Addr Elf32_Conflict;
- #define R_OR1K_TLS_DTPOFF 33
- #define R_OR1K_TLS_DTPMOD 34
-
- +
- +#define DT_XTENSA_GOT_LOC_OFF (DT_LOPROC + 0)
- +#define DT_XTENSA_GOT_LOC_SZ (DT_LOPROC + 1)
- +#define DT_XTENSA_NUM 2
- +
- +#define R_XTENSA_NONE 0
- +#define R_XTENSA_32 1
- +#define R_XTENSA_RTLD 2
- +#define R_XTENSA_GLOB_DAT 3
- +#define R_XTENSA_JMP_SLOT 4
- +#define R_XTENSA_RELATIVE 5
- +#define R_XTENSA_PLT 6
- +#define R_XTENSA_OP0 8
- +#define R_XTENSA_OP1 9
- +#define R_XTENSA_OP2 10
- +#define R_XTENSA_ASM_EXPAND 11
- +#define R_XTENSA_ASM_SIMPLIFY 12
- +#define R_XTENSA_GNU_VTINHERIT 15
- +#define R_XTENSA_GNU_VTENTRY 16
- +#define R_XTENSA_DIFF8 17
- +#define R_XTENSA_DIFF16 18
- +#define R_XTENSA_DIFF32 19
- +#define R_XTENSA_SLOT0_OP 20
- +#define R_XTENSA_SLOT1_OP 21
- +#define R_XTENSA_SLOT2_OP 22
- +#define R_XTENSA_SLOT3_OP 23
- +#define R_XTENSA_SLOT4_OP 24
- +#define R_XTENSA_SLOT5_OP 25
- +#define R_XTENSA_SLOT6_OP 26
- +#define R_XTENSA_SLOT7_OP 27
- +#define R_XTENSA_SLOT8_OP 28
- +#define R_XTENSA_SLOT9_OP 29
- +#define R_XTENSA_SLOT10_OP 30
- +#define R_XTENSA_SLOT11_OP 31
- +#define R_XTENSA_SLOT12_OP 32
- +#define R_XTENSA_SLOT13_OP 33
- +#define R_XTENSA_SLOT14_OP 34
- +#define R_XTENSA_SLOT0_ALT 35
- +#define R_XTENSA_SLOT1_ALT 36
- +#define R_XTENSA_SLOT2_ALT 37
- +#define R_XTENSA_SLOT3_ALT 38
- +#define R_XTENSA_SLOT4_ALT 39
- +#define R_XTENSA_SLOT5_ALT 40
- +#define R_XTENSA_SLOT6_ALT 41
- +#define R_XTENSA_SLOT7_ALT 42
- +#define R_XTENSA_SLOT8_ALT 43
- +#define R_XTENSA_SLOT9_ALT 44
- +#define R_XTENSA_SLOT10_ALT 45
- +#define R_XTENSA_SLOT11_ALT 46
- +#define R_XTENSA_SLOT12_ALT 47
- +#define R_XTENSA_SLOT13_ALT 48
- +#define R_XTENSA_SLOT14_ALT 49
- +#define R_XTENSA_TLSDESC_FN 50
- +#define R_XTENSA_TLSDESC_ARG 51
- +#define R_XTENSA_TLS_TPOFF 53
- +
- +#define R_XTENSA_NUM 54
- +
- #ifdef __cplusplus
- }
- #endif
- diff --git a/ldso/dlstart.c b/ldso/dlstart.c
- index 4dbe178..0249937 100644
- --- a/ldso/dlstart.c
- +++ b/ldso/dlstart.c
- @@ -22,6 +22,7 @@ void _dlstart_c(size_t *sp, size_t *dynv)
- {
- size_t i, aux[AUX_CNT], dyn[DYN_CNT];
- size_t *rel, rel_size, base;
- + unsigned long addr = 1;
-
- int argc = *sp;
- char **argv = (void *)(sp+1);
- @@ -138,7 +139,17 @@ void _dlstart_c(size_t *sp, size_t *dynv)
- for (; rel_size; rel+=3, rel_size-=3*sizeof(size_t)) {
- if (!IS_RELATIVE(rel[1], 0)) continue;
- size_t *rel_addr = (void *)(base + rel[0]);
- - *rel_addr = base + rel[2];
- + if (((unsigned long)rel_addr & -4096) != addr) {
- + addr = (unsigned long)rel_addr & -4096;
- + __asm__ __volatile__ ("movi a2, 82\n\t"
- + "mov a6, %0\n\t"
- + "mov a3, %1\n\t"
- + "mov a4, %2\n\t"
- + "syscall"
- + :: "a"(addr), "a"(4096), "a"(7)
- + : "a2", "a3", "a4", "a6", "memory");
- + }
- + *rel_addr += base + rel[2];
- }
- #endif
-
- diff --git a/ldso/dynlink.c b/ldso/dynlink.c
- index 87f3b7f..1927097 100644
- --- a/ldso/dynlink.c
- +++ b/ldso/dynlink.c
- @@ -314,6 +314,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- size_t tls_val;
- size_t addend;
- int skip_relative = 0, reuse_addends = 0, save_slot = 0;
- + unsigned long addr = 1;
-
- if (dso == &ldso) {
- /* Only ldso's REL table needs addend saving/reuse. */
- @@ -328,6 +329,10 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- if (type == REL_NONE) continue;
- sym_index = R_SYM(rel[1]);
- reloc_addr = laddr(dso, rel[0]);
- + if (((unsigned long)reloc_addr & -4096) != addr) {
- + addr = (unsigned long)reloc_addr & -4096;
- + mprotect((void *)addr, 4096, 7);
- + }
- if (sym_index) {
- sym = syms + sym_index;
- name = strings + sym->st_name;
- @@ -377,7 +382,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- *reloc_addr = sym_val + addend;
- break;
- case REL_RELATIVE:
- - *reloc_addr = (size_t)base + addend;
- + *reloc_addr += (size_t)base + addend;
- break;
- case REL_SYM_OR_REL:
- if (sym) *reloc_addr = sym_val + addend;
- @@ -444,6 +449,40 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
- #endif
- }
- break;
- + case R_XTENSA_RTLD:
- + break;
- + case R_XTENSA_TLSDESC_FN:
- + if (runtime && def.dso->tls_id >= static_tls_cnt) {
- + reloc_addr[0] = (size_t)__tlsdesc_dynamic;
- + } else {
- + reloc_addr[0] = (size_t)__tlsdesc_static;
- + }
- + break;
- + case R_XTENSA_TLSDESC_ARG:
- + if (stride<3) addend = reloc_addr[1];
- + if (runtime && def.dso->tls_id >= static_tls_cnt) {
- + struct td_index *new = malloc(sizeof *new);
- + if (!new) {
- + error(
- + "Error relocating %s: cannot allocate TLSDESC for %s",
- + dso->name, sym ? name : "(local)" );
- + longjmp(*rtld_fail, 1);
- + }
- + new->next = dso->td_index;
- + dso->td_index = new;
- + new->args[0] = def.dso->tls_id;
- + new->args[1] = tls_val + addend;
- + reloc_addr[0] = (size_t)new;
- + } else {
- +#ifdef TLS_ABOVE_TP
- + reloc_addr[0] = tls_val + def.dso->tls.offset
- + + TPOFF_K + addend;
- +#else
- + reloc_addr[0] = tls_val - def.dso->tls.offset
- + + addend;
- +#endif
- + }
- + break;
- default:
- error("Error relocating %s: unsupported relocation type %d",
- dso->name, type);
- diff --git a/src/internal/xtensa/syscall.s b/src/internal/xtensa/syscall.s
- new file mode 100644
- index 0000000..6dc584b
- --- /dev/null
- +++ b/src/internal/xtensa/syscall.s
- @@ -0,0 +1,15 @@
- +.global __syscall
- +.hidden __syscall
- +.type __syscall,@function
- +.align 4
- +__syscall:
- + entry a1, 16
- + mov a8, a3
- + mov a3, a4
- + mov a4, a5
- + mov a5, a6
- + mov a6, a8
- + mov a8, a7
- + l32i a9, a1, 16
- + syscall
- + retw
- diff --git a/src/ldso/xtensa/tlsdesc.s b/src/ldso/xtensa/tlsdesc.s
- new file mode 100644
- index 0000000..5fa846d
- --- /dev/null
- +++ b/src/ldso/xtensa/tlsdesc.s
- @@ -0,0 +1,22 @@
- +.global __tlsdesc_static
- +.hidden __tlsdesc_static
- +.type __tlsdesc_static,@function
- +.align 4
- +__tlsdesc_static:
- + entry a1, 16
- + rur a3, threadptr
- + add a2, a2, a3
- + retw
- +
- +.hidden __tls_get_new
- +
- +.global __tlsdesc_dynamic
- +.hidden __tlsdesc_dynamic
- +.type __tlsdesc_dynamic,@function
- +.align 4
- +__tlsdesc_dynamic:
- + entry a1, 16
- + mov a6, a2
- + call4 __tls_get_addr
- + mov a2, a6
- + retw
- diff --git a/src/setjmp/xtensa/longjmp.s b/src/setjmp/xtensa/longjmp.s
- new file mode 100644
- index 0000000..0b49188
- --- /dev/null
- +++ b/src/setjmp/xtensa/longjmp.s
- @@ -0,0 +1,73 @@
- +.global _longjmp
- +.global longjmp
- +.type _longjmp,%function
- +.type longjmp,%function
- +.align 4
- +_longjmp:
- +longjmp:
- + entry a1, 16
- +
- + /* Invalidate all but the current register window. */
- + call4 __window_spill
- +
- + l32i a0, a2, 64
- + addi a7, a1, -16
- + l32i a4, a2, 0
- + l32i a5, a2, 4
- + s32i a4, a7, 0
- + s32i a5, a7, 4
- + l32i a4, a2, 8
- + l32i a5, a2, 12
- + s32i a4, a7, 8
- + s32i a5, a7, 12
- +
- + /* Copy the remaining 0-8 saved registers. */
- + extui a7, a0, 30, 2
- + blti a7, 2, 2f
- + l32i a8, a2, 52 /* a8: SP of 'caller-1' */
- + slli a4, a7, 4
- + sub a6, a8, a4
- + addi a5, a2, 16
- + addi a8, a8, -16 /* a8: end of overflow area */
- +1:
- + l32i a7, a5, 0
- + l32i a4, a5, 4
- + s32i a7, a6, 0
- + s32i a4, a6, 4
- + l32i a7, a5, 8
- + l32i a4, a5, 12
- + s32i a7, a6, 8
- + s32i a4, a6, 12
- + addi a5, a5, 16
- + addi a6, a6, 16
- + bltu a6, a8, 1b
- +2:
- + /* The 4 words saved from the register save area at the target's
- + * sp are copied back to the target procedure's save area. The
- + * only point of this is to prevent a catastrophic failure in
- + * case the contents were moved by an alloca after calling
- + * setjmp. This is a bit paranoid but it doesn't cost much.
- + */
- +
- + l32i a7, a2, 4 /* load the target stack pointer */
- + addi a7, a7, -16 /* find the destination save area */
- + l32i a4, a2, 48
- + l32i a5, a2, 52
- + s32i a4, a7, 0
- + s32i a5, a7, 4
- + l32i a4, a2, 56
- + l32i a5, a2, 60
- + s32i a4, a7, 8
- + s32i a5, a7, 12
- +
- + l32i a4, a2, 68
- + beqz a4, 1f
- +
- + mov a6, a2
- + movi a7, 1
- +.hidden __sigsetjmp_tail
- + call4 __sigsetjmp_tail
- +1:
- + movi a2, 1
- + movnez a2, a3, a3
- + retw
- diff --git a/src/setjmp/xtensa/setjmp.s b/src/setjmp/xtensa/setjmp.s
- new file mode 100644
- index 0000000..1366af0
- --- /dev/null
- +++ b/src/setjmp/xtensa/setjmp.s
- @@ -0,0 +1,13 @@
- +.global __setjmp
- +.global _setjmp
- +.global setjmp
- +.type __setjmp,@function
- +.type _setjmp,@function
- +.type setjmp,@function
- +.align 4
- +__setjmp:
- +_setjmp:
- +setjmp:
- + entry a1, 16
- + movi a3, 0
- + j ___sigsetjmp
- diff --git a/src/signal/xtensa/restore.s b/src/signal/xtensa/restore.s
- new file mode 100644
- index 0000000..a0c5229
- --- /dev/null
- +++ b/src/signal/xtensa/restore.s
- @@ -0,0 +1,10 @@
- +.global __restore
- +.global __restore_rt
- +.type __restore,%function
- +.type __restore_rt,%function
- +.space 1
- +.align 4
- +__restore:
- +__restore_rt:
- + movi a2, 225 # SYS_rt_sigreturn
- + syscall
- diff --git a/src/signal/xtensa/sigsetjmp.s b/src/signal/xtensa/sigsetjmp.s
- new file mode 100644
- index 0000000..825e182
- --- /dev/null
- +++ b/src/signal/xtensa/sigsetjmp.s
- @@ -0,0 +1,69 @@
- +.global sigsetjmp
- +.global __sigsetjmp
- +.global ___sigsetjmp
- +.type sigsetjmp,%function
- +.type __sigsetjmp,%function
- +.type ___sigsetjmp,%function
- +.align 4
- +sigsetjmp:
- +__sigsetjmp:
- + entry a1, 16
- +
- +___sigsetjmp:
- + call4 __window_spill
- +
- + /* Copy the caller registers a0 - a3 at (sp - 16) to jmpbuf. */
- + addi a7, a1, -16
- + l32i a4, a7, 0
- + l32i a5, a7, 4
- + s32i a4, a2, 0
- + s32i a5, a2, 4
- + l32i a4, a7, 8
- + l32i a5, a7, 12
- + s32i a4, a2, 8
- + s32i a5, a2, 12
- +
- + /* Copy the caller registers a4-a8/a12 from the overflow area. */
- + /* Entry moved the SP by 16 bytes, so SP of caller-1 is at (sp + 4). */
- + extui a7, a0, 30, 2
- + blti a7, 2, 2f
- + l32i a8, a1, 4 /* a8: SP of 'caller-1' */
- + slli a4, a7, 4
- + sub a6, a8, a4
- + addi a5, a2, 16
- + addi a8, a8, -16 /* a8: end of overflow area */
- +1:
- + l32i a7, a6, 0
- + l32i a4, a6, 4
- + s32i a7, a5, 0
- + s32i a4, a5, 4
- + l32i a7, a6, 8
- + l32i a4, a6, 12
- + s32i a7, a5, 8
- + s32i a4, a5, 12
- + addi a5, a5, 16
- + addi a6, a6, 16
- + bltu a6, a8, 1b
- +2:
- + /* Copy caller-1 registers a0 - a3 (this is assuming entry a1, 16) */
- + l32i a4, a1, 0
- + l32i a5, a1, 4
- + s32i a4, a2, 48
- + s32i a5, a2, 52
- + l32i a4, a1, 8
- + l32i a5, a1, 12
- + s32i a4, a2, 56
- + s32i a5, a2, 60
- +
- + /* Save the return address, including the window size bits. */
- + s32i a0, a2, 64
- + s32i a3, a2, 68
- + beqz a3, 1f
- +
- + mov a6, a2
- + movi a7, 0
- +.hidden __sigsetjmp_tail
- + call4 __sigsetjmp_tail
- +1:
- + movi a2, 0
- + retw
- diff --git a/src/signal/xtensa/windowspill.s b/src/signal/xtensa/windowspill.s
- new file mode 100644
- index 0000000..7ab7f3d
- --- /dev/null
- +++ b/src/signal/xtensa/windowspill.s
- @@ -0,0 +1,78 @@
- +#include <bits/xtensa-config.h>
- +
- +#ifdef __XTENSA_WINDOWED_ABI__
- +.global __window_spill
- +.type __window_spill, @function
- +.align 4
- +__window_spill:
- + entry a1, 48
- + bbci.l a0, 31, .L4 /* branch if called with call4 */
- + bbsi.l a0, 30, .L12 /* branch if called with call12 */
- +
- + /* Called with call8: touch register NUM_REGS-12 (4/20/52) */
- +.L8:
- +#if XCHAL_NUM_AREGS > 16
- + call12 1f
- + retw
- +
- + .align 4
- +1: _entry a1, 48 /* touch NUM_REGS-24 (x/8/40) */
- +
- +#if XCHAL_NUM_AREGS == 32
- + mov a8, a0
- + retw
- +#else
- + mov a12, a0
- + _entry a1, 48 /* touch NUM_REGS-36 (x/x/28) */
- + mov a12, a0
- + _entry a1, 48 /* touch NUM_REGS-48 (x/x/16) */
- + mov a12, a0
- + _entry a1, 16 /* touch NUM_REGS-60 (x/x/4) */
- +#endif
- +#endif
- + mov a4, a0
- + retw
- +
- + /* Called with call4: touch register NUM_REGS-8 (8/24/56) */
- +.L4:
- +#if XCHAL_NUM_AREGS == 16
- + mov a8, a0
- +#else
- + call12 1f
- + retw
- +
- + .align 4
- +1: _entry a1, 48 /* touch NUM_REGS-20 (x/12/44) */
- + mov a12, a0
- +#if XCHAL_NUM_AREGS > 32
- + _entry a1, 48 /* touch NUM_REGS-32 (x/x/32) */
- + mov a12, a0
- + _entry a1, 48 /* touch NUM_REGS-44 (x/x/20) */
- + mov a12, a0
- + _entry a1, 48 /* touch NUM_REGS-56 (x/x/8) */
- + mov a8, a0
- +#endif
- +#endif
- + retw
- +
- + /* Called with call12: touch register NUM_REGS-16 (x/16/48) */
- +.L12:
- +#if XCHAL_NUM_AREGS > 16
- + call12 1f
- + retw
- +
- + .align 4
- +1: _entry a1, 48 /* touch NUM_REGS-28 (x/4/36) */
- +#if XCHAL_NUM_AREGS == 32
- + mov a4, a0
- +#else
- + mov a12, a0
- + _entry a1, 48 /* touch NUM_REGS-40 (x/x/24) */
- + mov a12, a0
- + _entry a1, 48 /* touch NUM_REGS-52 (x/x/12) */
- + mov a12, a0
- +#endif
- +#endif
- + retw
- +
- +#endif
- diff --git a/src/thread/xtensa/__set_thread_area.s b/src/thread/xtensa/__set_thread_area.s
- new file mode 100644
- index 0000000..4fe97ac
- --- /dev/null
- +++ b/src/thread/xtensa/__set_thread_area.s
- @@ -0,0 +1,8 @@
- +.global __set_thread_area
- +.type __set_thread_area,@function
- +.align 4
- +__set_thread_area:
- + entry a1, 16
- + wur a2, threadptr
- + movi a2, 0
- + retw
- diff --git a/src/thread/xtensa/__unmapself.s b/src/thread/xtensa/__unmapself.s
- new file mode 100644
- index 0000000..c5d8f54
- --- /dev/null
- +++ b/src/thread/xtensa/__unmapself.s
- @@ -0,0 +1,10 @@
- +.global __unmapself
- +.type __unmapself,%function
- +.align 4
- +__unmapself:
- + entry a1, 16
- + mov a6, a2
- + movi a2, 81 # SYS_munmap
- + syscall
- + movi a2, 118 # SYS_exit
- + syscall
- diff --git a/src/thread/xtensa/clone.s b/src/thread/xtensa/clone.s
- new file mode 100644
- index 0000000..c75db81
- --- /dev/null
- +++ b/src/thread/xtensa/clone.s
- @@ -0,0 +1,39 @@
- +// __clone(func, stack, flags, arg, ptid, tls, ctid)
- +// a2, a3, a4, a5, a6, a7, [sp]
- +
- +// syscall(SYS_clone, flags, stack, ptid, tls, ctid)
- +// a2, a6, a3, a4, a5, a8
- +
- +.global __clone
- +.type __clone,%function
- +.align 4
- +__clone:
- + entry a1, 16
- + // align stack and save func,arg
- + srli a3, a3, 4
- + slli a3, a3, 4
- + addi a3, a3, -16
- + s32i a2, a3, 0
- + s32i a5, a3, 4
- +
- + // syscall
- + mov a2, a4
- + mov a4, a6
- + mov a6, a2
- + mov a5, a7
- + l32i a8, a1, 16
- + movi a2, 116 # SYS_clone
- + syscall
- +
- + beqz a2, 1f
- + // parent
- + retw
- +
- + // child
- +1:
- + movi a0, 0
- + l32i a4, a1, 0
- + l32i a6, a1, 4
- + callx4 a4
- + movi a2, 118 # SYS_exit
- + syscall
- diff --git a/src/thread/xtensa/syscall_cp.s b/src/thread/xtensa/syscall_cp.s
- new file mode 100644
- index 0000000..f68df8d
- --- /dev/null
- +++ b/src/thread/xtensa/syscall_cp.s
- @@ -0,0 +1,37 @@
- +// __syscall_cp_asm(&self->cancel, nr, u, v, w, x, y, z)
- +// a2 a3 a4 a5 a6 a7 [sp] [sp+4]
- +
- +// syscall(nr, u, v, w, x, y, z)
- +// a2 a6 a3 a4 a5 a8 a9
- +
- +.global __cp_begin
- +.hidden __cp_begin
- +.global __cp_end
- +.hidden __cp_end
- +.global __cp_cancel
- +.hidden __cp_cancel
- +.hidden __cancel
- +.global __syscall_cp_asm
- +.hidden __syscall_cp_asm
- +.type __syscall_cp_asm,%function
- +.align 4
- +__syscall_cp_asm:
- + entry a1, 16
- +__cp_begin:
- + l32i a2, a2, 0
- + bnez a2, __cp_cancel
- + mov a2, a4
- + mov a4, a6
- + mov a6, a2
- + mov a2, a3
- + mov a3, a5
- + mov a5, a7
- + l32i a8, a1, 16
- + l32i a9, a1, 20
- + syscall
- +__cp_end:
- + retw
- +__cp_cancel:
- + call4 __cancel
- + mov a2, a6
- + retw
- --
- 2.1.4
|