d02239a3af
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. |
||
---|---|---|
.. | ||
3dfx | ||
aac | ||
accf_data | ||
accf_http | ||
acpi | ||
agp | ||
aha | ||
ahb | ||
aic | ||
aic7xxx | ||
aio | ||
amd | ||
amr | ||
an | ||
aout | ||
apm | ||
ar | ||
arcmsr | ||
arcnet | ||
arl | ||
asr | ||
ata | ||
ath | ||
ath_hal | ||
ath_rate_amrr | ||
ath_rate_onoe | ||
ath_rate_sample | ||
aue | ||
auxio | ||
awi | ||
axe | ||
bfe | ||
bge | ||
bios | ||
bktr | ||
bridge | ||
cam | ||
canbepm | ||
canbus | ||
cardbus | ||
cbb | ||
cd9660 | ||
cd9660_iconv | ||
cdce | ||
ciss | ||
cm | ||
coda | ||
coda5 | ||
coff | ||
cp | ||
cpufreq | ||
crypto | ||
cryptodev | ||
cs | ||
ctau | ||
cue | ||
cx | ||
dc | ||
dcons | ||
dcons_crom | ||
de | ||
digi | ||
dpt | ||
drm | ||
dummynet | ||
ed | ||
el | ||
elink | ||
em | ||
en | ||
ep | ||
esp | ||
ex | ||
exca | ||
ext2fs | ||
fatm | ||
fdc | ||
fdescfs | ||
fe | ||
firewire | ||
fxp | ||
gem | ||
geom | ||
harp | ||
hatm | ||
hfa | ||
hifn | ||
hme | ||
hpfs | ||
hptmv | ||
i2c | ||
ibcs2 | ||
ichwd | ||
ida | ||
idt | ||
ie | ||
if_disc | ||
if_ef | ||
if_faith | ||
if_gif | ||
if_gre | ||
if_ndis | ||
if_ppp | ||
if_sl | ||
if_stf | ||
if_tap | ||
if_tun | ||
if_vlan | ||
iir | ||
io | ||
ip6fw | ||
ip_mroute_mod | ||
ipdivert | ||
ipfilter | ||
ipfw | ||
ips | ||
isp | ||
ispfw | ||
ixgb | ||
joy | ||
kue | ||
lge | ||
libiconv | ||
libmbpool | ||
libmchain | ||
linprocfs | ||
linux | ||
lnc | ||
lpt | ||
mac_biba | ||
mac_bsdextended | ||
mac_ifoff | ||
mac_lomac | ||
mac_mls | ||
mac_none | ||
mac_partition | ||
mac_portacl | ||
mac_seeotheruids | ||
mac_stub | ||
mac_test | ||
mcd | ||
md | ||
mem | ||
mii | ||
mlx | ||
mly | ||
mpt | ||
msdosfs | ||
msdosfs_iconv | ||
mse | ||
my | ||
ncp | ||
ncv | ||
ndis | ||
netgraph | ||
nfs4client | ||
nfsclient | ||
nfsserver | ||
nge | ||
nmdm | ||
nsp | ||
ntfs | ||
ntfs_iconv | ||
nullfs | ||
nve | ||
nwfs | ||
oldcard | ||
oltr | ||
osf1 | ||
owi | ||
patm | ||
pccard | ||
pcfclock | ||
pcn | ||
pecoff | ||
pf | ||
plip | ||
pmc | ||
portalfs | ||
ppbus | ||
ppi | ||
pps | ||
procfs | ||
pseudofs | ||
pst | ||
random | ||
ray | ||
rc | ||
rc4 | ||
re | ||
rl | ||
rndtest | ||
rp | ||
rue | ||
s3 | ||
safe | ||
sbni | ||
sbsh | ||
scd | ||
scsi_low | ||
sem | ||
sf | ||
sio | ||
sis | ||
sk | ||
smbfs | ||
sn | ||
snc | ||
snp | ||
sound | ||
speaker | ||
splash | ||
sppp | ||
sr | ||
ste | ||
stg | ||
streams | ||
svr4 | ||
sym | ||
syscons | ||
sysvipc | ||
ti | ||
tl | ||
trm | ||
twa | ||
twe | ||
tx | ||
txp | ||
uart | ||
ubsa | ||
ubsec | ||
ubser | ||
ucom | ||
ucycom | ||
udav | ||
udbp | ||
udf | ||
udf_iconv | ||
ufm | ||
ufs | ||
uftdi | ||
ugen | ||
uhid | ||
ukbd | ||
ulpt | ||
umapfs | ||
umass | ||
umct | ||
umodem | ||
ums | ||
unionfs | ||
uplcom | ||
urio | ||
usb | ||
uscanner | ||
utopia | ||
uvisor | ||
uvscom | ||
vesa | ||
vge | ||
vkbd | ||
vpo | ||
vr | ||
vx | ||
wb | ||
wi | ||
wlan | ||
wlan_acl | ||
wlan_ccmp | ||
wlan_tkip | ||
wlan_wep | ||
wlan_xauth | ||
xe | ||
xl | ||
zlib | ||
Makefile | ||
Makefile.inc |