xref: /freebsd/lib/libc/i386/stdlib/div.S (revision ed820052d048c873259dd55d7d70cd6d54919feb)
12ceb2ce9SGarrett Wollman/*
2e34402d3SAlexander Kabaev * Copyright (c) 1993 Winning Strategies, Inc.
3e34402d3SAlexander Kabaev * All rights reserved.
4e34402d3SAlexander Kabaev *
5e34402d3SAlexander Kabaev * Redistribution and use in source and binary forms, with or without
6e34402d3SAlexander Kabaev * modification, are permitted provided that the following conditions
7e34402d3SAlexander Kabaev * are met:
8e34402d3SAlexander Kabaev * 1. Redistributions of source code must retain the above copyright
9e34402d3SAlexander Kabaev *    notice, this list of conditions and the following disclaimer.
10e34402d3SAlexander Kabaev * 2. Redistributions in binary form must reproduce the above copyright
11e34402d3SAlexander Kabaev *    notice, this list of conditions and the following disclaimer in the
12e34402d3SAlexander Kabaev *    documentation and/or other materials provided with the distribution.
13e34402d3SAlexander Kabaev * 4. The name of the author may not be used to endorse or promote products
14e34402d3SAlexander Kabaev *    derived from this software without specific prior written permission
15e34402d3SAlexander Kabaev *
16e34402d3SAlexander Kabaev * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17e34402d3SAlexander Kabaev * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18e34402d3SAlexander Kabaev * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19e34402d3SAlexander Kabaev * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20e34402d3SAlexander Kabaev * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21e34402d3SAlexander Kabaev * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22e34402d3SAlexander Kabaev * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23e34402d3SAlexander Kabaev * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24e34402d3SAlexander Kabaev * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25e34402d3SAlexander Kabaev * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262ceb2ce9SGarrett Wollman */
272ceb2ce9SGarrett Wollman
28e6d808aeSPeter Wemm#include <machine/asm.h>
29c04447baSDavid E. O'Brien__FBSDID("$FreeBSD$");
302ceb2ce9SGarrett Wollman
312ceb2ce9SGarrett WollmanENTRY(div)
32e34402d3SAlexander Kabaev        movl    4(%esp),%eax
33e34402d3SAlexander Kabaev        movl    8(%esp),%ecx
342ceb2ce9SGarrett Wollman        cdq
352ceb2ce9SGarrett Wollman        idiv    %ecx
36e34402d3SAlexander Kabaev        movl    %eax,4(%esp)
37e34402d3SAlexander Kabaev        movl    %edx,8(%esp)
38e34402d3SAlexander Kabaev        ret
39ed820052SPeter WemmEND(div)
40