VirtualBox

Changeset 20449 in vbox


Ignore:
Timestamp:
Jun 9, 2009 10:23:42 PM (15 years ago)
Author:
vboxsync
Message:

FreeBSD: Implement preemption API for guest SMP and enable it (slightly tested). Add neccessary RTMP* methods in userspace for the frontends to detect the number of CPUs

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r20447 r20449  
    495495## For experimenting with disabling preemption instead of interrupts
    496496# when working VT-x/AMD-V in VMMR0.
    497 ## @todo darwin, freebsd, os2. This should be made the default.
    498 if1of ($(KBUILD_TARGET), linux solaris windows)
     497## @todo darwin, os2. This should be made the default.
     498if1of ($(KBUILD_TARGET), linux solaris windows freebsd)
    499499 VBOX_WITH_VMMR0_DISABLE_PREEMPTION=1
    500500endif
  • trunk/src/VBox/Runtime/Makefile.kmk

    r20360 r20449  
    521521        generic/utf16locale-generic.cpp \
    522522        generic/uuid-generic.cpp \
    523         generic/RTMpGetCurFrequency-generic.cpp \
    524         generic/RTMpGetMaxFrequency-generic.cpp \
    525523        generic/RTMpCpuId-generic.cpp \
    526524        generic/RTMpCpuIdFromSetIndex-generic.cpp \
     
    528526        generic/RTMpIsCpuPossible-generic.cpp \
    529527        generic/RTMpGetMaxCpuId-generic.cpp \
    530         generic/RTMpGetOnlineCount-generic.cpp \
    531528        generic/RTMpGetOnlineSet-generic.cpp \
    532529        generic/RTMpGetSet-generic.cpp \
    533530        generic/RTMpIsCpuOnline-generic.cpp \
    534531        generic/RTProcIsRunningByName-generic.cpp \
     532        r3/freebsd/mp-freebsd.cpp \
    535533        r3/freebsd/alloc-freebsd.cpp \
    536534        r3/freebsd/rtProcInitExePath-freebsd.cpp \
     
    12851283        generic/mppresent-generic.cpp \
    12861284        r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp \
    1287         r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp \
    1288         r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp \
    1289         r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp \
    1290         r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp \
    1291         r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp \
    12921285        r0drv/generic/mpnotification-r0drv-generic.cpp \
    12931286        r0drv/freebsd/alloc-r0drv-freebsd.c \
  • trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c

    r18972 r20449  
    107107}
    108108
     109RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread)
     110{
     111    Assert(hThread == NIL_RTTHREAD);
     112
     113    return curthread->td_critnest == 0;
     114}
     115
     116
     117RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread)
     118{
     119    Assert(hThread == NIL_RTTHREAD);
     120
     121    return curthread->td_owepreempt == 1;
     122}
     123
     124RTDECL(bool) RTThreadPreemptIsPendingTrusty(void)
     125{
     126    /* yes, RTThreadPreemptIsPending is reliable. */
     127    return true;
     128}
     129
     130RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState)
     131{
     132    AssertPtr(pState);
     133    Assert(pState->uchDummy != 42);
     134    pState->uchDummy = 42;
     135
     136    critical_enter();
     137}
     138
     139
     140RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
     141{
     142    AssertPtr(pState);
     143    Assert(pState->uchDummy == 42);
     144    pState->uchDummy = 0;
     145
     146    critical_exit();
     147}
     148
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette