VirtualBox

Changeset 20449 in vbox for trunk/src/VBox/Runtime/r0drv


Ignore:
Timestamp:
Jun 9, 2009 10:23:42 PM (16 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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