Changeset 46ec2c06 in mainline


Ignore:
Timestamp:
2006-05-11T16:08:50Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7981e3cc
Parents:
20a9b85
Message:

SYS_AS_AREA_DESTROY support for uspace.

Formatting fixes in libpci.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/as.c

    r20a9b85 r46ec2c06  
    5252 * @param flags Currently unused.
    5353 *
    54  * @return address on success, (void *) -1 otherwise.
     54 * @return Zero on success or a code from @ref errno.h on failure.
    5555 */
    56 void *as_area_resize(void *address, size_t size, int flags)
     56int as_area_resize(void *address, size_t size, int flags)
    5757{
    58         return (void *) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
     58        return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t) size, (sysarg_t) flags);
     59}
     60
     61/** Destroy address space area.
     62 *
     63 * @param address Virtual address pointing into the address space area being destroyed.
     64 *
     65 * @return Zero on success or a code from @ref errno.h on failure.
     66 */
     67int as_area_destroy(void *address)
     68{
     69        return __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t ) address);
    5970}
    6071
     
    111122void *sbrk(ssize_t incr)
    112123{
     124        int rc;
    113125        void *res;
    114126        /* Check for invalid values */
     
    122134                return NULL;
    123135
    124         res = as_area_resize(&_heap, heapsize + incr,0);
    125         if (!res)
     136        rc = as_area_resize(&_heap, heapsize + incr,0);
     137        if (rc != 0)
    126138                return NULL;
    127139       
  • libc/include/as.h

    r20a9b85 r46ec2c06  
    3434
    3535extern void *as_area_create(void *address, size_t size, int flags);
    36 extern void *as_area_resize(void *address, size_t size, int flags);
     36extern int as_area_resize(void *address, size_t size, int flags);
     37extern int as_area_destroy(void *address);
    3738extern int as_area_accept(task_id_t id, void *base, size_t size, int flags);
    3839extern int as_area_send(task_id_t id, void *base);
  • pci/libpci/access.c

    r20a9b85 r46ec2c06  
    2626        int i;
    2727
     28        if (!a)
     29                return NULL;
     30               
    2831        bzero(a, sizeof(*a));
    2932        for (i = 0; i < PCI_ACCESS_MAX; i++)
     
    3841
    3942        if (!x)
    40                 a->error("Out of memory (allocation of %d bytes failed)",
    41                          size);
     43                a->error("Out of memory (allocation of %d bytes failed)", size);
    4244        return x;
    4345}
     
    219221{
    220222        if (pos & (len - 1))
    221                 d->access->error("Unaligned write: pos=%02x,len=%d", pos,
    222                                  len);
     223                d->access->error("Unaligned write: pos=%02x,len=%d", pos, len);
    223224        if (pos + len <= d->cache_len)
    224225                memcpy(d->cache + pos, buf, len);
     
    246247{
    247248        if (pos < d->cache_len) {
    248                 int l =
    249                     (pos + len >=
    250                      d->cache_len) ? (d->cache_len - pos) : len;
     249                int l = (pos + len >= d->cache_len) ? (d->cache_len - pos) : len;
    251250                memcpy(d->cache + pos, buf, l);
    252251        }
     
    261260        }
    262261        if (flags & ~d->known_fields)
    263                 d->known_fields |=
    264                     d->methods->fill_info(d, flags & ~d->known_fields);
     262                d->known_fields |= d->methods->fill_info(d, flags & ~d->known_fields);
    265263        return d->known_fields;
    266264}
  • pci/libpci/i386-ports.c

    r20a9b85 r46ec2c06  
    8080        for (d.dev = 0; d.dev < 32; d.dev++) {
    8181                u16 class, vendor;
    82                 if (m->
    83                     read(&d, PCI_CLASS_DEVICE, (byte *) & class,
     82                if (m->read(&d, PCI_CLASS_DEVICE, (byte *) & class,
    8483                         sizeof(class))
    8584                    && (class == cpu_to_le16(PCI_CLASS_BRIDGE_HOST)
     
    179178{
    180179        /* This is ugly and tends to produce false positives. Beware. */
    181 
    182180        outb(0x00, 0xCFB);
    183181        outb(0x00, 0xCF8);
     
    227225
    228226        if (d->dev >= 16)
    229                 d->access->
    230                     error("conf2_write: only first 16 devices exist.");
     227                d->access->error("conf2_write: only first 16 devices exist.");
    231228        outb((d->func << 1) | 0xf0, 0xcf8);
    232229        outb(d->bus, 0xcfa);
Note: See TracChangeset for help on using the changeset viewer.