Commit Graph

116 Commits

Author SHA1 Message Date
joerg
c85a3e95f7 netchild's mega-patch to isolate compiler dependencies into a central
place.

This moves the dependency on GCC's and other compiler's features into
the central sys/cdefs.h file, while the individual source files can
then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to
refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42.

By now, GCC and ICC (the Intel compiler) have been actively tested on
IA32 platforms by netchild.  Extension to other compilers is supposed
to be possible, of course.

Submitted by:	netchild
Reviewed by:	various developers on arch@, some time ago
2005-03-02 21:33:29 +00:00
cognet
43586d701a Instead of using sysarch() to store-retrieve the tp, add a magic address,
ARM_TP_ADDRESS, where the tp will be stored. On CPUs that support it, a cache
line will be allocated and locked for this address, so that it will never go
to RAM. On CPUs that does not, a page is allocated for it (it will be a bit
slower, and is wrong for SMP, but should be fine for UP).
The tp is still stored in the mdthread struct, and at each context switch,
ARM_TP_ADDRESS gets updated.

Suggested by:   davidxu
2005-02-26 18:59:01 +00:00
cognet
ea8a18c379 Add the field in the md part of the struct thread required by ARM_[GET|SET]_TP. 2005-02-26 00:02:14 +00:00
cognet
3aab487108 Implement two new sysarch for arm, ARM_GET_TP and ARM_SET_TP, to work around
the lack of tls on arm.
2005-02-25 22:56:16 +00:00
ru
6cc6926066 Use a common multi-inclusion protection, and add such a
protection to alpha/include/exec.h.
2005-02-19 21:16:48 +00:00
cognet
19a07769b7 Define NIRQ to 64 for CPU_ARM9, because Cirrus Logic EP93XX cores provides
64 irqs.
This should be re-thought later.
2005-02-13 18:26:31 +00:00
njl
2579b2e0bf Sort functions. 2005-02-01 06:36:27 +00:00
cognet
ab7ed627f8 Start to support the big endian case as well. 2005-01-18 15:51:50 +00:00
cognet
897fdcefd3 Add the prototype for bus_dmamap_load_mbuf_sg().
Spotted out by:	scottl
2005-01-15 19:31:08 +00:00
cognet
14d3ee495d Add support for ptrace() and gdb breakpoints. 2005-01-10 22:43:16 +00:00
imp
77267e277f Start all license statements with /*- 2005-01-05 21:58:49 +00:00
cognet
5b61dc111e Make sure gcc doesn't generate something such as swp r3, r4, [r3] for __swp,
as it has unpredictable results.
2004-12-18 17:43:01 +00:00
cognet
8c5a104a40 Remove an unused field from the struct pv_entry.
While I'm there, fix style.
2004-12-05 22:46:30 +00:00
cognet
22b168ab24 Implement breakpoints and single stepping on arm.
Obtained from:	NetBSD
2004-11-21 18:11:39 +00:00
cognet
75354c7e52 Implement enough to be able to enter and leave DDB. 2004-11-20 16:52:10 +00:00
cognet
c2bbd5fdeb Get the kernel stack right now that the u-area is gone. 2004-11-20 16:51:32 +00:00
das
dbdcb7be99 Remove UAREA_PAGES and USPACE definitions. The definitions of
USPACE_SVC_STACK_TOP, USPACE_SVC_STACK_BOTTOM, USPACE_UNDEF_STACK_TOP,
and USPACE_UNDEF_STACK_BOTTOM look wrong to me, so I'm leaving them
alone.

Reviewed by:	arch@
2004-11-20 02:31:37 +00:00
cognet
601293a498 Import a RET macro, that will use bx if the arch supports it.
Obtained from:	NetBSD
2004-11-09 16:45:55 +00:00
cognet
103e95586e Import md bits for mem(4) on arm.
While I'm there, cleanup a bit pmap.h.
2004-11-07 23:01:36 +00:00
cognet
78386f3ec2 Disable interrupts for atomic_cmpset_32, this one is just not atomic.
Don't export it to userland.
2004-11-05 23:48:12 +00:00
cognet
65c874982c Protect the function declarations with #ifdef _KERNEL. 2004-11-04 19:20:54 +00:00
cognet
f877e8fb34 Directly use __pcpu for PCPU_* instead of pcpup. 2004-11-04 19:19:44 +00:00
cognet
b06553ff94 Decrease KSTACK_PAGES and UAREA_PAGES. 2004-11-04 19:19:21 +00:00
cognet
a9cde5c028 Use interrupts_disable() and interrupts_restore() as intr_disable() and
intr_restore() instead of re-implement it.
2004-11-04 19:18:50 +00:00
cognet
174862f7bb Don't barf if no CPU type is defined while compiling kernel modules. 2004-11-04 19:16:31 +00:00
cognet
ad6f843dc2 Implement get_cyclecount(). 2004-11-04 19:15:43 +00:00
cognet
4603da4464 Try to implement atomic operations using swp, instead of disabling interrupts. 2004-11-04 19:14:50 +00:00
cognet
827366c155 Use casts to enforce the return type of bswap16() and bswap32(). 2004-11-04 19:07:28 +00:00
cognet
d3c9c2ab1a Add optimized version of the bswap macroes for constants if __OPTIMIZED__ is
defined.
2004-10-01 16:55:59 +00:00
cognet
f7c7e8938b Remove the empty definition of struct osigcontext, as it will never be used. 2004-09-23 22:31:49 +00:00
cognet
9fbf5b30d2 Remove the pcb32_cstate field of struct pcb. 2004-09-23 22:31:08 +00:00
cognet
320e303913 Declare sigcode and szsigcode. 2004-09-23 22:30:05 +00:00
cognet
eb21c958c3 Define VM_PROT_READ_IS_EXEC. 2004-09-23 22:29:43 +00:00
cognet
23f2e2a20b Implement _mcount().
Obtained from:	NetBSD
2004-09-23 22:29:18 +00:00
cognet
bce0b28077 Define STACKALIGNBYTES and STACKALIGN. 2004-09-23 22:27:42 +00:00
cognet
6198d361e4 We are using _mcount, not __mcount.
Remove the !__ELF__ case.
2004-09-23 22:26:29 +00:00
cognet
f0ee02d552 Add new functions to know which irqs are pending, and to mask and unmask
interrupts, as these are CPU specific.
If the interrupt handler is not marked as INTR_FAST, don't unmask the
interrupt until it as been serviced.
2004-09-23 22:09:57 +00:00
cognet
8cbf7c308c Rename macroes, as we don't need to mess with alignment faults.
Call ast() if TDF_NEEDRESCHED is set too, not just TDF_ASTPENDING.
2004-09-23 22:05:40 +00:00
cognet
fa3fe38872 Remove bus_space_vaddr(), it does not exists in FreeBSD. 2004-09-23 21:59:14 +00:00
cognet
7dea985306 Add MD syscalls to sync the icache and to drain the write buffer.
Obtained from:	NetBSD
2004-09-23 21:56:01 +00:00
cognet
639630ead7 Implement pmap_growkernel() and pmap_extract_and_hold().
Remove the cache state logic : right now, it provides more problems than it
helps.
Add helper functions for mapping devices while bootstrapping.
Reorganize the code a bit, and remove dead code.

Obtained from:	NetBSD (partially)
2004-09-23 21:54:25 +00:00
marcel
01fd13440d Move the kernel-specific logic to adjust frompc from MI to MD. For
these two reasons:
1. On ia64 a function pointer does not hold the address of the first
   instruction of a functions implementation. It holds the address
   of a function descriptor. Hence the user(), btrap(), eintr() and
   bintr() prototypes are wrong for getting the actual code address.
2. The logic forces interrupt, trap and exception entry points to
   be layed-out contiguously. This can not be achieved on ia64 and is
   generally just bad programming.

The MCOUNT_FROMPC_USER macro is used to set the frompc argument to
some kernel address which represents any frompc that falls outside
the kernel text range. The macro can expand to ~0U to bail out in
that case.
The MCOUNT_FROMPC_INTR macro is used to set the frompc argument to
some kernel address to represent a call to a trap or interrupt
handler. This to avoid that the trap or interrupt handler appear to
be called from everywhere in the call graph. The macro can expand
to ~0U to prevent adjusting frompc. Note that the argument is selfpc,
not frompc.

This commit defines the macros on all architectures equivalently to
the original code in sys/libkern/mcount.c. People can take it from
here...

Compile-tested on: alpha, amd64, i386, ia64 and sparc64
Boot-tested on: i386
2004-08-27 19:42:35 +00:00
mux
35780dc21a Instead of calling ia32_pause() conditionally on __i386__ or __amd64__
being defined, define and use a new MD macro, cpu_spinwait().  It only
expands to something on i386 and amd64, so the compiled code should be
identical.

Name of the macro found by:	jhb
Reviewed by:	jhb
2004-08-03 18:44:27 +00:00
cognet
53db7b6142 *blush*
Fix htonl and htons.
2004-08-02 12:24:18 +00:00
cognet
ca5e850ced Fix comments.
Spotted out by:	mux
2004-08-02 12:23:53 +00:00
rwatson
1a23ddfc9e Correct typo in prior commit: s/cd/td/ 2004-07-27 19:44:08 +00:00
rwatson
4ab080249a Pass a thread argument into cpu_critical_{enter,exit}() rather than
dereference curthread.  It is called only from critical_{enter,exit}(),
which already dereferences curthread.  This doesn't seem to affect SMP
performance in my benchmarks, but improves MySQL transaction throughput
by about 1% on UP on my Xeon.

Head nodding:	jhb, bmilekic
2004-07-27 16:41:01 +00:00
cognet
348f262f29 Do not declare curpcb. 2004-07-21 22:04:32 +00:00
cognet
c5c2cfa0c5 Define pmap_page_is_mapped(). 2004-07-21 22:02:48 +00:00
cognet
f6936a77a8 Nuke disable_intr() and enable_intr(), as it already exists elsewhere. 2004-07-20 22:38:46 +00:00