mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 10:47:36 +00:00
Kernel: Make sure we don't use any FPU/MMX/SSE instructions.
This commit is contained in:
parent
5c68929aa1
commit
2d7cad6a16
6 changed files with 10 additions and 16 deletions
|
@ -248,10 +248,12 @@ one_more:
|
|||
ret += print_hex(putch, bufptr, va_arg(ap, qword), 16);
|
||||
break;
|
||||
|
||||
#ifndef KERNEL
|
||||
case 'f':
|
||||
// FIXME: Print as float!
|
||||
ret += print_number(putch, bufptr, (int)va_arg(ap, double), leftPad, zeroPad, fieldWidth);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'o':
|
||||
if (alternate_form) {
|
||||
|
|
|
@ -10,20 +10,13 @@ RandomDevice::~RandomDevice()
|
|||
{
|
||||
}
|
||||
|
||||
// Simple rand() and srand() borrowed from the POSIX standard:
|
||||
static dword next = 1;
|
||||
|
||||
static unsigned long next = 1;
|
||||
|
||||
#define MY_RAND_MAX 32767
|
||||
int RandomDevice::random_value()
|
||||
#define MY_RAND_MAX 4294967295U
|
||||
dword RandomDevice::random_value()
|
||||
{
|
||||
next = next * 1103515245 + 12345;
|
||||
return((unsigned)(next/((MY_RAND_MAX + 1) * 2)) % (MY_RAND_MAX + 1));
|
||||
}
|
||||
|
||||
float RandomDevice::random_percentage()
|
||||
{
|
||||
return (float)random_value() / (float)MY_RAND_MAX;
|
||||
return next;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -8,8 +8,7 @@ public:
|
|||
RandomDevice();
|
||||
virtual ~RandomDevice() override;
|
||||
|
||||
static int random_value();
|
||||
static float random_percentage();
|
||||
static dword random_value();
|
||||
|
||||
private:
|
||||
// ^CharacterDevice
|
||||
|
|
|
@ -80,7 +80,7 @@ CXX_OBJS = $(KERNEL_OBJS) $(VFS_OBJS) $(AK_OBJS)
|
|||
OBJS = $(CXX_OBJS) Boot/boot.ao
|
||||
|
||||
KERNEL = kernel
|
||||
CXXFLAGS += -ffreestanding -mregparm=3
|
||||
CXXFLAGS += -ffreestanding -mregparm=3 -mno-80387 -mno-mmx -mno-sse -mno-sse2
|
||||
DEFINES += -DKERNEL
|
||||
LD = i686-pc-serenity-ld
|
||||
LDFLAGS += -T linker.ld
|
||||
|
|
|
@ -181,7 +181,7 @@ int TCPSocket::protocol_allocate_source_port()
|
|||
static const word first_ephemeral_port = 32768;
|
||||
static const word last_ephemeral_port = 60999;
|
||||
static const word ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port;
|
||||
word first_scan_port = first_ephemeral_port + (word)(RandomDevice::random_percentage() * ephemeral_port_range_size);
|
||||
word first_scan_port = first_ephemeral_port + RandomDevice::random_value() % ephemeral_port_range_size;
|
||||
|
||||
LOCKER(sockets_by_port().lock());
|
||||
for (word port = first_scan_port;;) {
|
||||
|
|
|
@ -91,7 +91,7 @@ int UDPSocket::protocol_allocate_source_port()
|
|||
static const word first_ephemeral_port = 32768;
|
||||
static const word last_ephemeral_port = 60999;
|
||||
static const word ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port;
|
||||
word first_scan_port = first_ephemeral_port + (word)(RandomDevice::random_percentage() * ephemeral_port_range_size);
|
||||
word first_scan_port = first_ephemeral_port + RandomDevice::random_value() % ephemeral_port_range_size;
|
||||
|
||||
LOCKER(sockets_by_port().lock());
|
||||
for (word port = first_scan_port;;) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue