[Linux-hls-cvs] hls/linux-2.6/include Makefile,NONE,1.1 bitfields.h,NONE,1.1 data.h,NONE,1.1 debug-f
Status: Pre-Alpha
Brought to you by:
lucabe
Update of /cvsroot/linux-hls/hls/linux-2.6/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10942/include Added Files: Makefile bitfields.h data.h debug-funcs.h funcs.h hls.h i386-muldiv.h interface-data.h interface-funcs.h ppc-muldiv.h Log Message: Beginning of a 2.6 backend... Does not work yet! --- NEW FILE: interface-funcs.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: interface-funcs.h * Abstract: Kernel-dependent bits of the HLS API - Functions. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __INTERFACE_FUNCS__ #define __INTERFACE_FUNCS__ #include <linux/config.h> #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS) #define MODVERSIONS #endif #ifdef MODVERSIONS //#include <linux/modversions.h> #endif #include <linux/module.h> #include <linux/init.h> #include <asm/uaccess.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/list.h> #ifdef __MULDIV__ #include <muldiv.h> #endif #include "bitfields.h" #ifndef CONFIG_GENERIC_SCHEDULER #error Generic Scheduler is not enabled!!! #endif #ifdef __LOG_DEVICE__ #include "logger.h" #define hls_printk log_printf #else #define hls_printk printk #endif #define hls_hard_printk printk #define DbgPrint printk #if 0 #define hls_panic panic #else #define hls_panic(a) BUG() #endif #define LIST_NEXT_ENTRY(l) (l->next) extern inline void *hls_malloc (int size) { return kmalloc (size, GFP_ATOMIC); } extern inline void hls_free (void *mem) { kfree (mem); } #define KeQueryTimeIncrement() (1000000L / HZ) * 10 #endif /* __INTERFACE_FUNCS__ */ --- NEW FILE: Makefile --- muldiv.h: ln -s $(ARCH)-muldiv.h muldiv.h --- NEW FILE: hls.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: hls.h * Abstract: Kernel-dependent data needed by HLS. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __HLS_H__ #define __HLS_H__ struct hls_struct { int boh; }; #endif /* __HLS_H__ */ --- NEW FILE: bitfields.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: bitfields.h * Abstract: As said below, a hack! * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ /* This is clearly a hack! */ extern unsigned char KiFindLeftNibbleBitTable[]; /* Hasn't Linux anything similar? */ #define FindFirstSetLeftMember(Set, Member) { \ ULONG _Bit; \ ULONG _Mask; \ ULONG _Offset = 16; \ if ((_Mask = Set >> 16) == 0) { \ _Offset = 0; \ _Mask = Set; \ } \ if (_Mask >> 8) { \ _Offset += 8; \ } \ if ((_Bit = Set >> _Offset) & 0xf0) { \ _Bit >>= 4; \ _Offset += 4; \ } \ *(Member) = KiFindLeftNibbleBitTable[_Bit] + _Offset; \ } #define ClearMember(Member, Set) \ do { \ Set = Set & (~(1 << (Member))); \ } /*lint --e(717)*/ while (0); #define SetMember(Member, Set) \ do { \ Set = Set | (1 << (Member)); \ } /*lint --e(717)*/ while (0); --- NEW FILE: debug-funcs.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: debug-funcs.h * Abstract: Kernel-dependent bits of the debugging functions. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __DEBUG_FUNCS_H__ #define __DEBUG_FUNCS_H__ #define current_task() current #define th_id(t) (t->pid) #endif /* __DEBUG_FUNCS_H__ */ --- NEW FILE: interface-data.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: interface-data.h * Abstract: Kernel-dependent bits of the HLS API - Data. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __INTERFACE_DATA__ #define __INTERFACE_DATA__ #define LIST_ENTRY struct list_head typedef LIST_ENTRY *PRLIST_ENTRY; #define SCHAR signed char #define ULONG unsigned long typedef long long _int64; typedef long int WNT_TIME; /* FIXME: This must be removed! */ #define MAXIMUM_PROCESSORS 32 #define KTIMER struct timer_list #define PROCT ULONG #define KPRIORITY int #define HLS_MAXIMUM_PRIORITY 32 /* FIXME: Shouldn't this go in rr.h??? */ #define CONTAINING_RECORD(address, type, field) ((type *)( \ (char *)(address) - \ (unsigned long)(&((type *)0)->field))) typedef enum _HLS_BOOL { HLS_FALSE = 0, HLS_TRUE = 0x600 // don't change this value } HLS_BOOL; typedef enum _HLS_STATUS { HLS_SUCCESS = 0xadd0, HLS_NOROOM, HLS_INVALID_PARAMETER } HLS_STATUS; #endif /* __INTERFACE_DATA__ */ --- NEW FILE: i386-muldiv.h --- /* This comes from RTAI... Please, adjust the license stuff!!! */ static inline unsigned long long ulldiv(unsigned long long ull, unsigned long uld, unsigned long *r) { unsigned long long q, rf; unsigned long qh, rh, ql, qf; q = 0; rf = (unsigned long long)(0xFFFFFFFF - (qf = 0xFFFFFFFF / uld) * uld) + 1ULL; while (ull >= uld) { ((unsigned long *)&q)[1] += (qh = ((unsigned long *)&ull)[1] / uld); rh = ((unsigned long *)&ull)[1] - qh * uld; q += rh * (unsigned long long)qf + (ql = ((unsigned long *)&ull)[0] / uld); ull = rh * rf + (((unsigned long *)&ull)[0] - ql * uld); } *r = ull; return q; } // returns (long long)ll = (int)ll*(int)(mult)/(int)div. static inline long long llimd(long long ll, int mult, int div) { __asm__ __volatile (\ "movl %%edx,%%ecx; mull %%esi; movl %%eax,%%ebx; \n\t" "movl %%ecx,%%eax; movl %%edx,%%ecx; mull %%esi; \n\t" "addl %%ecx,%%eax; adcl $0,%%edx; divl %%edi; \n\t" "movl %%eax,%%ecx; movl %%ebx,%%eax; divl %%edi; \n\t" "sal $1,%%edx; cmpl %%edx,%%edi; movl %%ecx,%%edx; \n\t" "jge 1f; addl $1,%%eax; adcl $0,%%edx; 1:" : "=A" (ll) : "A" (ll), "S" (mult), "D" (div) : "%ebx", "%ecx"); return ll; } --- NEW FILE: funcs.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: funcs.h * Abstract: Kernel-dependent functions needed by HLS. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __FUNCS__ #define __FUNCS__ #define th_cpu(t) (t->thread_info->cpu) #define rt_priority(t) (t->rt_priority) #define HLS_DATA(t) (t->private_data) /* From linux/kernel/sched.h */ #ifdef CONFIG_SMP #define idle_task(cpu) (init_tasks[cpu_number_map(cpu)]) #define can_schedule(p,cpu) \ ((p)->cpus_runnable & (p)->cpus_allowed & (1 << cpu)) #else #define idle_task(cpu) (&init_task) #define can_schedule(p,cpu) (1) #endif #endif /* __FUNCS__ */ --- NEW FILE: ppc-muldiv.h --- /* This comes from RTAI... Please, adjust the license stuff!!! */ static inline unsigned long long ullmul(unsigned long m0, unsigned long m1) { unsigned long long res; __asm__ __volatile__ ("mulhwu %0, %1, %2" : "=r" (((unsigned long *)&res)[0]) : "%r" (m0), "r" (m1)); ((unsigned long *)&res)[1] = m0 * m1; return res; } static inline unsigned long long ulldiv(unsigned long long ull, unsigned long uld, unsigned long *r) { unsigned long long q, rf; unsigned long qh, rh, ql, qf; q = 0; rf = (unsigned long long)(0xFFFFFFFF - (qf = 0xFFFFFFFF / uld) * uld) + 1ULL; while (ull >= uld) { ((unsigned long *)&q)[0] += (qh = ((unsigned long *)&ull)[0] / uld); rh = ((unsigned long *)&ull)[0] - qh * uld; q += rh * (unsigned long long)qf + (ql = ((unsigned long *)&ull)[1] / uld); ull = rh * rf + (((unsigned long *)&ull)[1] - ql * uld); } *r = ull; return q; } // returns (long long)ll = (int)ll*(int)(mult)/(int)div. static inline unsigned long long llimd(unsigned long long ull, unsigned long mult, unsigned long div) { unsigned long long low; unsigned long q, r; low = ullmul(((unsigned long *)&ull)[1], mult); q = ulldiv(ullmul(((unsigned long *)&ull)[0], mult) + ((unsigned long *)&low)[0], div, (unsigned long *)&low); low = ulldiv(low, div, &r); ((unsigned long *)&low)[0] += q; return (r + r) > div ? low + 1 : low; } --- NEW FILE: data.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: data.h * Abstract: HLS data * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __DATA__ #define __DATA__ #define BOOLEAN int #define TRUE 1 #define FALSE 0 #define HANDLE void * #define VOID void #define KTHREAD_STATE long #define PRKTHREAD struct task_struct * #define PKTHREAD struct task_struct * #define HLS_READY_REASON int #define HLS_FASTCALL /* Linux Real-Time priorities go from 0 to 99 */ #define HLS_SCHEDULING_PRIORITY 100 /* The priority is computed as 1000 + rt_priority... * with rp_priority = -2000, it results -1000 * and the task will never be scheduled */ #define HLS_IDLE_PRIORITY -2000 typedef enum _HLS_CTL_COMMAND { HLS_CMD_DUMP_COUNTS = 100, HLS_CMD_WHICH_PROC = 101, HLS_CMD_SET_DEBUG_LEVEL = 102, HLS_CMD_RES = 103, HLS_CMD_SET_TIMERRES = 104, HLS_CMD_GET_STOLEN = 105, HLS_CMD_LIST_RES = 106, HLS_CMD_END_RES = 107, HLS_CMD_NEW_INSTANCE = 108, HLS_CMD_SET_SHARE = 109, HLS_CMD_SET_DEFAULT = 110, HLS_CMD_DESTROY_INSTANCE = 111, HLS_CMD_NULL_MSG = 112, HLS_CMD_MOVE_THREAD = 113 } HLS_CTL_COMMAND; struct hls_param { unsigned long int signature; HLS_CTL_COMMAND command; char *scheduler; int sched_data_size; void *sched_data; }; #define SCHED_HLS 10 #define HLS_SIGNATURE 0x56 #endif /* __DATA__ */ |