Skip to content

Commit 45d004c

Browse files
committed
remove arch depend code
1 parent 5c08623 commit 45d004c

29 files changed

+21
-698
lines changed

uinet/freebsd/kern/kern_tc.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,7 @@ void dtrace_getnanotime(struct timespec *tsp);
145145
static int
146146
sysctl_kern_boottime(SYSCTL_HANDLER_ARGS)
147147
{
148-
#ifndef __mips__
149-
#ifdef SCTL_MASK32
150-
int tv[2];
151-
152-
if (req->flags & SCTL_MASK32) {
153-
tv[0] = boottime.tv_sec;
154-
tv[1] = boottime.tv_usec;
155-
return SYSCTL_OUT(req, tv, sizeof(tv));
156-
} else
157-
#endif
158-
#endif
159-
return SYSCTL_OUT(req, &boottime, sizeof(boottime));
148+
return SYSCTL_OUT(req, &boottime, sizeof(boottime));
160149
}
161150

162151
static int
@@ -1357,12 +1346,12 @@ tc_windup(void)
13571346

13581347
/* Now is a good time to change timecounters. */
13591348
if (th->th_counter != timecounter) {
1360-
#ifndef __arm__
1349+
13611350
if ((timecounter->tc_flags & TC_FLAGS_C2STOP) != 0)
13621351
cpu_disable_c2_sleep++;
13631352
if ((th->th_counter->tc_flags & TC_FLAGS_C2STOP) != 0)
13641353
cpu_disable_c2_sleep--;
1365-
#endif
1354+
13661355
th->th_counter = timecounter;
13671356
th->th_offset_count = ncount;
13681357
tc_min_ticktock_freq = max(1, timecounter->tc_frequency /

uinet/freebsd/kern/subr_param.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,11 @@ __FBSDID("$FreeBSD$");
5757
* System parameter formulae.
5858
*/
5959

60-
#ifndef HZ
61-
# if defined(__mips__) || defined(__arm__)
62-
# define HZ 100
63-
# else
64-
# define HZ 1000
65-
# endif
66-
# ifndef HZ_VM
67-
# define HZ_VM 100
68-
# endif
69-
#else
70-
# ifndef HZ_VM
71-
# define HZ_VM HZ
72-
# endif
60+
61+
#ifndef HZ_VM
62+
#define HZ_VM HZ
7363
#endif
64+
7465
#define NPROC (20 + 16 * maxusers)
7566
#ifndef NBUF
7667
#define NBUF 0
@@ -158,10 +149,6 @@ CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST);
158149
void
159150
init_param1(void)
160151
{
161-
162-
#if !defined(__mips__) && !defined(__arm64__) && !defined(__sparc64__)
163-
TUNABLE_INT_FETCH("kern.kstack_pages", &kstack_pages);
164-
#endif
165152
hz = -1;
166153
TUNABLE_INT_FETCH("kern.hz", &hz);
167154
if (hz == -1)

uinet/freebsd/kern/sysv_shm.c

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,6 @@ static struct syscall_helper_data shm_syscalls[] = {
867867
#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
868868
defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
869869
SYSCALL_INIT_HELPER_COMPAT(freebsd7_shmctl),
870-
#endif
871-
#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43))
872-
SYSCALL_INIT_HELPER(shmsys),
873870
#endif
874871
SYSCALL_INIT_LAST
875872
};
@@ -1211,102 +1208,6 @@ shm_prison_cleanup(struct prison *pr)
12111208

12121209
SYSCTL_JAIL_PARAM_SYS_NODE(sysvshm, CTLFLAG_RW, "SYSV shared memory");
12131210

1214-
#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43))
1215-
struct oshmid_ds {
1216-
struct ipc_perm_old shm_perm; /* operation perms */
1217-
int shm_segsz; /* size of segment (bytes) */
1218-
u_short shm_cpid; /* pid, creator */
1219-
u_short shm_lpid; /* pid, last operation */
1220-
short shm_nattch; /* no. of current attaches */
1221-
time_t shm_atime; /* last attach time */
1222-
time_t shm_dtime; /* last detach time */
1223-
time_t shm_ctime; /* last change time */
1224-
void *shm_handle; /* internal handle for shm segment */
1225-
};
1226-
1227-
struct oshmctl_args {
1228-
int shmid;
1229-
int cmd;
1230-
struct oshmid_ds *ubuf;
1231-
};
1232-
1233-
static int
1234-
oshmctl(struct thread *td, struct oshmctl_args *uap)
1235-
{
1236-
#ifdef COMPAT_43
1237-
int error = 0;
1238-
struct prison *rpr;
1239-
struct shmid_kernel *shmseg;
1240-
struct oshmid_ds outbuf;
1241-
1242-
rpr = shm_find_prison(td->td_ucred);
1243-
if (rpr == NULL)
1244-
return (ENOSYS);
1245-
if (uap->cmd != IPC_STAT) {
1246-
return (freebsd7_shmctl(td,
1247-
(struct freebsd7_shmctl_args *)uap));
1248-
}
1249-
SYSVSHM_LOCK();
1250-
shmseg = shm_find_segment(rpr, uap->shmid, true);
1251-
if (shmseg == NULL) {
1252-
SYSVSHM_UNLOCK();
1253-
return (EINVAL);
1254-
}
1255-
error = ipcperm(td, &shmseg->u.shm_perm, IPC_R);
1256-
if (error != 0) {
1257-
SYSVSHM_UNLOCK();
1258-
return (error);
1259-
}
1260-
#ifdef MAC
1261-
error = mac_sysvshm_check_shmctl(td->td_ucred, shmseg, uap->cmd);
1262-
if (error != 0) {
1263-
SYSVSHM_UNLOCK();
1264-
return (error);
1265-
}
1266-
#endif
1267-
ipcperm_new2old(&shmseg->u.shm_perm, &outbuf.shm_perm);
1268-
outbuf.shm_segsz = shmseg->u.shm_segsz;
1269-
outbuf.shm_cpid = shmseg->u.shm_cpid;
1270-
outbuf.shm_lpid = shmseg->u.shm_lpid;
1271-
outbuf.shm_nattch = shmseg->u.shm_nattch;
1272-
outbuf.shm_atime = shmseg->u.shm_atime;
1273-
outbuf.shm_dtime = shmseg->u.shm_dtime;
1274-
outbuf.shm_ctime = shmseg->u.shm_ctime;
1275-
outbuf.shm_handle = shmseg->object;
1276-
SYSVSHM_UNLOCK();
1277-
return (copyout(&outbuf, uap->ubuf, sizeof(outbuf)));
1278-
#else
1279-
return (EINVAL);
1280-
#endif
1281-
}
1282-
1283-
/* XXX casting to (sy_call_t *) is bogus, as usual. */
1284-
static sy_call_t *shmcalls[] = {
1285-
(sy_call_t *)sys_shmat, (sy_call_t *)oshmctl,
1286-
(sy_call_t *)sys_shmdt, (sy_call_t *)sys_shmget,
1287-
(sy_call_t *)freebsd7_shmctl
1288-
};
1289-
1290-
#ifndef _SYS_SYSPROTO_H_
1291-
/* XXX actually varargs. */
1292-
struct shmsys_args {
1293-
int which;
1294-
int a2;
1295-
int a3;
1296-
int a4;
1297-
};
1298-
#endif
1299-
int
1300-
sys_shmsys(struct thread *td, struct shmsys_args *uap)
1301-
{
1302-
1303-
if (uap->which < 0 || uap->which >= nitems(shmcalls))
1304-
return (EINVAL);
1305-
return ((*shmcalls[uap->which])(td, &uap->a2));
1306-
}
1307-
1308-
#endif /* i386 && (COMPAT_FREEBSD4 || COMPAT_43) */
1309-
13101211
#ifdef COMPAT_FREEBSD32
13111212

13121213
int

uinet/freebsd/net/altq/altq_subr.c

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@
7171
#include <sys/cpu.h>
7272
#include <sys/eventhandler.h>
7373
#include <machine/clock.h>
74-
#if defined(__amd64__) || defined(__i386__)
75-
#include <machine/cpufunc.h> /* for pentium tsc */
76-
#include <machine/specialreg.h> /* for CPUID_TSC */
77-
#include <machine/md_var.h> /* for cpu_feature */
78-
#endif /* __amd64 || __i386__ */
7974

8075
/*
8176
* internal function prototypes
@@ -896,11 +891,8 @@ int machclk_usepcc;
896891
u_int32_t machclk_freq;
897892
u_int32_t machclk_per_tick;
898893

899-
#if defined(__i386__) && defined(__NetBSD__)
900-
extern u_int64_t cpu_tsc_freq;
901-
#endif
902894

903-
#if (__FreeBSD_version >= 700035)
895+
904896
/* Update TSC freq with the value indicated by the caller. */
905897
static void
906898
tsc_freq_changed(void *arg, const struct cf_level *level, int status)
@@ -909,18 +901,12 @@ tsc_freq_changed(void *arg, const struct cf_level *level, int status)
909901
if (status != 0)
910902
return;
911903

912-
#if (__FreeBSD_version >= 701102) && (defined(__amd64__) || defined(__i386__))
913-
/* If TSC is P-state invariant, don't do anything. */
914-
if (tsc_is_invariant)
915-
return;
916-
#endif
917-
918904
/* Total setting for this level gives the new frequency in MHz. */
919905
init_machclk();
920906
}
921907
EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL,
922908
EVENTHANDLER_PRI_LAST);
923-
#endif /* __FreeBSD_version >= 700035 */
909+
924910

