text: /******************************************************************************/
  /* Important Fall 2020 CSCI 402 usage information:                            */
  /*                                                                            */
  /* This fils is part of CSCI 402 kernel programming assignments at USC.       */
  /*         53616c7465645f5fd1e93dbf35cbffa3aef28f8c01d8cf2ffc51ef62b26a       */
  /*         f9bda5a68e5ed8c972b17bab0f42e24b19daa7bd408305b1f7bd6c7208c1       */
  /*         0e36230e913039b3046dd5fd0ba706a624d33dbaa4d6aab02c82fe09f561       */
  /*         01b0fd977b0051f0b0ce0c69f7db857b1b5e007be2db6d42894bf93de848       */
  /*         806d9152bd5715e9                                                   */
  /* Please understand that you are NOT permitted to distribute or publically   */
  /*         display a copy of this file (or ANY PART of it) for any reason.    */
  /* If anyone (including your prospective employer) asks you to post the code, */
  /*         you must inform them that you do NOT have permissions to do so.    */
  /* You are also NOT permitted to remove or alter this comment block.          */
  /* If this comment block is removed or altered in a submitted file, 20 points */
  /*         will be deducted.                                                  */
  /******************************************************************************/
  
  #pragma once
  
  #include "kernel.h"
  #include "types.h"
  
  static inline void outb(uint16_t port, uint8_t val)
  {
          __asm__ volatile("outb %0,%1" :: "a"(val), "Nd"(port));
  }
  
  static inline uint8_t inb(uint16_t port)
  {
          uint8_t ret;
          __asm__ volatile("inb %1,%0" : "=a"(ret) : "Nd"(port));
          return ret;
  }
  
  static inline void outw(uint16_t port, uint16_t val)
  {
          __asm__ volatile("outw %0,%1" :: "a"(val), "Nd"(port));
  }
  
  static inline uint16_t inw(uint16_t port)
  {
          uint16_t ret;
          __asm__ volatile("inw %1,%0" : "=a"(ret) : "Nd"(port));
          return ret;
  }
  
  static inline void outl(uint16_t port, uint32_t val)
  {
          __asm__ volatile("outl %0,%1" :: "a"(val), "Nd"(port));
  }
  
  static inline uint32_t inl(uint16_t port)
  {
          uint32_t ret;
          __asm__ volatile("inl %1,%0" : "=a"(ret) : "Nd"(port));
          return ret;
  }
  
  