Changeset 152 for sbliveos2/trunk/lib32


Ignore:
Timestamp:
Jul 17, 2000, 8:37:33 PM (25 years ago)
Author:
sandervl
Message:

misc updates

Location:
sbliveos2/trunk/lib32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sbliveos2/trunk/lib32/memory.cpp

    r148 r152  
    129129void __copy_user(void *to, const void *from, unsigned long n)
    130130{
     131        if(to == NULL || from == NULL) {
     132                DebugInt3();
     133                return;
     134        }
     135        if(n == 0) return;
    131136#ifdef KEE
    132137        memcpy(to, from, n);
     
    139144unsigned long copy_to_user(void *to, const void *from, unsigned long n)
    140145{
     146        if(to == NULL || from == NULL) {
     147                DebugInt3();
     148                return 0;
     149        }
     150        if(n == 0) return 0;
    141151#ifdef KEE
    142152        memcpy(to, from, n);
     
    150160void __copy_user_zeroing(void *to, const void *from, unsigned long n)
    151161{
     162        if(to == NULL || from == NULL) {
     163                DebugInt3();
     164                return;
     165        }
     166        if(n == 0) return;
    152167        copy_to_user(to, from, n);
    153168}
     
    156171unsigned long copy_from_user(void *to, const void *from, unsigned long n)
    157172{
     173        if(to == NULL || from == NULL) {
     174                DebugInt3();
     175                return 0;
     176        }
     177        if(n == 0) return 0;
    158178#ifdef KEE
    159179        memcpy(to, from, n);
     
    167187int get_user(int size, void *dest, void *src)
    168188{
     189        if(size == 0)   return 0;
     190
     191        if(dest == NULL || src == NULL) {
     192                DebugInt3();
     193                return 0;
     194        }
    169195#ifdef KEE
    170196        memcpy(dest, src, size);
     
    178204int put_user(int x, void *ptr)
    179205{
     206        if(ptr == NULL) {
     207                DebugInt3();
     208                return 0;
     209        }
     210
    180211        *(int *)ptr = x;
    181212        return 0;
     
    200231 char near *addr;
    201232
     233  if(size == 0) {
     234        DebugInt3();
     235        return NULL;
     236  }
    202237  if(size > 1024) {
    203238#ifdef KEE
  • sbliveos2/trunk/lib32/sound.c

    r151 r152  
    451451//******************************************************************************
    452452//******************************************************************************
     453ULONG OSS32_StreamGetSpace(ULONG streamtype, ULONG streamid)
     454{
     455 struct inode   ossinode;
     456 struct file    ossfile;
     457 struct dentry  ossdentry;
     458 ULONG          ossid = streamtype & OSS_IDMASK;
     459 audio_buf_info info;
     460 char NEAR     *tmpbuf;
     461 ULONG          cmd;
     462 int            transferred;
     463
     464  ossinode.i_rdev = ossid;
     465  ossfile.private_data = (void *)streamid;
     466  ossfile.f_flags = 0;
     467  ossfile.f_dentry = &ossdentry;
     468  ossdentry.d_inode = &ossinode;
     469
     470  switch(streamtype) {
     471  case OSS_STREAM_WAVEOUT:
     472        ossfile.f_mode = FMODE_WRITE;
     473        cmd = SNDCTL_DSP_GETOSPACE;
     474        break;
     475  case OSS_STREAM_WAVEIN:
     476        ossfile.f_mode = FMODE_READ;
     477        cmd = SNDCTL_DSP_GETISPACE;
     478        break;
     479  case OSS_STREAM_MIDIOUT:
     480        ossfile.f_mode = FMODE_WRITE;
     481        break;
     482  case OSS_STREAM_MIDIIN:
     483        ossfile.f_mode = FMODE_READ;
     484        break;
     485  }
     486
     487  if(!oss_devices[ossid].write || !oss_devices[ossid].read || !oss_devices[ossid].ioctl) {
     488        return 0;
     489  }
     490  //check how much room is left in the circular dma buffer
     491#ifdef KEE
     492  tmpbuf = (char NEAR *)&info;
     493#else
     494  tmpbuf = (char NEAR *)__StackToFlat((ULONG)&info);
     495#endif
     496  if(oss_devices[ossid].ioctl(&ossinode, &ossfile, cmd, (ULONG)tmpbuf)) {
     497        return 0;
     498  }
     499  return info.bytes;
     500}
     501//******************************************************************************
     502//******************************************************************************
    453503ULONG OSS32_SetVolume(ULONG streamtype, ULONG streamid, ULONG cmd, ULONG volume)
    454504{
Note: See TracChangeset for help on using the changeset viewer.