925911
static void
926912
init_machclk_setup(void)
@@ -931,21 +917,13 @@ init_machclk_setup(void)
931917

932918
machclk_usepcc = 1;
933919

934-
#if (!defined(__amd64__) && !defined(__i386__)) || defined(ALTQ_NOPCC)
935-
machclk_usepcc = 0;
936-
#endif
937920
#if defined(__FreeBSD__) && defined(SMP)
938921
machclk_usepcc = 0;
939922
#endif
940923
#if defined(__NetBSD__) && defined(MULTIPROCESSOR)
941924
machclk_usepcc = 0;
942925
#endif
943-
#if defined(__amd64__) || defined(__i386__)
944-
/* check if TSC is available */
945-
if ((cpu_feature & CPUID_TSC) == 0 ||
946-
atomic_load_acq_64(&tsc_freq) == 0)
947-
machclk_usepcc = 0;
948-
#endif
926+
949927
}
950928

951929
void
@@ -969,14 +947,6 @@ init_machclk(void)
969947
return;
970948
}
971949

972-
/*
973-
* if the clock frequency (of Pentium TSC or Alpha PCC) is
974-
* accessible, just use it.
975-
*/
976-
#if defined(__amd64__) || defined(__i386__)
977-
machclk_freq = atomic_load_acq_64(&tsc_freq);
978-
#endif
979-
980950
/*
981951
* if we don't know the clock frequency, measure it.
982952
*/
@@ -1005,27 +975,15 @@ init_machclk(void)
1005975
#endif
1006976
}
1007977

