~ubuntu-branches/ubuntu/saucy/nspr/saucy-updates

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/include/md/_linux.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2008-05-21 14:50:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080521145002-cr27w44je0vttvwb
Tags: 4.7.1+1.9-0ubuntu1
* New upstream release, picked from FIREFOX_3_0rc1_RELEASE cvs tag
  (LP: #233922)
* update diverged patches
  - update debian/patches/30_pkgconfig.patch
  - update debian/patches/81_sonames.patch
  - update debian/patches/99_configure.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
/* ***** BEGIN LICENSE BLOCK *****
3
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
4
 *
207
207
})
208
208
#endif
209
209
 
 
210
#if defined(__arm__) && defined(_PR_ARM_KUSER)
 
211
#define _PR_HAVE_ATOMIC_OPS
 
212
#define _MD_INIT_ATOMIC()
 
213
 
 
214
/*
 
215
 * The kernel provides this helper function at a fixed address with a fixed
 
216
 * ABI signature, directly callable from user space.
 
217
 *
 
218
 * Definition:
 
219
 * Atomically store newval in *ptr if *ptr is equal to oldval.
 
220
 * Return zero if *ptr was changed or non-zero if no exchange happened.
 
221
 */
 
222
typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
 
223
#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *)0xffff0fc0)
 
224
 
 
225
#define _MD_ATOMIC_INCREMENT(ptr) _MD_ATOMIC_ADD(ptr, 1)
 
226
#define _MD_ATOMIC_DECREMENT(ptr) _MD_ATOMIC_ADD(ptr, -1)
 
227
 
 
228
static inline PRInt32 _MD_ATOMIC_ADD(PRInt32 *ptr, PRInt32 n)
 
229
{
 
230
    PRInt32 ov, nv;
 
231
    volatile PRInt32 *vp = ptr;
 
232
 
 
233
    do {
 
234
        ov = *vp;
 
235
        nv = ov + n;
 
236
    } while (__kernel_cmpxchg(ov, nv, vp));
 
237
 
 
238
    return nv;
 
239
}
 
240
 
 
241
static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *ptr, PRInt32 nv)
 
242
{
 
243
    PRInt32 ov;
 
244
    volatile PRInt32 *vp = ptr;
 
245
 
 
246
    do {
 
247
        ov = *vp;
 
248
    } while (__kernel_cmpxchg(ov, nv, vp));
 
249
 
 
250
    return ov;
 
251
}
 
252
#endif
 
253
 
210
254
#define USE_SETJMP
211
255
#if defined(__GLIBC__) && __GLIBC__ >= 2
212
256
#define _PR_POLL_AVAILABLE
398
442
        _main();  \
399
443
    }  \
400
444
    _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
401
 
        _thread->md.sp = _MD_GET_SP_PTR(_thread); \
402
 
        _thread->md.fp = _MD_GET_FP_PTR(_thread); \
 
445
    _thread->md.sp = _MD_GET_SP_PTR(_thread); \
 
446
    _thread->md.fp = _MD_GET_FP_PTR(_thread); \
403
447
    _MD_SET_FP(_thread, 0); \
404
448
}
405
449
 
425
469
        _main();  \
426
470
    }  \
427
471
    _MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
428
 
        _thread->md.sp = _MD_GET_SP_PTR(_thread); \
429
 
        _thread->md.fp = _MD_GET_FP_PTR(_thread); \
 
472
    _thread->md.sp = _MD_GET_SP_PTR(_thread); \
 
473
    _thread->md.fp = _MD_GET_FP_PTR(_thread); \
430
474
    _MD_SET_FP(_thread, 0); \
431
475
}
432
476
 
452
496
 
453
497
struct _MDThread {
454
498
    PR_CONTEXT_TYPE context;
455
 
        void *sp;
456
 
        void *fp;
 
499
    void *sp;
 
500
    void *fp;
457
501
    int id;
458
502
    int errcode;
459
503
};
492
536
#ifndef _PR_USE_POLL
493
537
    fd_set fd_read_set, fd_write_set, fd_exception_set;
494
538
    PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
495
 
                                fd_exception_cnt[_PR_MD_MAX_OSFD];
 
539
            fd_exception_cnt[_PR_MD_MAX_OSFD];
496
540
#else
497
 
        struct pollfd *ioq_pollfds;
498
 
        int ioq_pollfds_size;
 
541
    struct pollfd *ioq_pollfds;
 
542
    int ioq_pollfds_size;
499
543
#endif  /* _PR_USE_POLL */
500
544
};
501
545
 
516
560
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)  32
517
561
 
518
562
struct _MDCPU {
519
 
        struct _MDCPU_Unix md_unix;
 
563
    struct _MDCPU_Unix md_unix;
520
564
};
521
565
 
522
566
#define _MD_INIT_LOCKS()
556
600
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
557
601
 
558
602
#define _MD_EARLY_INIT                  _MD_EarlyInit
559
 
#define _MD_FINAL_INIT                                  _PR_UnixInit
 
603
#define _MD_FINAL_INIT                  _PR_UnixInit
560
604
#define _MD_GET_INTERVAL                _PR_UNIX_GetInterval
561
605
#define _MD_INTERVAL_PER_SEC            _PR_UNIX_TicksPerSecond
562
606