freebsd-dev/sys
Bill Paul d02239a3af Create new i386 windows/bsd thunking layer, similar to the amd64 thunking
layer, but with a twist.

The twist has to do with the fact that Microsoft supports structured
exception handling in kernel mode. On the i386 arch, exception handling
is implemented by hanging an exception registration list off the
Thread Environment Block (TEB), and the TEB is accessed via the %fs
register. The problem is, we use %fs as a pointer to the pcpu stucture,
which means any driver that tries to write through %fs:0 will overwrite
the curthread pointer and make a serious mess of things.

To get around this, Project Evil now creates a special entry in
the GDT on each processor. When we call into Windows code, a context
switch routine will fix up %fs so it points to our new descriptor,
which in turn points to a fake TEB. When the Windows code returns,
or calls out to an external routine, we swap %fs back again. Currently,
Project Evil makes use of GDT slot 7, which is all 0s by default.
I fully expect someone to jump up and say I can't do that, but I
couldn't find any code that makes use of this entry anywhere. Sadly,
this was the only method I could come up with that worked on both
UP and SMP. (Modifying the LDT works on UP, but becomes incredibly
complicated on SMP.) If necessary, the context switching stuff can
be yanked out while preserving the convention calling wrappers.

(Fortunately, it looks like Microsoft uses some special epilog/prolog
code on amd64 to implement exception handling, so the same nastiness
won't be necessary on that arch.)

The advantages are:

- Any driver that uses %fs as though it were a TEB pointer won't
  clobber pcpu.
- All the __stdcall/__fastcall/__regparm stuff that's specific to
  gcc goes away.

Also, while I'm here, switch NdisGetSystemUpTime() back to using
nanouptime() again. It turns out nanouptime() is way more accurate
than just using ticks(). On slower machines, the Atheros drivers
I tested seem to take a long time to associate due to the loss
in accuracy.
2005-04-11 02:02:35 +00:00
..
alpha Fix another instance of TDP_OWEPREEMPT -> td_owepreempt. 2005-04-09 18:15:17 +00:00
amd64 Align the entry point to assembly language functions to a 16-byte boundary. 2005-04-10 20:49:21 +00:00
arm Don't announce the range SDRAM_START-freemempos until I figure out what's 2005-04-07 22:04:18 +00:00
boot Fix 'implicit int' instance. 2005-04-09 14:07:13 +00:00
bsm Add a stub audit_kevents.h, which defines exactly one audit event: 2005-02-02 14:27:36 +00:00
cam avoid use after free 2005-03-31 21:43:19 +00:00
coda Explicitly hold a reference to the cdev we have just cloned. This 2005-03-31 12:19:44 +00:00
compat Create new i386 windows/bsd thunking layer, similar to the amd64 thunking 2005-04-11 02:02:35 +00:00
conf Get more love from GEOM on arm. 2005-04-07 22:06:56 +00:00
contrib This commit was generated by cvs2svn to compensate for changes in r143439, 2005-03-12 00:17:37 +00:00
crypto gbde(8) is also rejndael user. 2005-03-11 22:07:04 +00:00
ddb Start each of the license/copyright comments with /*- 2005-01-06 01:34:41 +00:00
dev Create new i386 windows/bsd thunking layer, similar to the amd64 thunking 2005-04-11 02:02:35 +00:00
doc
fs Initialize vp before using it. Failing to do this can cause instant 2005-04-10 03:17:42 +00:00
gdb check return value of gdb_rx_varhex 2005-03-28 18:31:18 +00:00
geom Fix a long-standing bug. Error string has to be copyied from the user 2005-04-08 09:28:08 +00:00
gnu - Remove wantparent, it is no longer necessary. An assert in vfs_lookup.c 2005-03-29 13:09:42 +00:00
i4b Don't use 'i386/include' directly. 2005-04-08 03:37:20 +00:00
i386 Properly terminate the table generated from ACPI info. The cpufreq 2005-04-10 19:57:47 +00:00
ia64 Divorce critical sections from spinlocks. Critical sections as denoted by 2005-04-04 21:53:56 +00:00
isa - Don't enable periodic interrupts from the RTC by default in rtc_statusb. 2005-03-24 21:34:16 +00:00
isofs/cd9660 - We no longer have to bother with PDIRUNLOCK, lookup() handles it for us. 2005-03-28 09:34:36 +00:00
kern Add debugging prints to all the methods in case there are problems with 2005-04-10 19:11:23 +00:00
libkern Replace the current strspn() and strcspn() with significantly faster 2005-04-02 18:52:44 +00:00
modules Create new i386 windows/bsd thunking layer, similar to the amd64 thunking 2005-04-11 02:02:35 +00:00
net Explicitly hold a reference to the cdev we have just cloned. This 2005-03-31 12:19:44 +00:00
net80211 remove extern from function decls 2005-04-04 04:27:20 +00:00
netatalk When generating a phase II ARP lookup from aarpwhohas(), use a 2005-02-22 14:37:22 +00:00
netatm In the current world order, solisten() implements the state transition of 2005-02-21 21:58:17 +00:00
netgraph Change the embedded module name from "bluetooth" to "ng_bluetooth" to match 2005-04-08 05:13:53 +00:00
netinet - Tighten up the Timestamp checks to prevent a spoofed segment from 2005-04-10 05:24:59 +00:00
netinet6 check for malloc failure (also move malloc up to simplify error recovery) 2005-03-29 01:26:27 +00:00
netipsec correct space check 2005-03-09 15:28:48 +00:00
netipx Update copyright: parts of the netipx implementation are covered by a 2005-04-10 18:05:46 +00:00
netkey fixed an unexpected addr/port matching failure in IPv6 SA management 2005-01-10 13:06:42 +00:00
netnatm Mark netatm and netnatm explicitly as requiring Giant, as they still do. 2005-02-17 14:21:22 +00:00
netncp avoid potential null ptr derefs 2005-02-23 22:44:38 +00:00
netsmb Explicitly hold a reference to the cdev we have just cloned. This 2005-03-31 12:19:44 +00:00
nfs /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
nfs4client - Remove wantparent, it is no longer necessary. An assert in vfs_lookup.c 2005-03-29 13:09:42 +00:00
nfsclient - LK_NOPAUSE is a nop now. 2005-03-31 04:37:09 +00:00
nfsserver avoid potential null ptr deref by free'ing excess mbufs instead of 2005-03-28 18:51:58 +00:00
opencrypto just use crypto/rijndael, and nuke opencrypto/rindael.[ch]. 2005-03-11 17:24:46 +00:00
pc98 Oops, correct typo. 2005-04-10 03:36:13 +00:00
pccard Remove more deadwood that never got implemented in NEWCARD, since NEWCARD 2005-02-15 02:54:53 +00:00
pci Add nForce3-250. 2005-04-08 18:04:39 +00:00
posix4 Actually commit the code for kern_sched_get_rr_interval(). 2005-03-31 22:54:48 +00:00
powerpc Change an instance of md_savecrit to md_saved_msr that I missed. 2005-04-08 14:26:55 +00:00
rpc - Don't call rpcclnt_realign() if we don't have any mbufs to realign. 2005-03-19 01:16:25 +00:00
security Remove an accidental clearing of the new label pointer on a system V 2005-02-24 16:08:41 +00:00
sparc64 Divorce critical sections from spinlocks. Critical sections as denoted by 2005-04-04 21:53:56 +00:00
sys - Remove the namei NOOBJ flag. It is meaningless now. 2005-04-09 12:04:36 +00:00
tools Add VOP_FOO_APV() which takes a pointer to the vop_vector. 2005-02-08 12:54:32 +00:00
ufs - Consistently call 'vp' vp rather than ovp sometimes in ffs_truncate(). 2005-04-05 08:49:41 +00:00
vm Flip the switch and turn mpsafevm on by default for sparc64. 2005-04-04 20:59:02 +00:00
Makefile When building cscopnamefile, default architecture to ${MACHINE}, not i386. 2005-03-08 00:09:41 +00:00