1008-
#if defined(__OpenBSD__) && defined(__i386__)
1009-
static __inline u_int64_t
1010-
rdtsc(void)
1011-
{
1012-
u_int64_t rv;
1013-
__asm __volatile(".byte 0x0f, 0x31" : "=A" (rv));
1014-
return (rv);
1015-
}
1016-
#endif /* __OpenBSD__ && __i386__ */
978+
1017979

1018980
u_int64_t
1019981
read_machclk(void)
1020982
{
1021983
u_int64_t val;
1022984

1023985
if (machclk_usepcc) {
1024-
#if defined(__amd64__) || defined(__i386__)
1025-
val = rdtsc();
1026-
#else
1027986
panic("read_machclk");
1028-
#endif
1029987
} else {
1030988
struct timeval tv;
1031989

uinet/freebsd/net/bpf.c

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,9 +1283,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
12831283
#endif
12841284
case BIOCGETIF:
12851285
case BIOCGRTIMEOUT:
1286-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1287-
case BIOCGRTIMEOUT32:
1288-
#endif
1286+
12891287
case BIOCGSTATS:
12901288
case BIOCVERSION:
12911289
case BIOCGRSIG:
@@ -1295,9 +1293,6 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
12951293
case FIONREAD:
12961294
case BIOCLOCK:
12971295
case BIOCSRTIMEOUT:
1298-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1299-
case BIOCSRTIMEOUT32:
1300-
#endif
13011296
case BIOCIMMEDIATE:
13021297
case TIOCGPGRP:
13031298
case BIOCROTZBUF:
@@ -1519,23 +1514,9 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
15191514
* Set read timeout.
15201515
*/
15211516
case BIOCSRTIMEOUT:
1522-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1523-
case BIOCSRTIMEOUT32:
1524-
#endif
15251517
{
15261518
struct timeval *tv = (struct timeval *)addr;
1527-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1528-
struct timeval32 *tv32;
1529-
struct timeval tv64;
1530-
1531-
if (cmd == BIOCSRTIMEOUT32) {
1532-
tv32 = (struct timeval32 *)addr;
1533-
tv = &tv64;
1534-
tv->tv_sec = tv32->tv_sec;
1535-
tv->tv_usec = tv32->tv_usec;
1536-
} else
1537-
#endif
1538-
tv = (struct timeval *)addr;
1519+
tv = (struct timeval *)addr;
15391520

15401521
/*
15411522
* Subtract 1 tick from tvtohz() since this isn't
@@ -1550,30 +1531,12 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
15501531
* Get read timeout.
15511532
*/
15521533
case BIOCGRTIMEOUT:
1553-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1554-
case BIOCGRTIMEOUT32:
1555-
#endif
15561534
{
15571535
struct timeval *tv;
1558-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1559-
struct timeval32 *tv32;
1560-
struct timeval tv64;
1561-
1562-
if (cmd == BIOCGRTIMEOUT32)
1563-
tv = &tv64;
1564-
else
1565-
#endif
1566-
tv = (struct timeval *)addr;
1536+
tv = (struct timeval *)addr;
15671537

15681538
tv->tv_sec = d->bd_rtout / hz;
15691539
tv->tv_usec = (d->bd_rtout % hz) * tick;
1570-
#if defined(COMPAT_FREEBSD32) && !defined(__mips__)
1571-
if (cmd == BIOCGRTIMEOUT32) {
1572-
tv32 = (struct timeval32 *)addr;
1573-
tv32->tv_sec = tv->tv_sec;
1574-
tv32->tv_usec = tv->tv_usec;
1575-
}
1576-
#endif
15771540

15781541
break;
15791542
}

uinet/freebsd/net/bpf_filter.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ __FBSDID("$FreeBSD$");
4646
#include <netinet/in.h>
4747
#endif
4848

49-
#ifndef __i386__
50-
#define BPF_ALIGN
51-
#endif
5249

5350
#ifndef BPF_ALIGN
5451
#define EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p))

0 commit comments

Comments
 (0)